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

基于自适应负载平衡和降维的高效稀疏矩阵核

Efficient Sparse Matrix Kernels based on Adaptive Workload-Balancing and Parallel-Reduction

Guyue Huang, Guohao Dai, Yu Wang, Yufei Ding, Yuan Xie

摘要:

稀疏矩阵-向量和矩阵-矩阵乘法(SpMV和SpMM)在传统(图分析,科学计算)和新兴(稀疏DNN,GNN)领域都是基础。工作负载平衡和并行减少是高效SpMV的广泛使用的设计原则。然而,以前的工作未能解决如何实现和自适应地使用这两个原则的SpMV/MM。为了克服这一障碍,我们首先完成了实现空间的优化,填补了以前的工作中缺失的三个部分,包括:(1)我们表明,工作负载平衡和并行减少可以通过一个片段减少算法实现SIMD洗牌原语相结合。(2)我们表明,并行减少可以实现在SpMM通过加载稠密矩阵行与向量记忆操作。(3)我们表明,稀疏行的向量化加载,并行减少的好处的一部分,可以共存的顺序减少SpMM通过临时缓存稀疏矩阵元素在共享内存中。在自适应使用方面,我们分析了两个原则的好处如何从输入数据空间的两个特性:不同的稀疏模式和密集矩阵宽度的变化。我们发现这两个原则的好处随着总工作量的增加而消失,即增加密集矩阵宽度。我们还确定,SpMV和SpMM,不同的稀疏矩阵功能,影响工作负载平衡的有效性。我们的设计在不同的GPU和密集矩阵宽度上始终超过cuSPARSE 1.07 - 1.57倍,与最佳选择相比,内核选择规则涉及5 - 12%的性能损失。我们的内核正在被集成到流行的图学习框架中,以加速GNN训练。

英文摘要:

Sparse matrix-vector and matrix-matrix multiplication (SpMV and SpMM) are fundamental in both conventional (graph analytics, scientific computing) and emerging (sparse DNN, GNN) domains. Workload-balancing and parallel-reduction are widely-used design principles for efficient SpMV. However, prior work fails to resolve how to implement and adaptively use the two principles for SpMV/MM. To overcome this obstacle, we first complete the implementation space with optimizations by filling three missing pieces in prior work, including: (1) We show that workload-balancing and parallel-reduction can be combined through a segment-reduction algorithm implemented with SIMD-shuffle primitives. (2) We show that parallel-reduction can be implemented in SpMM through loading the dense-matrix rows with vector memory operations. (3) We show that vectorized loading of sparse rows, being a part of the benefit of parallel-reduction, can co-exist with sequential-reduction in SpMM through temporally caching sparse-matrix elements in the shared memory. In terms of adaptive use, we analyze how the benefit of two principles change with two characteristics from the input data space: the diverse sparsity pattern and dense-matrix width. We find the benefit of the two principles fades along with the increased total workload, i.e. the increased dense-matrix width. We also identify, for SpMV and SpMM, different sparse-matrix features that impact workload-balancing effectiveness. Our design consistently exceeds cuSPARSE by 1.07-1.57x on different GPUs and dense matrix width, and the kernel selection rules involve 5-12% performance loss compared with optimal choices. Our kernel is being integrated into popular graph learning frameworks to accelerate GNN training.

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

↑