arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2505.01637cs.PLcs.LG
收藏

Morello:利用动态规划与空间压缩编译快速神经网络

Morello: Compiling Fast Neural Networks with Dynamic Programming and Spatial Compression

University of Washington(华盛顿大学)

Samuel J. Kaufman, René Just, Rastislav Bodik

AI总结:

Morello 编译器利用动态规划与空间压缩技术,将大型程序规范分解为较小规范并组合出使仿射成本模型最小化的程序,从而在更大搜索空间中高效生成高吞吐量神经网络代码。

摘要:

高吞吐量神经网络推理需要协调众多优化决策,包括并行分块、微内核选择和数据布局。这些决策的乘积构成了一个程序搜索空间,其规模通常大到难以处理。现有方法(例如自动调度器)通常通过启发式地采样该空间来解决这一问题。相比之下,我们引入了一种基于动态规划的方法,通过迭代地将大型程序规范分解为可从一组重写规则到达的较小规范,然后从每个重写中组合出使仿射成本模型最小化的最终程序,从而探索更大的搜索空间。为了减少内存需求,我们采用了一种新颖的记忆化表表示,该表示以 $Z_{\geq 0}$ 中的坐标对规范进行索引,并压缩相同且相邻的解。这种方法能够访问比先前工作大得多的程序集合。为了评估该方法,我们开发了 Morello,这是一个将大致相当于几节点 XLA 计算图的规范降低到 x86 的编译器。值得注意的是,我们发现仿射成本模型足以浮现出高吞吐量程序。例如,Morello 合成了一组针对 Zen 1 CPU 的矩阵乘法基准测试,包括一个 1x2048x16384、bfloat16 到 float32 的向量-矩阵乘法,该乘法已被集成到 Google 的 gemma.cpp 中。

英文摘要:

High-throughput neural network inference requires coordinating many optimization decisions, including parallel tiling, microkernel selection, and data layout. The product of these decisions forms a search space of programs which is typically intractably large. Existing approaches (e.g., auto-schedulers) often address this problem by sampling this space heuristically. In contrast, we introduce a dynamic-programming-based approach to explore more of the search space by iteratively decomposing large program specifications into smaller specifications reachable from a set of rewrites, then composing a final program from each rewrite that minimizes an affine cost model. To reduce memory requirements, we employ a novel memoization table representation, which indexes specifications by coordinates in $Z_{\geq 0}$ and compresses identical, adjacent solutions. This approach can visit a much larger set of programs than prior work. To evaluate the approach, we developed Morello, a compiler which lowers specifications roughly equivalent to a few-node XLA computation graph to x86. Notably, we found that an affine cost model is sufficient to surface high-throughput programs. For example, Morello synthesized a collection of matrix multiplication benchmarks targeting a Zen 1 CPU, including a 1x2048x16384, bfloat16-to-float32 vector-matrix multiply, which was integrated into Google's gemma.cpp.

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

↑