TensorRight: Automated Verification of Tensor Graph Rewrites
Jai Arora, Sirui Lu, Devansh Jain, Tianfan Xu, Farzin Houshmand, Phitchaya Mangpo Phothilimthana, Mohsen Lesani, Praveen Narayanan, Karthik Srinivasa Murthy, Rastislav Bodík, Amit Sabne, Charith Mendis
Abstract
Tensor compilers, essential for generating efficient code for deep learning models across various applications, employ tensor graph rewrites as one of the key optimizations. These rewrites optimize tensor computational graphs with the expectation of preserving semantics for tensors of arbitrary rank and size. Despite this expectation, to the best of our knowledge, there does not exist a fully automated verification system to prove the soundness of these rewrites for tensors of arbitrary rank and size. Previous works, while successful in verifying rewrites with tensors of concrete rank, do not provide guarantees in the unbounded setting. To fill this gap, we introduce T ensor R ight , the first automatic verification system that can verify tensor graph rewrites for input tensors of arbitrary rank and size. We introduce a core language, T ensor R ight DSL, to represent rewrite rules using a novel axis definition, called aggregated-axis , which allows us to reason about an unbounded number of axes. We achieve unbounded verification by proving that there exists a bound on tensor ranks, under which bounded verification of all instances implies the correctness of the rewrite rule in the unbounded setting. We derive an algorithm to compute this rank using the denotational semantics of T ensor R ight DSL. T ensor R ight employs this algorithm to generate a finite number of bounded-verification proof obligations, which are then dispatched to an SMT solver using symbolic execution to automatically verify the correctness of the rewrite rules. We evaluate T ensor R ight ’s verification capabilities by implementing rewrite rules present in XLA ’s algebraic simplifier. The results demonstrate that T ensor R ight can prove the correctness of 115 out of 175 rules in their full generality, while the closest automatic, bounded -verification system can express only 18 of these rules.
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.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext e0be7767-45c7-46a8-94c7-0352d73c1462Cited by top-tier papers5
- Verifying Array Properties in Pure Data-Parallel ProgramsNikolaj Hey Hinnerskov, Robert Schenck, Cosmin E. OanceaPLDI 2026 · 1 citation
- Equivalence Checking of ML GPU KernelsBenjamin Driscoll, Kshitij Dubey, Anjiang Wei, Neeraj Kayal et al.OOPSLA 2026 · 1 citation
- TrainVerify: Equivalence-Based Verification for Distributed LLM TrainingYunchi Lu, Youshan Miao, Cheng Tan, Peng Huang et al.SOSP 2025 · 1 citation
- It Takes Two to EntangleZhanghan Wang, Ding Ding, Hang Zhu, Haibin Lin et al.ASPLOS 2026
- Automatically Generating ML Compiler Backends from Tensor Accelerator ISA DescriptionsDevansh Jain, Akash Pardeshi, Marco Frigo, Kaustubh Khulbe et al.OOPSLA 2026
Builds on10
- 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
- PET: Optimizing Tensor Programs with Partially Equivalent Transformations and Automated CorrectionsHaojie Wang, Jidong Zhai, Mingyu Gao, Zixuan Ma et al.OSDI 2021 · 77 citations
- Verified tensor-program optimization via high-level scheduling rewritesAmanda Liu, Gilbert Louis Bernstein, Adam Chlipala, Jonathan Ragan-KelleyPOPL 2022 · 25 citations
- Verifying and improving Halide's term rewriting system with program synthesisJulie L. Newcomb, Andrew Adams, Steven Johnson, Rastislav Bodík et al.OOPSLA 2020 · 21 citations
- Language-parametric compiler validation with application to LLVMTheodoros Kasampalis, Daejun Park, Zhengyao Lin, Vikram S. Adve et al.ASPLOS 2021 · 18 citations
Related papers
- A Mechanized Algebra of Verified Data Structures for Optimizing Sparse Tensor ProgramsAmanda Liu, Gilbert Louis Bernstein, Shoaib Kamil, Adam Chlipala et al.PLDI 2026
- A Verified Compiler for a Functional Tensor LanguageAmanda Liu, Gilbert Bernstein, Adam Chlipala, Jonathan Ragan-KelleyPLDI 2024 · 2 citations
- 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
- TensorIR: An Abstraction for Automatic Tensorized Program OptimizationSiyuan Feng, Bohan Hou, Hongyi Jin, Wuwei Lin et al.ASPLOS 2023 · 80 citations
- Tempo: Compiled Dynamic Deep Learning with Symbolic Dependence GraphsPedro F. Silvestre, Peter R. PietzuchSOSP 2025
