论文标题
Rise&Shine:面向语言的编译器设计
RISE & Shine: Language-Oriented Compiler Design
论文作者
论文摘要
软件和硬件专业化的趋势 - 在摩尔定律的终结以及对域特异性计算(例如机器学习)中仍然引起兴趣的加剧趋势,迫使我们从根本上重新考虑编译器设计。围绕单个单一适合的中间表示(IR)建立的通用编译器框架的时代已经结束。这种认识引发了MLIR编译器框架的创建,该框架使编译器工程师能够设计和集成IRS捕获特定的抽象。 MLIR为基于SSA的IRS提供了一个通用框架,但是它无助于我们决定如何设计易于开发,使用并合并到工作编译器中的IRS。 为了应对IR设计的挑战,我们主张以语言为导向的编译器设计,该设计将IRS理解为正式的编程语言,并通过随附的类型系统强制执行其正确使用。我们认为,编程语言技术直接指导可扩展的IR设计,并提供了一个正式的框架来推理有关在多个IRS之间转换的正式框架。在本文中,我们讨论了Shine编译器的设计,该编译器通过混合功能性功能性的中间语言将基于高级功能的数据并行语言上升到C,OpenCL和OpenMP。 我们将工作直接与密切相关的基于模式的升力IR和编译器进行比较。我们证明,我们的面向语言的编译器设计会产生更强大,更可预测的编译器,在各种抽象级别都可以扩展。我们的实验评估表明,这种编译器设计能够生成高性能的GPU代码。
The trend towards specialization of software and hardware - fuelled by the end of Moore's law and the still accelerating interest in domain-specific computing, such as machine learning - forces us to radically rethink our compiler designs. The era of a universal compiler framework built around a single one-size-fits-all intermediate representation (IR) is over. This realization has sparked the creation of the MLIR compiler framework that empowers compiler engineers to design and integrate IRs capturing specific abstractions. MLIR provides a generic framework for SSA-based IRs, but it doesn't help us to decide how we should design IRs that are easy to develop, to work with and to combine into working compilers. To address the challenge of IR design, we advocate for a language-oriented compiler design that understands IRs as formal programming languages and enforces their correct use via an accompanying type system. We argue that programming language techniques directly guide extensible IR designs and provide a formal framework to reason about transforming between multiple IRs. In this paper, we discuss the design of the Shine compiler that compiles the high-level functional pattern-based data-parallel language RISE via a hybrid functional-imperative intermediate language to C, OpenCL, and OpenMP. We compare our work directly with the closely related pattern-based Lift IR and compiler. We demonstrate that our language-oriented compiler design results in a more robust and predictable compiler that is extensible at various abstraction levels. Our experimental evaluation shows that this compiler design is able to generate high-performance GPU code.