Skip to main content
QUICK REVIEW

[论文解读] Accelerating the SpMV kernel on standard CPUs by exploiting the partially diagonal structures

Takeshi Fukaya, Koki Ishida|arXiv (Cornell University)|May 11, 2021
Parallel Computing and Optimization Techniques参考文献 30被引用 6
一句话总结

本文提出 M-HDC 格式,一种改进的混合存储格式,结合 DIA 与 CSR,以利用稀疏矩阵中的部分对角结构,在现代多核 CPU 上显著加速 SpMV。通过优化缓存分块与结构提取,M-HDC 内核在大型实际矩阵上相较 CSR 最高实现 2.5 倍加速,尤其在缓存外场景中,此时内存带宽主导性能表现。

ABSTRACT

Sparse Matrix Vector multiplication (SpMV) is one of basic building blocks in scientific computing, and acceleration of SpMV has been continuously required. In this research, we aim for accelerating SpMV on recent CPUs for sparse matrices that have a specific sparsity structure, namely a diagonally structured sparsity pattern. We focus a hybrid storage format that combines the DIA and CSR formats, so-called the HDC format. First, we recall the importance of introducing cache blocking techniques into HDC-based SpMV kernels. Next, based on the observation of the cache blocked kernel, we present a modified version of the HDC formats, which we call the M-HDC format, in which partial diagonal structures are expected to be more efficiently picked up. For these SpMV kernels, we theoretically analyze the expected performance improvement based on performance models. Then, we conduct comprehensive experiments on state-of-the-art multi-core CPUs. By the experiments using typical matrices, we clarify the detailed performance characteristics of each SpMV kernel. We also evaluate the performance for matrices appearing in practical applications and demonstrate that our approach can accelerate SpMV for some of them. Through the present paper, we demonstrate the effectiveness of exploiting partial diagonal structures by the M-HDC format as a promising approach to accelerating SpMV on CPUs for a certain kind of practical sparse matrices.

研究动机与目标

  • 解决尽管 DIA 格式在结构化稀疏矩阵上具有潜力,但在现代多核 CPU 上 DIA 基 SpMV 的性能提升有限的问题。
  • 研究缓存分块与格式混合(DIA+CSR)对具有部分对角结构的矩阵的 SpMV 性能影响。
  • 开发一种改进的存储格式(M-HDC),比现有 HDC 格式更高效地捕捉部分对角模式。
  • 在最新一代 CPU 上,对 M-HDC 格式相对于 CSR 和标准 HDC 格式的性能提升进行理论与实证验证。
  • 明确 SIMD 向量化在何种条件下提供性能增益,尤其区分缓存内与缓存外场景。

提出的方法

  • 提出 M-HDC 格式作为 HDC(混合 DIA-CSR)格式的改进版本,旨在更有效地提取并利用部分对角结构。
  • 在基于 M-HDC 的 SpMV 内核中引入缓存分块技术,以提升数据局部性并减少缓存未命中。
  • 构建性能模型,以分析预测 M-HDC 相较于 CSR 和 HDC 格式的加速增益。
  • 在现代多核 CPU 上实现并基准测试 M-HDC、B-HDC(缓存分块 HDC)和 CSR 内核,使用合成的五点模板矩阵和真实应用矩阵。
  • 采用朴素的结构发现算法从输入矩阵中提取部分对角线,专注于隔离格式转换的开销。
  • 在不同矩阵尺寸下比较各格式的性能,以分离内存带宽与 SIMD 向量化的影响。

实验结果

研究问题

  • RQ1在现代多核 CPU 上,M-HDC 格式相较于 CSR 和标准 HDC 格式如何提升 SpMV 性能?
  • RQ2缓存分块对具有部分对角结构的 DIA 基 SpMV 内核性能有何影响?
  • RQ3在何种内存访问模式下(缓存内 vs. 缓存外),SIMD 向量化能为 SpMV 内核提供显著加速?
  • RQ4对于哪些实际稀疏矩阵类别,利用部分对角结构能带来可测量的性能增益?
  • RQ5基于内存访问模式的理论性能模型与真实硬件上的实测结果是否一致?

主要发现

  • M-HDC 格式在具有部分对角结构的大规模实际稀疏矩阵上,相较 CSR 内核最高实现 2.5 倍加速,尤其在缓存外场景中表现显著。
  • 当矩阵大小超过缓存容量时,性能提升最为明显,此时内存带宽成为主要瓶颈,而非 SIMD 利用率。
  • 在缓存内场景中,SIMD 向量化显著提升性能,但在缓存外场景中该优势急剧下降。
  • 基于内存访问模式的理论性能模型能准确预测观测到的加速趋势,验证了模型的可靠性。
  • B-HDC 内核(缓存分块 HDC)性能优于标准 HDC,证实了缓存感知优化在混合格式中的重要性。
  • 研究发现,对于数值库中的实际应用,必须将从 CSR 到 M-HDC 的格式转换开销降至最低,因为目前该开销主导了整体性能损耗。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。