• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

计算机工程与科学 ›› 2024, Vol. 46 ›› Issue (07): 1151-1157.

• 高性能计算 • 上一篇    下一篇

基于MLIR的数据流模型

李金熹,尹首一,魏少军,胡杨   

  1. (清华大学集成电路学院,北京 100084)
  • 收稿日期:2023-10-16 修回日期:2023-12-01 接受日期:2024-07-25 出版日期:2024-07-25 发布日期:2024-07-18

A codelet model based on MLIR

LI Jin-xi,YIN Shou-yi,WEI Shao-jun,HU Yang   

  1. (School of Integrated Circuits,Tsinghua University,Beijing 100084,China)
  • Received:2023-10-16 Revised:2023-12-01 Accepted:2024-07-25 Online:2024-07-25 Published:2024-07-18

摘要: 在冯诺依曼架构下,指令集的使用让软硬件得以解耦并各自飞速发展。然而,近年来并行多核架构加速器的热潮为冯诺依曼架构下的顺序编程模型带来了挑战。在顺序编程模型下设计而成的指令集缺乏对并行硬件的抽象,因此仅仅使用指令集已不能完全完成软硬件的解耦。人工智能软件编译栈领域需要新的编程模型,以对接顺序执行的编程平台和并行多核的硬件后端,并进一步探索并行硬件提供的优化机会。使用数据流模型作为编程模型,为顺序执行程序和并行硬件指令集的对接过程提供通用抽象,在指令集的基础上进一步实现软件前端与硬件后端的解耦。为确保项目的可复用性,将数据流模型以codelet dialect的形式实现在谷歌提出的编译器框架MLIR上。MLIR致力于整合碎片化的编译器生态,提高前后端对接流程的可复用性,在MLIR上实现的数据流模型将进一步提升MLIR系统的可复用性。

关键词: 数据流模型, 端到端编译, MLIR

Abstract: Thanks to the instruction set architecture (ISA), the software community and the hardware community has been developing independently for years. However, with the advent of multi-core accelerators, the sequential programming model based on the Von Neumann architecture is confronted with troubles. Based on sequential execution model, ISA lacks support for parallel multi-core hardware. Thus, merely using ISA cannot decouple software and hardware. A new program execution model (PXM) is required to accomplish end-to-end compilation from neural networks to interface with sequentially executed programming platforms and parallel multi-core hardware backends, further exploring the optimization opportunities provided by parallel hardware. This paper proposes a codelet model as a new PXM, providing a general abstraction for the process of downloading sequentially executed programs onto parallel hardware. It further decouples the software frontend and hardware backend based on the instruction set. To ensure the reusability of the project, this paper implements the codelet model in the form of a codelet dialect within the MLIR compiler framework proposed by Google. MLIR aims to integrate fragmented compiler ecosystems and improve the reusability of frontend-to-backend integration processes. The codelet model implemented in MLIR in this paper can further enhance the reusability of the MLIR system.


Key words: codelet model, end-to-end compilation, MLIR