[Paper Review] Polyhedral Specification and Code Generation of Sparse Tensor Contraction with Co-Iteration
This paper presents a polyhedral framework extension for sparse tensor contraction that decouples layout and computation spaces, enabling flexible layout specification and efficient co-iteration via SMT-synthesized find algorithms. It achieves 1.63× average speedup over TACO and up to 2.72× with optimized find algorithms, supporting previously infeasible layouts like BCSR and diagonal computations.
This paper presents a code generator for sparse tensor contraction computations. It leverages a mathematical representation of loop nest computations in the sparse polyhedral framework (SPF), which extends the polyhedral model to support non-affine computations, such as arise in sparse tensors. SPF is extended to perform layout specification, optimization, and code generation of sparse tensor code: 1) we develop a polyhedral layout specification that decouples iteration spaces for layout and computation; and, 2) we develop efficient co-iteration of sparse tensors by combining polyhedra scanning over the layout of one sparse tensor with the synthesis of code to find corresponding elements in other tensors through an SMT solver. We compare the generated code with that produced by a state-of-the-art tensor compiler, TACO. We achieve on average 1.63$ imes$ faster parallel performance than TACO on sparse-sparse co-iteration and describe how to improve that to 2.72$ imes$ average speedup by switching the find algorithms. We also demonstrate that decoupling iteration spaces of layout and computation enables additional layout and computation combinations to be supported.
Motivation & Objective
- To address the limitation of existing sparse tensor compilers in supporting complex layouts like BCSR and diagonal computations due to tight coupling of computation and layout spaces.
- To enable general co-iteration of multiple sparse tensors by decoupling logical coordinate spaces from physical layout iteration spaces.
- To extend the Sparse Polyhedral Framework (SPF) with formal layout specification and co-iteration support using uninterpreted functions and SMT solvers.
- To generate optimized, architecture-aware code that supports both layout transformations and co-iteration patterns, including disjunctive merge (future work).
- To improve performance portability by enabling co-optimization of data layout and computation for diverse hardware, including SIMD and tensor cores.
Proposed method
- Decouples iteration spaces by modeling layout as a mathematical relation between physical positions and logical coordinates, enabling independent optimization of layout and computation.
- Uses uninterpreted functions to represent runtime-dependent index arrays in the polyhedral model, supporting non-affine accesses in sparse computations.
- Employs SMT solvers to synthesize find algorithms that map indices from one tensor’s layout to corresponding nonzeros in another, enabling co-iteration.
- Combines polyhedral scanning over one tensor’s layout with synthesized code to locate matching nonzeros in other tensors, avoiding explicit merge lattices.
- Supports complex layouts such as blocked formats (e.g., BCSR) and diagonal computations by avoiding the need for one-to-one mapping between layout levels and computation indices.
- Generates optimized code by composing layout mappings with computation transformations, enabling orthogonal optimization with blocking, reordering, and vectorization.
Experimental results
Research questions
- RQ1Can the polyhedral framework be extended to support formal specification of sparse tensor layouts while decoupling them from computation iteration spaces?
- RQ2How can co-iteration of multiple sparse tensors be efficiently expressed and compiled using a formal, mathematically grounded framework?
- RQ3Can SMT-synthesized find algorithms outperform hand-coded or template-based approaches in co-iteration performance?
- RQ4To what extent can layout and computation be co-optimized in a way that supports previously unsupported formats like BCSR or diagonal operations?
- RQ5How does the performance of the generated code compare to state-of-the-art tensor compilers like TACO across diverse sparse tensor workloads?
Key findings
- The proposed framework achieves 1.63× average speedup over TACO in parallel sparse-sparse co-iteration on the benchmark suite.
- By switching to optimized find algorithms, the framework achieves up to 2.72× average speedup over TACO, demonstrating the performance impact of algorithmic synthesis.
- The decoupling of layout and computation spaces enables support for previously unsupported layouts, such as block-compressed sparse row (BCSR), which TACO cannot express.
- The framework supports diagonal computations and other patterns requiring shared loop indices across multiple levels, which are infeasible in TACO’s level-format model.
- The use of SMT-synthesized find algorithms enables efficient co-iteration without requiring merge lattices or precomputed index mappings.
- The approach enables orthogonal composition of layout transformations with other optimizations, such as blocking and vectorization, for improved performance on modern architectures.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.