Graph IRs for Impure Higher-Order Languages

被引:0
作者
Bracevac, Oliver [1 ,2 ]
Wei, Guannan [1 ]
Jia, Songlin [1 ]
Abeysinghe, Supun [1 ]
Jiang, Yuxuan [1 ]
Bao, Yuyan [3 ]
Rompf, Tiark [1 ]
机构
[1] Purdue Univ, W Lafayette, IN 47907 USA
[2] Galois Inc, Portland, OR 97204 USA
[3] Augusta Univ, Augusta, GA USA
来源
PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL | 2023年 / 7卷 / OOPSLA期
关键词
intermediate representations; higher-order languages; effects; compilers; CODE MOTION; PROGRAMS; INFERENCE;
D O I
10.1145/3622813
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Graph-based intermediate representations (IRs) are widely used for powerful compiler optimizations, either interprocedurally in pure functional languages, or intraprocedurally in imperative languages. Yet so far, no suitable graph IR exists for aggressive global optimizations in languages with both effects and higher-order functions: aliasing and indirect control transfers make it difficult to maintain sufficiently granular dependency information for optimizations to be effective. To close this long-standing gap, we propose a novel typed graph IR combining a notion of reachability types to track aliasing with an expressive effect systemto compute precise and granular effect dependencies, while supporting local reasoning and separate compilation. Our high-level graph IR imposes lexical structure to represent structured control flow and nesting, enabling aggressive and yet inexpensive code motion, instruction selection, and other optimizations for impure higher-order programs. We formalize the new graph IR based on a lambda-calculus with a reachability type-and-effect system along with a specification of various optimizations. We present performance case studies for CUDA tensor kernel fusion, symbolic execution of LLVM IR, and SQL query compilation in the Scala LMS compiler framework using the new graph IR. We observe significant speedups of up to 21x.
引用
收藏
页数:31
相关论文
共 88 条
[1]  
Bao YY, 2023, Arxiv, DOI arXiv:2309.05885
[2]  
Bao Yuyan, 2021, P ACM PROGR LANG OOP, V5, P1
[3]  
Barany G, 2013, LECT NOTES COMPUT SC, V7791, P21, DOI 10.1007/978-3-642-37051-9_2
[4]  
BARENDREGT HP, 1987, LECT NOTES COMPUT SC, V259, P141
[5]  
Benton N, 2006, LECT NOTES COMPUT SC, V4279, P114
[6]   Relational Semantics for Effect-Based Program Transformations: Higher-Order Store [J].
Benton, Nick ;
Kennedy, Andrew ;
Beringer, Lennart ;
Hofmann, Martin .
PPDP'09: PROCEEDINGS OF THE 11TH INTERNATIONAL ACM SIGPLAN SYMPOSIUM ON PRINCIPLES AND PRACTICE OF DECLARATIVE PROGRAMMING, 2009, :301-311
[7]  
Bracevac Oliver, 2023, Technical Report
[8]  
Clarke Dave, 2013, Aliasing in Object-Oriented Programming. Types, Analysis and Verification: LNCS 7850, P15, DOI 10.1007/978-3-642-36946-9_3
[9]  
CLICK C, 1995, SIGPLAN NOTICES, V30, P246, DOI 10.1145/223428.207154
[10]  
CLICK C, 1995, SIGPLAN NOTICES, V30, P35, DOI 10.1145/202530.202534