###
计算机系统应用英文版:2026,35(8):74-88
←前一篇   |   后一篇→
本文二维码信息
码上扫一扫!
Transformer模型的算子生成与性能优化系统
(1.长沙理工大学 计算机学院, 长沙 410076;2.中国科学院 计算技术研究所, 北京 100190)
Operator Generation and Performance Optimization System for Transformer Model
(1.School of Computer Science and Technology, Changsha University of Science and Technology, Changsha 410076, China;2.Institute of Computing Technology, Chinese Academy of Sciences, Beijing 100190, China)
摘要
图/表
参考文献
相似文献
本文已被:浏览 43次   下载 44
Received:December 22, 2025    Revised:January 12, 2026
中文摘要: 近年来, 基于Transformer架构的大模型已在诸多领域得到广泛应用且实用效果优异, 但其核心算子在异构平台上的高效部署面临适配复杂、手工优化成本高等问题, 而且现有编译器在块级逻辑表达及跨平台性能迁移方面存在局限. 针对上述问题, 提出一种基于多层中间表示 (multi-level intermediate representation, MLIR)的高性能算子生成框架DeepGen. 该框架通过构建块级分层中间表示(intermediate representation, IR), 实现了对算子的计算模式、访存行为及并行结构的直接刻画. 同时, 设计了一套通用的跨平台优化Pass集合, 实现了对计算调度与数据访存的逐级优化. 此外, 通过将计算逻辑与数据搬运过程解耦, DeepGen为异构平台的高性能算子生成提供了统一的优化机制. 实验结果表明, 在NVIDIA A100/V100与海光Z100/K100平台上, DeepGen相比于cuBLAS 和rocBLAS的矩阵乘算子, 计算效率分别平均提升1.10倍和1.18倍. 相较于Triton, DeepGen提升Attention算子的计算效率最高达到3.71倍, 并进一步使LLaMA2与BERT模型的端到端推理性能平均提升1.76倍和2.01倍. 上述实验结果验证了DeepGen在Transformer模型的算子生成与优化中具备良好的跨平台性能可移植性与通用性.
Abstract:In recent years, large-scale models based on the Transformer architecture have been widely applied across various domains and have demonstrated exceptional performance. However, the efficient deployment of their core operators on heterogeneous platforms faces significant challenges, including complex adaptation requirements and high costs associated with manual optimization. Furthermore, existing compilers exhibit limitations in block-level logical expression and cross-platform performance portability. To address these issues, this study proposes DeepGen, an MLIR-based high-performance operator generation framework. By constructing a block-level hierarchical intermediate representation (IR), the proposed framework enables direct characterization of computation patterns, memory access behaviors, and parallel structures of operators. Concurrently, a suite of universal cross-platform optimization passes is designed to achieve progressive optimization of computation scheduling and data access. Moreover, by decoupling computational logic from data movement processes, DeepGen provides a unified optimization mechanism for high-performance operator generation on heterogeneous platforms. Experimental results indicate that on NVIDIA A100/V100 and Hygon Z100/K100 platforms, DeepGen improves the computational efficiency of matrix multiplication operators by an average factor of 1.10× and 1.18× compared to cuBLAS and rocBLAS, respectively. In comparison with Triton, the efficiency of the attention operator is enhanced by up to 3.71× with DeepGen. Furthermore, the end-to-end inference performance of LLaMA2 and BERT models is improved by average factors of 1.76× and 2.01×, respectively. These experimental results validate that DeepGen possesses excellent cross-platform performance portability and versatility for operator generation and optimization in Transformer models.
文章编号:     中图分类号:    文献标志码:
基金项目:全国重点实验室自研课题(E451970001)
引用文本:
宋云,谢宝康,肖俊敏,鲍培华.Transformer模型的算子生成与性能优化系统.计算机系统应用,2026,35(8):74-88
SONG Yun,XIE Bao-Kang,XIAO Jun-Min,BAO Pei-Hua.Operator Generation and Performance Optimization System for Transformer Model.COMPUTER SYSTEMS APPLICATIONS,2026,35(8):74-88