NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

The Sparse Abstract Machine

Olivia Hsu, Maxwell Strange, Jaeyeon Won, Ritvik Sharma, Kunle Olukotun, Joel S. Emer, Mark Horowitz, Fredrik Kjolstad

TL;DR

This paper introduces the Sparse Abstract Machine (SAM), a novel abstract machine model designed to bridge the gap between high-level sparse tensor algebra expressions and specialized hardware accelerators. SAM provides a unified, expressive, and flexible intermediate representation that enables efficient compilation and exploration of hardware designs for sparse tensor computations, a critical workload in many scientific and machine learning domains.

What Problem Does This Paper Address?

Modern computing increasingly relies on specialized hardware accelerators (like GPUs and custom ASICs) to achieve high performance and energy efficiency. However, programming these accelerators, especially for complex tasks like sparse tensor algebra, is challenging due to limited and often proprietary programming interfaces. Existing solutions often rely on fixed-function hardware or require extensive manual optimization. This paper addresses the need for a more general, programmable, and efficient way to target sparse tensor algebra computations to a wide range of dataflow accelerators, from reconfigurable architectures to fixed-function hardware. The authors highlight that while tensor index notation (like Einsum) is powerful for expressing computations, mapping these expressions efficiently to hardware, especially with optimizations like loop fusion, is difficult with traditional von Neumann architectures.

Methods

The core contribution is the Sparse Abstract Machine (SAM), an abstract machine model that represents sparse tensor algebra computations as spatial dataflow graphs. SAM is built upon a set of cleanly defined dataflow primitives that can be composed to represent any sparse tensor algebra expression. Key aspects of SAM include:

  • Dataflow Primitives: A small set of composable blocks (e.g., Level Scanners, Intersecters, Unioners, Repeaters, ALUs, Reducers, Level Writers) that handle tensor traversal, merging, computation, and construction.
  • Streaming Abstraction: Tensors are represented as streams of tokens (coordinates, values, references, control signals like "stop" and "done") that flow through the dataflow graph.
  • Hierarchical Representation: Tensors are modeled as "fibertrees," a trie-like structure where each level represents a tensor dimension. This allows for efficient, level-by-level processing.
  • Intermediate Representation: SAM serves as an intermediate representation (IR) for compilers, decoupling the high-level tensor expression from the specific hardware implementation.
  • Compiler (Custard): The paper introduces Custard, a compiler that translates high-level tensor index notation into SAM dataflow graphs. Custard handles tensor iteration, merging, computation, and construction phases.

Datasets

The paper evaluates SAM using a variety of sparse tensor algebra expressions and datasets.

  • SuiteSparse Matrix Collection: Used for analyzing the overhead of the stream representation in matrix identity expressions.
  • FROSTT Tensor Dataset: Used for evaluating SAM's expressiveness and correctness.
  • Synthetically Generated Matrices/Tensors: Used for exploring performance trade-offs, particularly in Section 6.3 for vector-vector multiplication with varying sparsity and structure.
  • Facebook Tensor: Used for functional correctness testing.

No new benchmarks were introduced; rather, existing datasets were leveraged to demonstrate SAM's capabilities.

Key Insights and Ideas

  • Unified Abstraction: SAM provides a single, powerful abstraction that can represent a wide range of sparse tensor algebra operations, from simple SpMV to complex tensor contractions, and can target diverse hardware architectures.
  • Expressiveness of Dataflow: The paper demonstrates that a relatively small set of dataflow primitives is sufficient to capture the complexity of sparse tensor algebra, including crucial optimizations like fusion and arbitrary iteration orders.
  • Importance of Fusion: The authors strongly emphasize that fused computations are significantly more efficient than unfused ones for sparse tensor algebra, and SAM's dataflow model naturally supports this.
  • Trade-offs in Dataflow Ordering: Different index-variable orderings for tensor operations lead to vastly different performance characteristics, highlighting the need for flexible hardware that can support multiple orders.
  • Control Overhead is Manageable: The paper shows that the control tokens used in SAM's streaming model introduce only a modest overhead, making it a viable approach for hardware implementation.

Key Results

  • Generality: SAM was shown to be expressive enough to represent a wide range of sparse tensor algebra algorithms, including those used in the TACO compiler, with most SAM primitives being essential for full generality.
  • Performance:
    • Dataflow Ordering: For SpM*SpM, the inner-product order performed worst, while linear combination and outer product orders were orders of magnitude better, demonstrating the impact of dataflow.
  • Fusion: For SDDMM, fused implementations were significantly faster than unfused ones, especially for sparse inputs.
  • Optimization Techniques: Techniques like coordinate skipping and bitvectors showed performance benefits, with hierarchical bitvectors (bit-trees) being crucial for robust performance.
  • Hardware Modeling: SAM was used to accurately model the performance of existing hardware accelerators like ExTensor, validating its ability to represent and analyze hardware designs.
  • Compiler Utility: The Custard compiler successfully translated high-level tensor expressions into SAM dataflow graphs, demonstrating SAM's viability as a compilation target.

Limitations and Future Work

  • Hardware Binding: While SAM can represent dataflow hardware, automatic binding to specific prior-work hardware backends (like SPU, ExTensor, Capstan) is left as future work.
  • Time Multiplexing: The paper notes that idle primitives in the stream processing could be utilized more effectively through time multiplexing, which is suggested as future work.
  • Finite Memory Constraints: While SAM can model finite hardware, the paper focuses on modeling existing architectures and their performance characteristics. Further exploration of designing novel hardware within the SAM framework is implied.
  • Manual Derivation: Some parts of the evaluation, specifically the "Sparse Tensor Algebra Features" in Table 1 and Figure 16, were manually derived and not generated by the compiler, indicating a potential area for automation.

Summary updated

BibTeX
@inproceedings{hsu2022sparse,
  author = {Olivia Hsu and Maxwell Strange and Jaeyeon Won and Ritvik Sharma and Kunle Olukotun and Joel S. Emer and Mark Horowitz and Fredrik Kjolstad},
  title = {{The Sparse Abstract Machine}},
  booktitle = {ASPLOS},
  year = {2022},
}
Figure