arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.10026cs.ARcs.AIcs.DCcs.PF
收藏

RedFuser: 一种用于AI加速器上级联缩减操作的自动运算符融合框架

RedFuser: An Automatic Operator Fusion Framework for Cascaded Reductions on AI Accelerators

Alibaba Cloud Computing(阿里云计算)

Xinsheng Tang, Yangcheng Li, Nan Wang, Zhiyi Shu, Xingyu Ling, Junna Xing, Peng Zhou, Qiang Liu

AI总结:

RedFuser通过自动识别级联缩减模式并生成优化内核,实现AI加速器上的高效运算符融合,提升执行效率。

摘要:

运算符融合作为一种关键的性能优化技术,在AI模型部署中显著提高了执行效率,并已被广泛应用于现代AI编译器中。然而,对于涉及多个循环且存在循环间数据依赖的级联缩减操作,如注意力机制中的安全softmax后接GEMM,现有编译器缺乏有效的自动融合和内核生成能力。尽管一些工作通过手工融合策略解决了特定实例,但其解决方案在通用性上有限,难以扩展到其他类似结构。鉴于此类计算模式在深度学习模型中的普遍性,仍有巨大的潜力实现通用且自动化的融合优化。在本文中,我们提出了一种形式化的理论方法来分析级联缩减,可以将它们融合为一个循环,并引入了增量计算形式。基于此方法,我们设计了RedFuser框架,该框架能够自动识别支持的级联缩减模式并生成优化的融合内核。实验显示,RedFuser成功融合了多种工作负载,实现了相对于最先进的AI编译器高达2倍到5倍的加速,并与高度优化的手写内核性能相当。代码可在https://github.com/alibaba/redfuser获取。

英文摘要:

Operator fusion, as a key performance optimization technique in the deployment of AI models, significantly improves execution efficiency and has been widely adopted in modern AI compilers. However, for cascaded reduction operations involving multiple loops with inter-loop data dependencies, such as the safe softmax followed by GEMM within attention mechanisms, existing compilers lack effective automated fusion and kernel generation capabilities. Although some works have addressed specific instances through hand-crafted fusion strategies, their solutions are limited in generality and difficult to extend to other similar structures. Given the prevalence of such computational patterns in deep learning models, there remains significant untapped potential in achieving general and automated fusion optimization. In this paper, we present a formal theoretical methodology for analyzing cascaded reductions which can fuse them into a single loop and introduce an incremental computation form. Based on this methodology, we design Reduction Fuser (RedFuser), a framework that automatically identifies supported cascaded reduction patterns and generates optimized fused kernels. Experiments show that RedFuser successfully fuses diverse workloads, achieving up to 2$\times$ to 5$\times$ speedup over state-of-the-art AI compilers and matching the performance of highly optimized hand-written kernels. The code is available at https://github.com/alibaba/redfuser

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑