使用 RISC-V 向量指令优化 SpGEMM
Optimization of SpGEMM with Risc-V vector instructions
AI总结:
针对 RISC-V 长向量架构上极稀疏 SpGEMM 利用率不足的问题,提出 SPARS、HASH 及动态混合算法 H-SPA(t)/H-HASH(t),在 SuiteSparse 矩阵上显著优于 SPA。
摘要:
稀疏通用矩阵-矩阵乘法(Sparse GEneral Matrix-Matrix multiplication,SpGEMM)$C = A \ imes B$ 是机器学习或图分析等领域广泛使用的基础例程。尽管它十分重要,但在向量架构上高效执行 SpGEMM 仍是一个相对未被充分研究的课题。在这些架构上运行 SpGEMM 的最新算法基于稀疏累加器(SParse Accumulator,SPA)方法;由于它逐列计算 C,因此对于每列具有数万个非零系数的稀疏矩阵相对高效。然而,当处理每列仅含少量非零系数的矩阵时,这一最先进算法在计算 SpGEMM 内核时无法充分利用长向量架构。为克服该问题,我们提出了 SPA paRallel with Sorting(SPARS)算法,它并行计算多个 C 列并包含其他优化;还提出了 HASH 算法,它使用动态大小的哈希表存储中间输出值。为结合 SPA 对相对稠密矩阵块的效率以及 SPARS 和 HASH 对极稀疏矩阵块提供的高性能,我们提出 H-SPA(t) 和 H-HASH(t),它们在不同算法之间动态切换。在来自 SuiteSparse Matrix Collection 的一组 40 个稀疏矩阵上,H-SPA(t) 和 H-HASH(t) 相对于 SPA 分别获得 1.24× 和 1.57× 的平均加速比。对于其中 22 个最稀疏的矩阵,H-SPA(t) 和 H-HASH(t) 分别带来 1.42× 和 1.99× 的平均加速比。
英文摘要:
The Sparse GEneral Matrix-Matrix multiplication (SpGEMM) $C = A \times B$ is a fundamental routine extensively used in domains like machine learning or graph analytics. Despite its relevance, the efficient execution of SpGEMM on vector architectures is a relatively unexplored topic. The most recent algorithm to run SpGEMM on these architectures is based on the SParse Accumulator (SPA) approach, and it is relatively efficient for sparse matrices featuring several tens of non-zero coefficients per column as it computes C columns one by one. However, when dealing with matrices containing just a few non-zero coefficients per column, the state-of-the-art algorithm is not able to fully exploit long vector architectures when computing the SpGEMM kernel. To overcome this issue we propose the SPA paRallel with Sorting (SPARS) algorithm, which computes in parallel several C columns among other optimizations, and the HASH algorithm, which uses dynamically sized hash tables to store intermediate output values. To combine the efficiency of SPA for relatively dense matrix blocks with the high performance that SPARS and HASH deliver for very sparse matrix blocks we propose H-SPA(t) and H-HASH(t), which dynamically switch between different algorithms. H-SPA(t) and H-HASH(t) obtain 1.24$\times$ and 1.57$\times$ average speed-ups with respect to SPA respectively, over a set of 40 sparse matrices obtained from the SuiteSparse Matrix Collection. For the 22 most sparse matrices, H-SPA(t) and H-HASH(t) deliver 1.42$\times$ and 1.99$\times$ average speed-ups respectively.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。