Lune

PLDI2023Top-tier venue

Mosaic: An Interoperable Compiler for Tensor Algebra

Manya Bansal, Olivia Hsu, Kunle Olukotun, Fredrik Kjolstad

Abstract

We introduce Mosaic, a sparse tensor algebra compiler that can bind tensor expressions to external functions of other tensor algebra libraries and compilers. Users can extend Mosaic by adding new functions and bind a sub-expression to a function using a scheduling API. Mosaic substitutes the bound sub-expressions with calls to the external functions and automatically generates the remaining code using a default code generator. As the generated code is fused by default, users can productively leverage both fusion and calls to specialized functions within the same compiler. We demonstrate the benefits of our dual approach by showing that calling hand-written CPU and specialized hardware functions can provide speedups of up to 206× against fused code in some cases, while generating fused code can provide speedups of up to 3.57× against code that calls external functions in other cases. Mosaic also offers a search system that can automatically map an expression to a set of registered external functions. Both the explicit binding and automatic search are verified by Mosaic. Additionally, the interface for adding new external functions is simple and general. Currently, 38 external functions have been added to Mosaic, with each addition averaging 20 lines of code.

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.

12 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

  • MatRaptor: A Sparse-Sparse Matrix Multiplication Accelerator Based on Row-Wise Product cites Tensaurus: A Versatile Accelerator for Mixed Sparse-Dense Tensor Computations
  • Gamma: leveraging Gustavson's algorithm to accelerate sparse matrix multiplication cites SIGMA: A Sparse and Irregular GEMM Accelerator with Flexible Interconnects for DNN Training
  • TeAAL: A Declarative Framework for Modeling Sparse Tensor Accelerators cites MatRaptor: A Sparse-Sparse Matrix Multiplication Accelerator Based on Row-Wise Product
  • TeAAL: A Declarative Framework for Modeling Sparse Tensor Accelerators cites Tensaurus: A Versatile Accelerator for Mixed Sparse-Dense Tensor Computations
  • TeAAL: A Declarative Framework for Modeling Sparse Tensor Accelerators cites Gamma: leveraging Gustavson's algorithm to accelerate sparse matrix multiplication
  • TeAAL: A Declarative Framework for Modeling Sparse Tensor Accelerators cites SIGMA: A Sparse and Irregular GEMM Accelerator with Flexible Interconnects for DNN Training
  • Relax: Composable Abstractions for End-to-End Dynamic Machine Learning cites SparseTIR: Composable Abstractions for Sparse Compilation in Deep Learning
  • Compilation of Modular and General Sparse Workspaces 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 papers12

  1. TeAAL: A Declarative Framework for Modeling Sparse Tensor AcceleratorsNandeeka Nayak, Toluwanimi O. Odemuyiwa, Shubham Ugare, Christopher W. Fletcher et al.MICRO 2023 · 19 citations
  2. Relax: Composable Abstractions for End-to-End Dynamic Machine LearningRuihang Lai, Junru Shao, Siyuan Feng, Steven Lyubomirsky et al.ASPLOS 2025 · 15 citations
  3. Legate Sparse: Distributed Sparse Computing in PythonRohan Yadav, Wonchan Lee, Melih Elibol, Manolis Papadakis et al.SC 2023 · 8 citations
  4. QiMeng-Xpiler: Transcompiling Tensor Programs for Deep Learning Systems with a Neural-Symbolic ApproachShouyang Dong, Jun Bi, Di Huang, Jiaming Guo et al.OSDI 2025 · 6 citations
  5. Compilation of Modular and General Sparse WorkspacesGenghan Zhang, Olivia Hsu, Fredrik KjolstadPLDI 2024 · 6 citations

Builds on14

  1. SIGMA: A Sparse and Irregular GEMM Accelerator with Flexible Interconnects for DNN TrainingEric Qin, Ananda Samajdar, Hyoukjun Kwon, Vineet Nadella et al.HPCA 2020 · 490 citations
  2. MatRaptor: A Sparse-Sparse Matrix Multiplication Accelerator Based on Row-Wise ProductNitish Kumar Srivastava, Hanchen Jin, Jie Liu, David H. Albonesi et al.MICRO 2020 · 223 citations
  3. Gamma: leveraging Gustavson's algorithm to accelerate sparse matrix multiplicationGuowei Zhang, Nithya Attaluri, Joel S. Emer, Daniel SánchezASPLOS 2021 · 158 citations
  4. Tensaurus: A Versatile Accelerator for Mixed Sparse-Dense Tensor ComputationsNitish Kumar Srivastava, Hanchen Jin, Shaden Smith, Hongbo Rong et al.HPCA 2020 · 121 citations
  5. SparseTIR: Composable Abstractions for Sparse Compilation in Deep LearningZihao Ye, Ruihang Lai, Junru Shao, Tianqi Chen et al.ASPLOS 2023 · 86 citations

Related papers

  1. A sparse iteration space transformation framework for sparse tensor algebraRyan Senanayake, Changwan Hong, Ziheng Wang, Amalee Wilson et al.OOPSLA 2020 · 51 citations
  2. SpDISTAL: Compiling Distributed Sparse Tensor ComputationsRohan Yadav, Alex Aiken, Fredrik KjolstadSC 2022 · 7 citations
  3. Compiler Support for Sparse Tensor ConvolutionsPeiming Liu, Alexander J. Root, Anlun Xu, Yinying Li et al.OOPSLA 2024 · 5 citations
  4. SparseAuto: An Auto-scheduler for Sparse Tensor Computations using Recursive Loop Nest RestructuringAdhitha Dias, Logan Anderson, Kirshanthan Sundararajah, Artem Pelenitsyn et al.OOPSLA 2024 · 6 citations
  5. UniSparse: An Intermediate Language for General Sparse Format CustomizationJie Liu, Zhongyuan Zhao, Zijian Ding, Benjamin Brock et al.OOPSLA 2024 · 7 citations
Dusk over the sea between two cliffs drawn in fine vertical lines