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

NM-SpMM:使用GPGPU加速基于N:M稀疏性的矩阵乘法

NM-SpMM: Accelerating Matrix Multiplication Using N:M Sparsity with GPGPU

Cong Ma, Du Wu, Zhelang Deng, Jiang Chen, Xiaowen Huang, Jintao Meng, Wenxi Zhu, Bingqiang Wang, Amelie Chi Zhou, Peng Chen, Minwen Deng, Yanjie Wei, Shengzhong Feng, Yi Pan

AI总结:

针对深度学习模型部署资源消耗大及N:M稀疏矩阵乘法优化复杂的问题,提出NM-SpMM,通过分层阻塞、内存访问优化和流水线设计实现接近理论峰值的性能,比nmSPARSE快2.1倍,比cuBLAS密集GEMM快1.4至6.3倍。

摘要:

深度学习在广泛任务中展现出有效性。然而,这些模型密集且过度参数化的特性导致部署期间资源消耗显著。针对此问题,权重剪枝,特别是通过N:M稀疏性矩阵乘法,通过将密集操作转化为半稀疏操作提供了高效解决方案。N:M稀疏性为平衡性能和模型精度提供了选项,但引入了更复杂的编程和优化挑战。为解决这些问题,我们为N:M稀疏性设计了系统自顶向下的性能分析模型。同时,提出NM-SpMM作为一种高效的通用N:M稀疏性实现。基于性能分析,NM-SpMM采用分层阻塞机制作为通用优化以增强数据局部性,同时引入内存访问优化和流水线设计作为稀疏感知优化,使其在不同稀疏级别下实现接近理论峰值性能。实验结果表明,NM-SpMM比nmSPARSE(通用N:M稀疏性领域最先进技术)快2.1倍,比cuBLAS的密集GEMM操作快1.4倍至6.3倍,接近因稀疏性减少计算量带来的理论最大加速比。NM-SpMM已开源并公开于https://github.com/M-H482/NM-SpMM。

英文摘要:

Deep learning demonstrates effectiveness across a wide range of tasks. However, the dense and over-parameterized nature of these models results in significant resource consumption during deployment. In response to this issue, weight pruning, particularly through N:M sparsity matrix multiplication, offers an efficient solution by transforming dense operations into semi-sparse ones. N:M sparsity provides an option for balancing performance and model accuracy, but introduces more complex programming and optimization challenges. To address these issues, we design a systematic top-down performance analysis model for N:M sparsity. Meanwhile, NM-SpMM is proposed as an efficient general N:M sparsity implementation. Based on our performance analysis, NM-SpMM employs a hierarchical blocking mechanism as a general optimization to enhance data locality, while memory access optimization and pipeline design are introduced as sparsity-aware optimization, allowing it to achieve close-to-theoretical peak performance across different sparsity levels. Experimental results show that NM-SpMM is 2.1x faster than nmSPARSE (the state-of-the-art for general N:M sparsity) and 1.4x to 6.3x faster than cuBLAS's dense GEMM operations, closely approaching the theoretical maximum speedup resulting from the reduction in computation due to sparsity. NM-SpMM is open source and publicly available at https://github.com/M-H482/NM-SpMM.

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

↑