The matrices used in many computational settings are naturally sparse, holding a small percentage of nonzero elements. Storing such matrices in specialized sparse formats enables algorithms that avoid wasting computation on zeros, significantly accelerating common matrix computations like sparse matrix-vector multiplication (SpMV) and sparse matrix-matrix multiplication (SpMM). In many real-world sparse matrices, however, nonzero elements are densely clustered in subregions of the matrix. For matrices that feature this sort of structured sparsity, hybrid formats can further improve performance by representing these subregions as dense blocks. Existing hybrid formats either fix the dimensions of dense blocks, padding irregular regions with zeros and wasting computation, or incur run-time overhead when iterating over variable-sized blocks. This paper presents SABLE, a framework for accelerating structured sparse matrix computations by using staging to achieve the best of both of these approaches. Ahead of execution, SABLE inspects the matrix to identify variable-sized dense subregions, which it stores using a new hybrid format. It then eliminates the overhead typically associated with variable-sized blocks by using staging to generate specialized code that is amenable to vectorization. We evaluate SABLE on SpMV and SpMM kernels using matrices from the popular SuiteSparse data set. SABLE outperforms the best available SpMV baseline by ${\sim}$10\% on average, and SpMM baselines by ${\sim}$20\%. When parallelized, SABLE achieves further speedups of up to ${\sim}7\times$ on SpMV and SpMM over the best fully-sparse baseline when using 8 threads.


翻译:在许多计算场景中使用的矩阵本质上是稀疏的,仅包含少量非零元素。将此类矩阵存储在专门的稀疏格式中,可以使算法避免在零元素上浪费计算,从而显著加速稀疏矩阵-向量乘法(SpMV)和稀疏矩阵-矩阵乘法(SpMM)等常见矩阵运算。然而,在许多现实世界的稀疏矩阵中,非零元素密集地聚集在矩阵的子区域内。对于具有此类结构化稀疏性的矩阵,混合格式可以通过将这些子区域表示为稠密块来进一步提升性能。现有的混合格式要么固定稠密块的维度,对不规则区域进行零填充并浪费计算,要么在迭代变尺寸块时产生运行时开销。本文提出了SABLE框架,该框架通过使用分阶段技术来加速结构化稀疏矩阵计算,从而兼顾这两种方法的优势。在执行前,SABLE会检查矩阵以识别变尺寸的稠密子区域,并使用一种新的混合格式进行存储。随后,它通过分阶段生成适用于向量化的专用代码,消除了通常与变尺寸块相关的开销。我们使用流行SuiteSparse数据集中的矩阵,在SpMV和SpMM内核上评估SABLE。SABLE平均优于最佳可用SpMV基线约10%,优于SpMM基线约20%。在并行化后,当使用8个线程时,SABLE在SpMV和SpMM上相比最佳全稀疏基线进一步实现了高达约7倍的加速。

0
下载
关闭预览

相关内容

【博士论文】利用图结构加速稀疏计算
专知会员服务
18+阅读 · 2025年3月6日
【NeurIPS2023】矩阵压缩通过随机低秩和低精度分解
专知会员服务
31+阅读 · 2023年10月22日
【干货书】系统与控制的稀疏性方法,214页pdf
专知会员服务
40+阅读 · 2023年5月19日
专知会员服务
46+阅读 · 2020年7月29日
稀疏大模型简述:从MoE、Sparse Attention到GLaM
夕小瑶的卖萌屋
14+阅读 · 2022年3月22日
【AAAI2021】对比聚类,Contrastive Clustering
专知
26+阅读 · 2021年1月30日
推荐系统之矩阵分解家族
图与推荐
13+阅读 · 2020年3月28日
稀疏性的3个优势 -《稀疏统计学习及其应用》
遇见数学
15+阅读 · 2018年10月24日
【干货】理解深度学习中的矩阵运算
专知
12+阅读 · 2018年2月12日
Spark机器学习:矩阵及推荐算法
LibRec智能推荐
16+阅读 · 2017年8月3日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
VIP会员
相关资讯
稀疏大模型简述:从MoE、Sparse Attention到GLaM
夕小瑶的卖萌屋
14+阅读 · 2022年3月22日
【AAAI2021】对比聚类,Contrastive Clustering
专知
26+阅读 · 2021年1月30日
推荐系统之矩阵分解家族
图与推荐
13+阅读 · 2020年3月28日
稀疏性的3个优势 -《稀疏统计学习及其应用》
遇见数学
15+阅读 · 2018年10月24日
【干货】理解深度学习中的矩阵运算
专知
12+阅读 · 2018年2月12日
Spark机器学习:矩阵及推荐算法
LibRec智能推荐
16+阅读 · 2017年8月3日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员