Traditionally, compiler researchers either conduct experiments within an existing production compiler or develop their own prototype compiler; both options come with trade-offs. On one hand, prototyping in a production compiler can be cumbersome, as they are often optimized for program compilation speed at the expense of software simplicity and development speed. On the other hand, the transition from a prototype compiler to production requires significant engineering work. To bridge this gap, we introduce the concept of sidekick compiler frameworks, an approach that uses multiple frameworks that interoperate with each other by leveraging textual interchange formats and declarative descriptions of abstractions. Each such compiler framework is specialized for specific use cases, such as performance or prototyping. Abstractions are by design shared across frameworks, simplifying the transition from prototyping to production. We demonstrate this idea with xDSL, a sidekick for MLIR focused on prototyping and teaching. xDSL interoperates with MLIR through a shared textual IR and the exchange of IRs through an IR Definition Language. The benefits of sidekick compiler frameworks are evaluated by showing on three use cases how xDSL impacts their development: teaching, DSL compilation, and rewrite system prototyping. We also investigate the trade-offs that xDSL offers, and demonstrate how we simplify the transition between frameworks using the IRDL dialect. With sidekick compilation, we envision a future in which engineers minimize the cost of development by choosing a framework built for their immediate needs, and later transitioning to production with minimal overhead.
翻译:传统上,编译器研究者要么在现有生产编译器中开展实验,要么开发自己的原型编译器;这两种方案均存在权衡。一方面,在生产编译器中进行原型设计可能较为繁琐,因为这类编译器通常以牺牲软件简洁性和开发速度为代价来优化程序编译速度。另一方面,从原型编译器过渡到生产环境需要大量的工程工作。为弥合这一鸿沟,我们提出了辅助编译器框架的概念,该方法通过利用文本交换格式和抽象声明的描述,使多个能够相互操作的框架协同工作。每个此类编译器框架都针对特定用例(如性能优化或原型设计)进行了专门化设计。各框架间通过设计共享抽象层,从而简化从原型开发到生产环境的过渡。我们通过xDSL展示了这一理念——这是一个专注于原型设计与教学、作为MLIR辅助工具的框架。xDSL通过共享文本化中间表示以及基于IR定义语言的IR交换机制,实现与MLIR的互操作。我们通过三个用例展示了xDSL如何影响其开发过程,以此评估辅助编译器框架的优势:教学领域、领域特定语言编译以及重写系统原型设计。同时,我们探讨了xDSL带来的权衡,并演示了如何利用IRDL方言简化框架间的迁移过程。借助辅助编译技术,我们展望这样一个未来:工程师可以选择为即时需求构建的框架以最小化开发成本,随后以最低开销过渡到生产环境。