arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2412.16985cs.DC
收藏

BladeDISC++:基于符号形状的内存优化

BladeDISC++: Memory Optimizations Based On Symbolic Shape

Xiulong Yuan, Xu Yan, Wenting Shen, Xiafei Qiu, Ang Wang, Jie Zhang, Yong Li, Wei Lin

AI总结:

针对动态形状图内存优化因缺乏精确张量形状而受限的挑战,提出基于符号形状的算子调度与重计算方法及编译运行时结合策略的BladeDISC++,有效降低内存用量至接近精确形状优化水平。

摘要:

近期的深度学习工作负载表现出动态特征,促使动态形状编译器被日益广泛采用。这些编译器能够为以固定图拓扑和不确定张量形状为特征的动态形状图生成高效的内核。然而,尽管内存优化在这个大模型时代尤为关键,但针对动态形状图的内存优化仍相对缺乏探索。根本挑战在于缺乏精确的张量形状,而这在算子调度和重计算等传统方法中是必不可少的。为了应对这一挑战,我们提出了基于符号形状的算子调度和重计算方法,并开发了BladeDISC++。此外,由于在张量形状未知时无法仅在编译时做出重计算决策,BladeDISC++采用编译与运行时相结合的策略,以最佳方式应对形状动态性。评估表明,BladeDISC++有效降低了动态形状图的内存使用量,实现了与使用精确形状优化相当的内存消耗,从而推动了动态形状编译器的更广泛应用。

英文摘要:

Recent deep learning workloads exhibit dynamic characteristics, leading to the rising adoption of dynamic shape compilers. These compilers can generate efficient kernels for dynamic shape graphs characterized by a fixed graph topology and uncertain tensor shapes. However, memory optimization, although particularly crucial in this large model era, remains relatively underexplored for dynamic shape graphs. The fundamental challenge lies in the lack of precise tensor shapes which are essential in conventional methods such as operation scheduling(op scheduling) and rematerialization. To address this challenge, we propose op scheduling and rematerialization approaches based on symbolic shapes and developed BladeDISC++. Besides, since rematerialization decisions cannot be made solely at compile time when tensor shapes are unknown, BladeDISC++ employs a compilation-runtime combined strategy to optimally address shape dynamics. Evaluations indicate that BladeDISC++ effectively reduces memory usage for dynamic shape graphs, achieving memory consumption comparable to optimizations using precise shapes, thereby promoting the broader adoption of dynamic shape compilers.

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

↑