arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.14118cs.DScs.AI
收藏

面向涌现稀疏性的掩码矩阵乘法

Masked Matrix Multiplication for Emergent Sparsity

Johns Hopkins University(约翰斯·霍普金斯大学)

Brian Wheatman, Meghana Madhyastha, Randal Burns

AI总结:

本文提出一种面向涌现稀疏性的掩码矩阵乘法系统,通过动态代码查找和稀疏性映射预处理消除不必要计算与分支,在60%-95%稀疏性下相比Intel MKL实现最高2倍加速和4倍指令减少。

摘要:

人工智能工作负载,尤其是Transformer模型,表现出涌现稀疏性,其中计算对稠密数据进行选择性的稀疏访问。这些工作负载在面向稠密计算的硬件上效率低下,并且不能很好地映射到稀疏数据表示上。我们构建了一个向量化且并行的矩阵乘法系统 A X B = C,该系统基于运行时的稀疏性评估来消除不必要的计算并避免分支。我们结合使用动态代码查找来适应编码在B矩阵中的特定稀疏性,并对A矩阵和B矩阵的稀疏性映射进行预处理,以便对整个计算仅计算一次条件分支。在从60%到95%零元的广泛稀疏性范围内,与Intel MKL的稠密或稀疏矩阵乘法例程相比,我们的实现执行更少的指令并提高了性能。收益最高可达2倍加速和4倍指令减少。

英文摘要:

Artificial intelligence workloads, especially transformer models, exhibit emergent sparsity in which computations perform selective sparse access to dense data. The workloads are inefficient on hardware designed for dense computations and do not map well onto sparse data representations. We build a vectorized and parallel matrix-multiplication system A X B = C that eliminates unnecessary computations and avoids branches based on a runtime evaluation of sparsity. We use a combination of dynamic code lookup to adapt to the specific sparsity encoded in the B matrix and preprocessing of sparsity maps of the A and B matrices to compute conditional branches once for the whole computation. For a wide range of sparsity, from 60% to 95% zeros, our implementation performs fewer instructions and increases performance when compared with Intel MKL's dense or sparse matrix multiply routines. Benefits can be as large as 2 times speedup and 4 times fewer instructions.

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

↑