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

使用矩阵乘法的分段操作

Segmented Operations using Matrix Multiplications

Huawei Zurich Research Center(华为苏黎世研究中心)

Aleksandros Sobczyk, Giuseppe Sorrentino, Anastasios Zouzias

AI总结:

针对AI加速器中矩阵乘法单元利用不足的问题,提出MMV-RAM计算模型,并设计分段扫描与求和等算法,利用MMU实现可证明的加速,在Ascend 910B上验证了有效性。

摘要:

现代AI加速器通常包含专用计算单元,这些单元将小规模矩阵乘法作为基本操作执行。然而,除了稠密矩阵乘法之外,这些矩阵乘法单元(MMU)在许多基础深度学习操作中往往未被充分利用。巧合的是,此类架构缺乏严格的理论计算模型,这阻碍了算法设计。在本工作中,我们提出了MMV-RAM,一种计算模型,它明智地在Vector-RAM模型的基础上扩展了一个额外的MMU。我们提供了详细的理论分析,并基于电路复杂度下界(即奇偶校验不属于AC{[0]})仔细平衡了矩阵单元和向量单元之间的计算能力。基于MMV-RAM,我们着手进行算法设计,从两个基本的并行操作开始:分段扫描和分段求和。通过将它们表示为基本并行原语的组合(例如,分段求和可归约为:扫描、压缩和向量微分),我们可以利用MMU执行推测性分块计算,最终相对于仅使用向量的方法实现可证明的理论加速。这些结果扩展到其他普遍存在的AI内核,包括稠密矩阵乘积和稀疏矩阵-向量乘积。作为案例研究,我们在包含矩阵核和向量核的Ascend 910B AI加速器上实现了所提出的算法。我们在来自各种应用(包括大型语言模型)的合成和真实世界数据集上评估了这些实现。

英文摘要:

Specialized computational units that perform small matrix multiplications as primitive operations are typically present in modern AI accelerators. However, these Matrix Multiplication Units (MMUs) are often underutilized for many fundamental deep learning operations besides dense matrix multiplications. Coincidentally, the lack of a rigorous theoretical model of computation for such architectures obstructs algorithmic design. In this work, we propose MMV-RAM, a computational model which judiciously extends the Vector-RAM model with an additional MMU. We provide a detailed theoretical analysis and carefully balance the computational power between the matrix and vector units, guided by the circuit complexity lower bound that parity is not in AC{[0]}. Given MMV-RAM, we proceed to algorithm design, starting with two fundamental parallel operations: segmented scan and sum. By expressing them as compositions of elementary parallel primitives (e.g., seg. sum reduces to: scan, compress, and vector differentiation), we can exploit MMUs to perform speculative blocked computations, ultimately leading to provable theoretical speed-ups against vector-only approaches. These results extend to other ubiquitous AI kernels, including dense matrix product, and sparse matrix-vector product. As a case study, we implemented the proposed algorithms on the Ascend 910B AI accelerator, which contains matrix and vector cores. We evaluate these implementations on synthetic and real-world datasets from various applications, including Large Language Models.

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

↑