Hardware-efficient building blocks for sparse linear algebra and stencil solvers