Compiling Recurrences over Dense and Sparse Arrays
Shiv Sundram, Muhammad Usman Tariq, Fredrik Kjolstad
Abstract
Recurrence equations lie at the heart of many computational paradigms including dynamic programming, graph analysis, and linear solvers. These equations are often expensive to compute and much work has gone into optimizing them for different situations. The set of recurrence implementations is a large design space across the set of all recurrences (e.g., the Viterbi and Floyd-Warshall algorithms), the choice of data structures (e.g., dense and sparse matrices), and the set of different loop orders. Optimized library implementations do not exist for most points in this design space, and developers must therefore often manually implement and optimize recurrences. We present a general framework for compiling recurrence equations into native code corresponding to any valid point in this general design space. In this framework, users specify a system of recurrences, the type of data structures for storing the input and outputs, and a set of scheduling primitives for optimization. A greedy algorithm then takes this specification and lowers it into a native program that respects the dependencies inherent to the recurrence equation. We describe the compiler transformations necessary to lower this high-level specification into native parallel code for either sparse and dense data structures and provide an algorithm for determining whether the recurrence system is solvable with the provided scheduling primitives. We evaluate the performance and correctness of the generated code on various computational tasks from domains including dense and sparse matrix solvers, dynamic programming, graph problems, and sparse tensor algebra. We demonstrate that generated code has competitive performance to handwritten implementations in libraries.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Cited by top-tier papers5
- REPTILE: Performant Tiling of RecurrencesMuhammad Usman Tariq, Shiv Sundram, Fredrik KjolstadOOPSLA 2025 · 1 citation
- RTeAAL Sim: Using Tensor Algebra to Represent and Accelerate RTL SimulationYan Zhu, Boru Chen, Christopher W. Fletcher, Nandeeka NayakASPLOS 2026 · 1 citation
- 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
- Bonsai: Compiling Queries to Pruned Tree TraversalsAlexander J. Root, Christophe Gyurgyik, Purvi Goel, Kayvon Fatahalian et al.PLDI 2026
- Filtr: Compiling Bioinformatics RecurrencesBala Vinaithirthan, Shiv Sundram, Sneha Goenka, Fredrik KjolstadOOPSLA 2026
Builds on3
- Compilation of sparse array programming modelsRawn Henry, Olivia Hsu, Rohan Yadav, Stephen Chou et al.OOPSLA 2021 · 26 citations
- A supernodal all-pairs shortest path algorithmPiyush Sao, Ramakrishnan Kannan, Prasun Gera, Richard W. VuducPPoPP 2020 · 19 citations
- Simplifying dependent reductions in the polyhedral modelCambridge Yang, Eric Atkinson, Michael CarbinPOPL 2021 · 5 citations
Related papers
- A sparse iteration space transformation framework for sparse tensor algebraRyan Senanayake, Changwan Hong, Ziheng Wang, Amalee Wilson et al.OOPSLA 2020 · 51 citations
- Compilation of dynamic sparse tensor algebraStephen Chou, Saman P. AmarasingheOOPSLA 2022 · 8 citations
- Compilation of Modular and General Sparse WorkspacesGenghan Zhang, Olivia Hsu, Fredrik KjolstadPLDI 2024 · 6 citations
- TensorLib: A Spatial Accelerator Generation Framework for Tensor AlgebraLiancheng Jia, Zizhang Luo, Liqiang Lu, Yun LiangDAC 2021 · 49 citations
- The Sparse Abstract MachineOlivia Hsu, Maxwell Strange, Ritvik Sharma, Jaeyeon Won et al.ASPLOS 2023 · 37 citations
