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.
翻译:软件和硬件的专业化趋势 — — 由摩尔法律的终结和对机器学习等特定领域计算的兴趣仍在加速增长 — — 迫使我们从根本上重新思考我们的编译者设计。 围绕单一一刀切的中间代号(IR)构建的通用编译者框架时代已经结束。 这一实现已经引发了MLIR编译员框架的创建,使编译员工程师能够设计和整合特定抽象内容。 MLIR为基于SS的IRs提供了一个通用框架,但是它无助于我们决定我们应如何设计易于开发、能够与编译者合作和合并的工作编译者设计。 为了应对IR设计的挑战,我们主张以语言为导向的通用编译者设计设计者,将IRs理解为正式的编译语言,并通过相应的类型系统将其正确使用。 我们说,编程语言技术直接指导基于扩展的IRs设计,并为多个IRs之间的转换提供一个正式框架。 在本文中,我们讨论如何设计一个Shierr编辑器的设计,将高清晰的、高清晰的节流化语言编译员水平与高端功能编译的G- CRPR- 相关编译。 我们的编译的节调的节调的文档,以清晰的节略的节流的节略的节略的节调的节调的节录的节录的节录的节录为我们的节录。