Mat2Stencil: A Modular Matrix-Based DSL for Explicit and Implicit Matrix-Free PDE Solvers on Structured Grid
Huanqi Cao, Shizhi Tang, Qianchao Zhu, Bowen Yu, Wenguang Chen

TL;DR
Mat2Stencil is a new domain-specific language and compiler that simplifies the development of high-performance, scalable PDE solvers on structured grids by abstracting sparse matrices and automating parallelization.
Contribution
It introduces a modular matrix-based DSL with a compiler that generates efficient matrix-free stencil code and automatic parallelization for PDE solvers on structured grids.
Findings
Achieves up to 1.67x performance improvement over manual implementations.
Reduces code lines by approximately 6-16% in benchmark programs.
Supports a broad spectrum of PDE solver components with modular abstractions.
Abstract
Partial differential equation (PDE) solvers are extensively utilized across numerous scientific and engineering fields. However, achieving high performance and scalability often necessitates intricate and low-level programming, particularly when leveraging deterministic sparsity patterns in structured grids. In this paper, we propose an innovative domain-specific language (DSL), Mat2Stencil, with its compiler, for PDE solvers on structured grids. Mat2Stencil introduces a structured sparse matrix abstraction, facilitating modular, flexible, and easy-to-use expression of solvers across a broad spectrum, encompassing components such as Jacobi or Gauss-Seidel preconditioners, incomplete LU or Cholesky decompositions, and multigrid methods built upon them. Our DSL compiler subsequently generates matrix-free code consisting of generalized stencils through multi-stage programming. The code…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsParallel Computing and Optimization Techniques · Distributed and Parallel Computing Systems · Matrix Theory and Algorithms
