A Verified Compiler for a Functional Tensor Language
Name
3656390.pdf
Size
302.72 KB
Format
Adobe PDF
Checksum (MD5)
ca5523526aaa88521c3d15976018e85b
Author(s) • • •
Liu, Amanda
Bernstein, Gilbert
Chlipala, Adam
Ragan-Kelley, Jonathan
Date Issued
June 20, 2024
Journal
Proceedings of the ACM on Programming Languages
Publisher
Association for Computing Machinery
Citation
Liu, Amanda, Bernstein, Gilbert, Chlipala, Adam and Ragan-Kelley, Jonathan. 2024. "A Verified Compiler for a Functional Tensor Language." Proceedings of the ACM on Programming Languages, 8 (PLDI).
Version
Final published version
Abstract
Producing efficient array code is crucial in high-performance domains like image processing and machine learning. It requires the ability to control factors like compute intensity and locality by reordering computations into different stages and granularities with respect to where they are stored. However, traditional pure, functional tensor languages struggle to do so. In a previous publication, we introduced ATL as a pure, functional tensor language capable of systematically decoupling compute and storage order via a set of high-level combinators known as reshape operators. Reshape operators are a unique functional-programming construct since they manipulate storage location in the generated code by modifying the indices that appear on the left-hand sides of storage expressions. We present a formal correctness proof for an implementation of the compilation algorithm, marking the first verification of a lowering algorithm targeting imperative loop nests from a source functional language that enables separate control of compute and storage ordering. One of the core difficulties of this proof required properly formulating the complex invariants to ensure that these storage-index remappings were well-formed. Notably, this exercise revealed a soundness bug in the original published compilation algorithm regarding the truncation reshape operators. Our fix is a new type system that captures safety conditions that were previously implicit and enables us to prove compiler correctness for well-typed source programs. We evaluate this type system and compiler implementation on a range of common programs and optimizations, including but not limited to those previously studied to demonstrate performance comparable to established compilers like Halide.
MIT Department
Massachusetts Institute of Technology. Department of Electrical Engineering and Computer Science
Terms of Use
Creative Commons Attribution
Persistent DSpace Link
DOI of Published Version
https://doi.org/10.1145/3656390