Fast Template-Based Code Generation for MLIR

Florian Drescher, Alexis Engelke
{"title":"Fast Template-Based Code Generation for MLIR","authors":"Florian Drescher, Alexis Engelke","doi":"10.1145/3640537.3641567","DOIUrl":null,"url":null,"abstract":"Fast compilation is essential for JIT-compilation use cases like dynamic languages or databases as well as development productivity when compiling static languages. Template-based compilation allows fast compilation times, but in existing approaches, templates are generally handwritten, limiting flexibility and causing substantial engineering effort. In this paper, we introduce an approach based on MLIR that derives code templates for the instructions of any dialect automatically ahead-of-time. Template generation re-uses the existing compilation path present in the MLIR lowering of the instructions and thereby inherently supports code generation from different abstraction levels in a single step. Our results on compiling database queries and standard C programs show a compile-time improvement of 10–30x compared to LLVM -O0 with only moderate run-time slow-downs of 1–3x, resulting in an overall improvement of 2x in a JIT-compilation-based database setting.","PeriodicalId":147184,"journal":{"name":"International Conference on Compiler Construction","volume":"202 ","pages":"1-12"},"PeriodicalIF":0.0000,"publicationDate":"2024-02-17","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"International Conference on Compiler Construction","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3640537.3641567","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

Fast compilation is essential for JIT-compilation use cases like dynamic languages or databases as well as development productivity when compiling static languages. Template-based compilation allows fast compilation times, but in existing approaches, templates are generally handwritten, limiting flexibility and causing substantial engineering effort. In this paper, we introduce an approach based on MLIR that derives code templates for the instructions of any dialect automatically ahead-of-time. Template generation re-uses the existing compilation path present in the MLIR lowering of the instructions and thereby inherently supports code generation from different abstraction levels in a single step. Our results on compiling database queries and standard C programs show a compile-time improvement of 10–30x compared to LLVM -O0 with only moderate run-time slow-downs of 1–3x, resulting in an overall improvement of 2x in a JIT-compilation-based database setting.
基于模板的多通道红外快速代码生成
快速编译对于动态语言或数据库等 JIT 编译用例以及编译静态语言时的开发效率至关重要。基于模板的编译可以实现快速编译,但在现有方法中,模板一般都是手写的,这限制了灵活性,并导致大量的工程工作。在本文中,我们介绍了一种基于 MLIR 的方法,该方法可为任何方言的指令提前自动生成代码模板。模板生成重新利用了指令的 MLIR 降低中存在的现有编译路径,从而在一个步骤中从本质上支持了不同抽象层的代码生成。我们对数据库查询和标准 C 程序的编译结果表明,与 LLVM -O0 相比,编译时间提高了 10-30 倍,而运行时间仅降低了 1-3 倍,在基于 JIT 编译的数据库环境中,总体提高了 2 倍。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信