A Verified Compiler for a Functional Tensor Language

被引:0
|
作者
Liu, Amanda [1 ]
Bernstein, Gilbert [2 ]
Chlipala, Adam [1 ]
Ragan-Kelley, Jonathan [1 ]
机构
[1] MIT, 77 Massachusetts Ave, Cambridge, MA 02139 USA
[2] Univ Washington, Seattle, WA 98195 USA
基金
美国国家科学基金会;
关键词
functional programming; array programming; formal verification; type systems; tensors;
D O I
10.1145/3656390
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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.
引用
收藏
页数:23
相关论文
共 50 条
  • [1] A Verified Compiler for an Impure Functional Language
    Chlipala, Adam
    [J]. ACM SIGPLAN NOTICES, 2010, 45 (01) : 93 - 106
  • [2] A Verified Compiler for an Impure Functional Language
    Chlipala, Adam
    [J]. POPL'10: PROCEEDINGS OF THE 37TH ANNUAL ACM SIGPLAN-SIGACT SYMPOSIUM ON PRINCIPLES OF PROGRAMMING LANGUAGES, 2010, : 93 - 106
  • [3] PureCake: A Verified Compiler for a Lazy Functional Language
    Kanabar, Hrutvik
    Vivien, Samuel
    Abrahamsson, Oskar
    Myreen, Magnus O.
    Norrish, Michael
    Pohjola, Johannes Aman
    Zanetti, Riccardo
    [J]. PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2023, 7 (PLDI):
  • [4] Towards a verified compiler prototype for the synchronous language SIGNAL
    Yang, Zhibin
    Bodeveix, Jean-Paul
    Filali, Mamoun
    Hu, Kai
    Zhao, Yongwang
    Ma, Dianfu
    [J]. FRONTIERS OF COMPUTER SCIENCE, 2016, 10 (01) : 37 - 53
  • [5] Towards a verified compiler prototype for the synchronous language SIGNAL
    Zhibin Yang
    Jean-Paul Bodeveix
    Mamoun Filali
    Kai Hu
    Yongwang Zhao
    Dianfu Ma
    [J]. Frontiers of Computer Science, 2016, 10 : 37 - 53
  • [6] Towards a verified compiler prototype for the synchronous language SIGNAL
    Zhibin YANG
    JeanPaul BODEVEIX
    Mamoun FILALI
    Kai HU
    Yongwang ZHAO
    Dianfu MA
    [J]. Frontiers of Computer Science, 2016, 10 (01) - 53
  • [7] Kalas: A Verified, End-To-End Compiler for a Choreographic Language
    Pohjola, Johannes Åman
    Gómez-Londoño, Alejandro
    Shaker, James
    Norrish, Michael
    [J]. Leibniz International Proceedings in Informatics, LIPIcs, 2022, 237
  • [8] Pilsner: A Compositionally Verified Compiler for a Higher-Order Imperative Language
    Neis, Georg
    Hur, Chung-Kil
    Kaiser, Jan-Oliver
    McLaughlin, Craig
    Dreyer, Derek
    Vafeiadis, Viktor
    [J]. ACM SIGPLAN NOTICES, 2015, 50 (09) : 166 - 178
  • [9] Pilsner: A Compositionally Verified Compiler for a Higher-Order Imperative Language
    Neis, Georg
    Hur, Chung-Kil
    Kaiser, Jan-Oliver
    McLaughlin, Craig
    Dreyer, Derek
    Vafeiadis, Viktor
    [J]. PROCEEDINGS OF THE 20TH ACM SIGPLAN INTERNATIONAL CONFERENCE ON FUNCTIONAL PROGRAMMING (ICFP'15), 2015, : 166 - 178
  • [10] FUNCTIONAL COMPILER TECHNIQUES FOR AN IMPERATIVE LANGUAGE
    IKEI, M
    WOLFE, M
    [J]. SIGPLAN NOTICES, 1993, 28 (01): : 83 - 83