arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2207.13848cs.DCcs.LGcs.NAcs.PFmath.NA
收藏

用采样压缩比预测稀疏矩阵乘法的输出结构

Predicting the Output Structure of Sparse Matrix Multiplication with Sampled Compression Ratio

Zhejiang University(浙江大学);Alibaba Group(阿里巴巴集团)

Zhaoyang Du, Yijin Guan, Tianchan Guan, Dimin Niu, Nianxiong Tan, Xiaopeng Yu, Hongzhong Zheng, Jianyi Meng, Xiaolang Yan, Yuan Xie

摘要:

稀疏广义矩阵乘法(SpGEMM)是许多科学应用中的基本构建块。SpGEMM的一个关键任务是计算或预测输出矩阵的结构(即,每个输出行的非零元素的数量),以实现有效的内存分配和负载平衡,这会影响SpGEMM的整体性能。现有的工作要么精确地计算输出结构,要么采用上限或基于采样的方法来预测输出结构。然而,这些方法要么需要很长的执行时间,要么不够准确。在本文中,我们提出了一种新的基于采样的方法,具有更好的精度和低成本相比,现有的基于采样的方法。所提出的方法首先通过利用中间产品的数量(表示为FLOP)和非零元素的数量(表示为NNZ)相同的采样结果矩阵的SpGEMM的压缩比预测。然后,通过将每个输出行的FLOP除以预测压缩比来获得预测输出结构。我们还提出了一个参考设计现有的基于采样的方法与优化的计算开销,以证明所提出的方法更好的准确性。我们构造了625个具有不同矩阵维数和稀疏结构的测试用例来评估预测精度。实验结果表明,该方法与参考设计的平均绝对相对误差分别为1.56%和8.12%,最差情况下分别为25%和156%.

英文摘要:

Sparse general matrix multiplication (SpGEMM) is a fundamental building block in numerous scientific applications. One critical task of SpGEMM is to compute or predict the structure of the output matrix (i.e., the number of nonzero elements per output row) for efficient memory allocation and load balance, which impact the overall performance of SpGEMM. Existing work either precisely calculates the output structure or adopts upper-bound or sampling-based methods to predict the output structure. However, these methods either take much execution time or are not accurate enough. In this paper, we propose a novel sampling-based method with better accuracy and low costs compared to the existing sampling-based method. The proposed method first predicts the compression ratio of SpGEMM by leveraging the number of intermediate products (denoted as FLOP) and the number of nonzero elements (denoted as NNZ) of the same sampled result matrix. And then, the predicted output structure is obtained by dividing the FLOP per output row by the predicted compression ratio. We also propose a reference design of the existing sampling-based method with optimized computing overheads to demonstrate the better accuracy of the proposed method. We construct 625 test cases with various matrix dimensions and sparse structures to evaluate the prediction accuracy. Experimental results show that the absolute relative errors of the proposed method and the reference design are 1.56\% and 8.12\%, respectively, on average, and 25\% and 156\%, respectively, in the worst case.

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

↑