• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

计算机工程与科学 ›› 2022, Vol. 44 ›› Issue (01): 1-8.

• 高性能计算 • 上一篇    下一篇

基于RISC-V向量指令的稀疏矩阵向量乘法实现与优化

顾越,赵银亮   

  1. (西安交通大学计算机学院,陕西 西安 710049)

  • 收稿日期:2020-03-23 修回日期:2021-08-24 接受日期:2022-01-25 出版日期:2022-01-25 发布日期:2022-01-13
  • 基金资助:
    广东省重点领域研发计划(2019B090916003) 

Implementation and optimization of sparse matrix vector multiplication based on RISC-V vector instruction

GU Yue,ZHAO Yin-liang   

  1. (School of Computer,Xi’an Jiaotong University,Xi’an 710049,China) 
  • Received:2020-03-23 Revised:2021-08-24 Accepted:2022-01-25 Online:2022-01-25 Published:2022-01-13

摘要: 开源指令集架构RISC-V具有高性能、模块化、简易性和易拓展等优势,在物联网、云计算等领域的应用日渐广泛,其向量拓展部分V模块更是很好地支持了矩阵数值计算。稀疏矩阵向量乘法SpMV作为矩阵数值计算的一个重要组成部分,具有深刻的研究意义与价值。利用RISC-V 指令集的向量可配置性和寻址特性,分别对基于CSR、ELLPACK和HYB压缩格式存储的稀疏矩阵向量乘法进行向量化。同时,考虑稀疏矩阵极度稀疏和每行非零元素数量波动较大的情况,通过压缩非零元素密度低的行向量的存储、调整HYB分割阈值等手段,改进了HYB存储格式,显著改善了计算效率和存储效率。

关键词: RISC-V, 向量拓展, 稀疏矩阵, SpMV

Abstract: Open source instruction set architecture RISC-V has the advantages of high performance, modularization, simplicity, easy extension, etc., and is widely used in the Internet of Things, cloud computing and other fields. The V module of its vector expansion part supports matrix numerical calculation well. As an important part of matrix numerical calculation, sparse matrix vector multiplication (SpMV) has profound research significance and value. Using the vector configurability and addressing characteristics of RISC-V instruction set, vector multiplication of sparse matrix based on CSR, ELLPACK and HYB compressed format is vectorized respectively. Meanwhile, considering that the sparse matrix is extremely sparse and the number of non-zero elements in each row fluctuates greatly, the HYB storage format is improved by compressing the storage of row vectors with low density of non-zero elements and adjusting the HYB segmentation threshold, which significantly improves the computational efficiency and storage efficiency.

Key words: RISC-V, vector expansion, sparse matrix, SpMV