arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2002.08947cs.ARcs.DC
收藏

SpArch:面向稀疏矩阵乘法的高效架构

SpArch: Efficient Architecture for Sparse Matrix Multiplication

Zhekai Zhang, Hanrui Wang, Song Han, William J. Dally

AI总结:

本文提出 SpArch 稀疏矩阵乘法加速器,通过流式合并器、紧凑矩阵表示、Huffman 树调度器和行预取器联合优化输入输出局部性,显著降低 DRAM 访问,并在 20 个基准上大幅超越现有方案。

摘要:

广义稀疏矩阵-矩阵乘法(SpGEMM)是各类工程和科学应用中普遍存在的任务。然而,基于内积的 SpGEMM 会因不匹配的非零操作数而引入冗余的输入读取,而基于外积的方法又会因大量部分积矩阵导致较差的输出局部性。输入或输出数据任一方面复用效率不足,都会造成大量且代价高昂的 DRAM 访问。为解决这一问题,本文提出一种高效的稀疏矩阵乘法加速器架构 SpArch,它联合优化输入矩阵和输出矩阵的数据局部性。我们首先设计了一种高度并行、基于流式处理的合并器,将部分矩阵的乘法阶段与合并阶段流水化,使部分矩阵在生成后立即在片上合并。随后,我们提出一种紧凑矩阵表示,将部分矩阵的数量减少三个数量级,从而将 DRAM 访问降低 5.4 倍。我们进一步开发了 Huffman 树调度器,以提升合并器面向更大稀疏矩阵时的可扩展性,这又将 DRAM 访问降低 1.8 倍。我们还通过具有接近最优缓存替换策略的行预取器,解决了新表示引起的输入矩阵读取增加问题,进一步将 DRAM 访问降低 1.5 倍。在 20 个基准测试上评估时,SpArch 相比此前最先进方法将总 DRAM 访问降低 2.8 倍。平均而言,SpArch 相比 OuterSPACE、MKL、cuSPARSE、CUSP 和 ARM Armadillo 分别实现 4 倍、19 倍、18 倍、17 倍、1285 倍加速,以及 6 倍、164 倍、435 倍、307 倍、62 倍能耗节省。

英文摘要:

Generalized Sparse Matrix-Matrix Multiplication (SpGEMM) is a ubiquitous task in various engineering and scientific applications. However, inner product based SpGENN introduces redundant input fetches for mismatched nonzero operands, while outer product based approach suffers from poor output locality due to numerous partial product matrices. Inefficiency in the reuse of either inputs or outputs data leads to extensive and expensive DRAM access. To address this problem, this paper proposes an efficient sparse matrix multiplication accelerator architecture, SpArch, which jointly optimizes the data locality for both input and output matrices. We first design a highly parallelized streaming-based merger to pipeline the multiply and merge stage of partial matrices so that partial matrices are merged on chip immediately after produced. We then propose a condensed matrix representation that reduces the number of partial matrices by three orders of magnitude and thus reduces DRAM access by 5.4x. We further develop a Huffman tree scheduler to improve the scalability of the merger for larger sparse matrices, which reduces the DRAM access by another 1.8x. We also resolve the increased input matrix read induced by the new representation using a row prefetcher with near-optimal buffer replacement policy, further reducing the DRAM access by 1.5x. Evaluated on 20 benchmarks, SpArch reduces the total DRAM access by 2.8x over previous state-of-the-art. On average, SpArch achieves 4x, 19x, 18x, 17x, 1285x speedup and 6x, 164x, 435x, 307x, 62x energy savings over OuterSPACE, MKL, cuSPARSE, CUSP, and ARM Armadillo, respectively.

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

↑