FreeTensor: a free-form DSL with holistic optimizations for irregular tensor programs
Shizhi Tang, Jidong Zhai, Haojie Wang, Lin Jiang, Liyan Zheng, Zhenhao Yuan, Chen Zhang
Abstract
Tensor programs are of critical use in many domains. Existing frameworks, such as PyTorch, TensorFlow, and JAX, adopt operator-based programming to ease programming, increase performance, and perform automatic differentiation. However, as the rapid development of tensor programs, operator-based programming shows significant limitations for irregular patterns since a large amount of redundant computation or memory access is introduced.
In this work, we propose FreeTensor, a free-form domain specific language which supports redundancy-avoid programming by introducing fine-grained control flow. With optimizations including partial evaluation, dependence-aware transformations, and fine-grained automatic differentiation, FreeTensor is able to generate high performance tensor programs on both CPU and GPU. Experiments show a speedup over existing tensor programming frameworks up to 5.10× (2.08× on average) without differentiation, and up to 127.74× (36.26× on average) after differentiation, for typical irregular tensor programs.
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 papers8
- SparseTIR: Composable Abstractions for Sparse Compilation in Deep LearningZihao Ye, Ruihang Lai, Junru Shao, Tianqi Chen et al.ASPLOS 2023 · 86 citations
- Hidet: Task-Mapping Programming Paradigm for Deep Learning Tensor ProgramsYaoyao Ding, Cody Hao Yu, Bojian Zheng, Yizhi Liu et al.ASPLOS 2023 · 27 citations
- autoGEMM: Pushing the Limits of Irregular Matrix Multiplication on Arm ArchitecturesDu Wu, Jintao Meng, Wenxi Zhu, Minwen Deng et al.SC 2024 · 14 citations
- MAGPY: Compiling Eager Mode DNN Programs by Monitoring Execution StatesChen Zhang, Rongchao Dong, Haojie Wang, Runxin Zhong et al.USENIX ATC 2024 · 5 citations
- Mat2Stencil: A Modular Matrix-Based DSL for Explicit and Implicit Matrix-Free PDE Solvers on Structured GridHuanqi Cao, Shizhi Tang, Qianchao Zhu, Bowen Yu et al.OOPSLA 2023 · 4 citations
Builds on4
- Soft Rasterizer: A Differentiable Renderer for Image-Based 3D ReasoningShichen Liu, Weikai Chen, Tianye Li, Hao LiICCV 2019 · 789 citations
- Ansor: Generating High-Performance Tensor Programs for Deep LearningLianmin Zheng, Chengfan Jia, Minmin Sun, Zhao Wu et al.OSDI 2020 · 551 citations
- Rammer: Enabling Holistic Deep Learning Compiler Optimizations with rTasksLingxiao Ma, Zhiqiang Xie, Zhi Yang, Jilong Xue et al.OSDI 2020 · 192 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
Related papers
- Uncovering Nested Data Parallelism and Data Reuse in DNN Computation with FractalTensorSiran Liu, Chengxiang Qi, Ying Cao, Chao Yang et al.SOSP 2024 · 1 citation
- Compiling Structured Tensor AlgebraMahdi Ghorbani, Mathieu Huot, Shideh Hashemian, Amir ShaikhhaOOPSLA 2023 · 10 citations
- FlexTensor: An Automatic Schedule Exploration and Optimization Framework for Tensor Computation on Heterogeneous SystemSize Zheng, Yun Liang, Shuo Wang, Renze Chen et al.ASPLOS 2020 · 171 citations
- A Holistic Functionalization Approach to Optimizing Imperative Tensor Programs in Deep LearningJinming Ma, Xiuhong Li, Zihan Wang, Xingcheng Zhang et al.DAC 2024 · 1 citation
- Einops: Clear and Reliable Tensor Manipulations with Einstein-like NotationAlex RogozhnikovICLR 2022 · 124 citations
