arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2410.05534cs.LGcs.AI
收藏

基于等价饱和与蒙特卡洛树搜索的张量计算图优化

Optimizing Tensor Computation Graphs with Equality Saturation and Monte Carlo Tree Search

University of Cambridge(剑桥大学)

Jakob Hartmann, Guoliang He, Eiko Yoneki

AI总结:

针对张量计算图优化的阶段排序问题,提出结合蒙特卡洛树搜索的等价饱和方法构建更优中间表示,并设计新型提取算法,实现最高11%的推理加速提升。

摘要:

深度神经网络在实际场景中的有效性往往取决于其延迟,因此需要能够在保持模型性能的同时减少推理时间的优化技术。一种常用方法是通过替换单个子图,将输入计算图逐步重写为等价但速度更快的图,这种方法会引发所谓的阶段排序问题,即应用一条重写规则可能会消除后续应用更优规则的可能性。近期研究表明,编译器优化领域的等价饱和技术可以缓解这一问题:它首先构建一种中间表示(IR),高效存储输入程序的多个优化版本,再在第二步中提取最优解。但在实际应用中,内存限制导致IR无法覆盖所有优化版本,从而在构建阶段重新引入了阶段排序问题。本文提出一种张量图重写方法,利用蒙特卡洛树搜索识别最具潜力的重写规则,构建更优的IR。我们还提出了一种新颖的提取算法,能够快速准确地估计以IR表示的张量程序的运行时间。与现有方法相比,我们的方法将神经网络的推理加速比最高提升了11%。

英文摘要:

The real-world effectiveness of deep neural networks often depends on their latency, thereby necessitating optimization techniques that can reduce a model's inference time while preserving its performance. One popular approach is to sequentially rewrite the input computation graph into an equivalent but faster one by replacing individual subgraphs. This approach gives rise to the so-called phase-ordering problem in which the application of one rewrite rule can eliminate the possibility to apply an even better one later on. Recent work has shown that equality saturation, a technique from compiler optimization, can mitigate this issue by first building an intermediate representation (IR) that efficiently stores multiple optimized versions of the input program before extracting the best solution in a second step. In practice, however, memory constraints prevent the IR from capturing all optimized versions and thus reintroduce the phase-ordering problem in the construction phase. In this paper, we present a tensor graph rewriting approach that uses Monte Carlo tree search to build superior IRs by identifying the most promising rewrite rules. We also introduce a novel extraction algorithm that can provide fast and accurate runtime estimates of tensor programs represented in an IR. Our approach improves the inference speedup of neural networks by up to 11% compared to existing methods.

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

↑