Lune

PLDI2024Top-tier venue

Compilation of Modular and General Sparse Workspaces

Genghan Zhang, Olivia Hsu, Fredrik Kjolstad

Abstract

Recent years have seen considerable work on compiling sparse tensor algebra expressions. This paper addresses a shortcoming in that work, namely how to generate efficient code (in time and space) that scatters values into a sparse result tensor. We address this shortcoming through a compiler design that generates code that uses sparse intermediate tensors (sparse workspaces) as efficient adapters between compute code that scatters and result tensors that do not support random insertion. Our compiler automatically detects sparse scattering behavior in tensor expressions and inserts necessary intermediate workspace tensors. We present an algorithm template for workspace insertion that is the backbone of our code generation algorithm. Our algorithm template is modular by design, supporting sparse workspaces that span multiple user-defined implementations. Our evaluation shows that sparse workspaces can be up to 27.12 × faster than the dense workspaces of prior work. On the other hand, dense workspaces can be up to 7.58 × faster than the sparse workspaces generated by our compiler in other situations, which motivates our compiler design that supports both. Our compiler produces sequential code that is competitive with hand-optimized linear and tensor algebra libraries on the expressions they support, but that generalizes to any other expression. Sparse workspaces are also more memory efficient than dense workspaces as they compress away zeros. This compression can asymptotically decrease memory usage, enabling tensor computations on data that would otherwise run out of memory.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

2 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • SparseTIR: Composable Abstractions for Sparse Compilation in Deep Learning cites A sparse iteration space transformation framework for sparse tensor algebra
  • FuseFlow: A Fusion-Centric Compilation Framework for Sparse Deep Learning on Streaming Dataflow cites A sparse iteration space transformation framework for sparse tensor algebra
  • FuseFlow: A Fusion-Centric Compilation Framework for Sparse Deep Learning on Streaming Dataflow cites PyTorch 2: Faster Machine Learning Through Dynamic Python Bytecode Transformation and Graph Compilation
  • FuseFlow: A Fusion-Centric Compilation Framework for Sparse Deep Learning on Streaming Dataflow cites SparseTIR: Composable Abstractions for Sparse Compilation in Deep Learning
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers2

  1. FuseFlow: A Fusion-Centric Compilation Framework for Sparse Deep Learning on Streaming DataflowRubens Lacouture, Nathan Zhang, Ritvik Sharma, Marco Siracusa et al.ASPLOS 2026 · 1 citation
  2. Morphing-based Compression for Data-centric ML PipelinesSebastian Baunsgaard, Matthias BoehmVLDB 2026

Builds on18

  1. PyTorch 2: Faster Machine Learning Through Dynamic Python Bytecode Transformation and Graph CompilationJason Ansel, Edward Z. Yang, Horace He, Natalia Gimelshein et al.ASPLOS 2024 · 693 citations
  2. SparseTIR: Composable Abstractions for Sparse Compilation in Deep LearningZihao Ye, Ruihang Lai, Junru Shao, Tianqi Chen et al.ASPLOS 2023 · 86 citations
  3. TileSpGEMM: a tiled algorithm for parallel sparse general matrix-matrix multiplication on GPUsYuyao Niu, Zhengyang Lu, Haonan Ji, Shuhui Song et al.PPoPP 2022 · 66 citations
  4. Exocompilation for productive programming of hardware acceleratorsYuka Ikarashi, Gilbert Louis Bernstein, Alex Reinking, Hasan Genc et al.PLDI 2022 · 56 citations
  5. A sparse iteration space transformation framework for sparse tensor algebraRyan Senanayake, Changwan Hong, Ziheng Wang, Amalee Wilson et al.OOPSLA 2020 · 51 citations

Related papers

  1. Compiler Support for Sparse Tensor ConvolutionsPeiming Liu, Alexander J. Root, Anlun Xu, Yinying Li et al.OOPSLA 2024 · 5 citations
  2. SpDISTAL: Compiling Distributed Sparse Tensor ComputationsRohan Yadav, Alex Aiken, Fredrik KjolstadSC 2022 · 7 citations
  3. Compilation of sparse array programming modelsRawn Henry, Olivia Hsu, Rohan Yadav, Stephen Chou et al.OOPSLA 2021 · 26 citations
  4. Compressed and Parallelized Structured Tensor AlgebraMahdi Ghorbani, Emilien Bauer, Tobias Grosser, Amir ShaikhhaOOPSLA 2025 · 1 citation
  5. Compilation of dynamic sparse tensor algebraStephen Chou, Saman P. AmarasingheOOPSLA 2022 · 8 citations
Dusk over the sea between two cliffs drawn in fine vertical lines