Towards Efficient SpMV: A Multi-Aware Optimization Framework for Heterogeneous Architecture
摘要
Sparse Matrix-Vector Multiplication (SpMV) is a fundamental computational kernel widely used in scientific computing. Due to its irregular memory access patterns and the diverse sparsity structures present in real-world matrices, optimizing SpMV is challenging. This paper proposes an adaptive SpMV optimization framework and SpMV implementation method, which integrates deep insights into matrix characteristics, algorithmic strategies, and hardware architectures. By combining these three complementary aspects with a hierarchical decision tree model, the framework dynamically selects the most suitable optimization strategy for a given matrix and target hardware platform. The framework consists of three key components: (1) A matrix feature extraction pipeline that analyzes non-zero element distribution, sparsity patterns, and algorithmic properties to generate feature descriptors; (2) An interpretable adaptive model based on hierarchical decision tree that examines key parameters to effectively guide the selection of computing kernels and their configuration; and (3) A collection of specialized, lightweight candidate SpMV kernels designed to cover diverse scenarios and validate the framework’s adaptability. Extensive experimental evaluation on modern GPU architectures demonstrates that the framework delivers consistent performance improvements over a wide range of sparse matrices with differing sparsity characteristics. The model-enhanced SpMV kernels achieve an overall speedup ranging from 1 \(\times \) to 6 \(\times \) compared to the baseline, with an average speedup of 1.31 \(\times \) , compared to hipSPARSE, the average solution speed is improved by a factor of 1.22 \(\times \) . Furthermore, it maintains robust and stable performance while automatically adapting to matrix properties, highlighting its potential for practical deployment in heterogeneous computing environments.