arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.10189cs.AR
收藏

在RISC-V向量处理器中优化结构化稀疏矩阵乘法

Optimizing Structured-Sparse Matrix Multiplication in RISC-V Vector Processors

Vasileios Titopoulos, Kosmas Alexandridis, Christodoulos Peltekis, Chrysostomos Nicopoulos, Giorgos Dimitrakopoulos

AI总结:

本研究针对RISC-V向量处理器的结构化稀疏矩阵乘法优化问题,分析现有实现的性能影响因素,提出vindexmac指令以低硬件成本提升效率,在卷积神经网络测试中较现有优化内核提速25%至33%。

摘要:

结构化稀疏性已被提出作为一种削减机器学习(ML)应用复杂度、简化硬件中稀疏数据处理的高效方法。无论是训练还是推理阶段的ML模型加速都高度依赖矩阵乘法,这类运算可在向量处理器或专用矩阵引擎上高效执行。本工作旨在将结构化稀疏性的简洁性集成到向量执行中,以加速对应的矩阵乘法。\n首先,本文全面探究了利用现有RISC-V指令集向量扩展实现结构化稀疏矩阵乘法的方案,定性并定量分析了影响性能的关键参数,例如标量与向量寄存器文件间的数据分布影响、数据局部性以及循环展开的有效性。此外,研究表明,仅添加一条新指令即可获得更高的性能。\n新提出的指令名为vindexmac,即向量索引乘累加指令。它支持从向量寄存器文件进行间接读取,减少了每次矩阵乘法迭代执行的指令数量,且不会引入会限制循环展开的额外依赖关系。该新指令以可忽略的硬件成本集成到了一款解耦式RISC-V向量处理器中。\n实验结果证明了所引入的优化方案和新指令在执行前沿卷积神经网络时的运行时效率与可扩展性。具体而言,与仅使用当前已定义的RISC-V指令的高度优化向量化内核相比,添加自定义指令后运行时性能分别提升了25%和33%。

英文摘要:

Structured sparsity has been proposed as an efficient way to prune the complexity of Machine Learning (ML) applications and to simplify the handling of sparse data in hardware. Accelerating ML models, whether for training, or inference, heavily relies on matrix multiplications that can be efficiently executed on vector processors, or custom matrix engines. This work aims to integrate the simplicity of structured sparsity into vector execution to speed up the corresponding matrix multiplications. Initially, the implementation of structured-sparse matrix multiplication using the current RISC-V instruction set vector extension is comprehensively explored. Critical parameters that affect performance, such as the impact of data distribution across the scalar and vector register files, data locality, and the effectiveness of loop unrolling are analyzed both qualitatively and quantitatively. Furthermore, it is demonstrated that the addition of a single new instruction would reap even higher performance. The newly proposed instruction is called vindexmac, i.e., vector index-multiply-accumulate. It allows for indirect reads from the vector register file and it reduces the number of instructions executed per matrix multiplication iteration, without introducing additional dependencies that would limit loop unrolling. The proposed new instruction was integrated in a decoupled RISC-V vector processor with negligible hardware cost. Experimental results demonstrate the runtime efficiency and the scalability offered by the introduced optimizations and the new instruction for the execution of state-of-the-art Convolutional Neural Networks. More particularly, the addition of a custom instruction improves runtime by 25% and 33% when compared with highly-optimized vectorized kernels that use only the currently defined RISC-V instructions.

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

↑