TL;DR
This paper introduces a machine learning-based framework to automatically select the optimal storage format for Sparse Matrix-Vector Multiplication (SpMV) on many-core architectures. By analyzing static matrix features, their model achieves over 90% of the theoretical peak performance on both Intel Knights Landing and ARM-based FT-2000Plus processors without the need for expensive runtime profiling.
What Problem Does This Paper Address?
Sparse Matrix-Vector Multiplication (SpMV) is a fundamental building block in scientific computing, but it is notoriously difficult to optimize. Because sparse matrices consist mostly of zeros, researchers use various "compressed" storage formats (like CSR, ELL, or HYB) to save memory and computation.
The challenge is that there is no "one-size-fits-all" format. The best representation depends on both the specific structure of the matrix (how the non-zeros are distributed) and the underlying hardware architecture. Traditionally, choosing the right format required manual trial-and-error or deep expert knowledge. As many-core architectures become more diverse and complex, this manual approach has become a significant bottleneck for HPC developers.
Methods
The authors propose an automated, predictive approach using supervised machine learning. Their workflow consists of three main stages:
- Feature Extraction: They identify seven static, quantifiable properties of a sparse matrix (e.g., number of rows/columns, average non-zeros per row, and "variation" or regularity of the sparsity pattern). These are extracted using a simple script and require no hardware-specific information.
- Offline Training: They performed over 9,500 profiling runs across 956 datasets to find the "ground truth" best format for each matrix on two specific architectures: Intel’s Knights Landing (KNL) and the ARM-based Phytium FT-2000Plus (FTP).
- Predictive Modeling: They trained a Decision Tree Classifier (DTC) to map matrix features to the optimal storage format. They chose Decision Trees because they are highly interpretable and provide accuracy comparable to more complex "black-box" models like Random Forests or Neural Networks.
Additionally, the authors investigated low-level optimizations, including manual SIMD vectorization using intrinsics and NUMA-aware memory allocation, to ensure their baseline measurements were as fast as possible.
Datasets
The study utilizes 956 square matrices from the SuiteSparse Matrix Collection (formerly the University of Florida Sparse Matrix Collection).
- Scale: The total dataset size is approximately 90 GB.
- Diversity: Matrices range from 100,000 to 20 million non-zeros, covering domains from social network analysis to fluid dynamics.
- Formats: The study evaluates five mainstream representations: CSR, CSR5, ELL, SELL, and HYB.
Key Insights and Ideas
- Architecture-Specific Preferences: The "best" format is highly hardware-dependent. For example, the KNL architecture has hardware support for
gather/scatteroperations, making the standard CSR format quite effective. In contrast, the ARM-based FTP lacks this support, making "sliced" formats like SELL much more attractive. - The Power of Static Features: One of the most important findings is that static features (calculated before the program runs) are sufficient to predict performance. You don't need to run the code (dynamic profiling) to make an informed choice.
- NUMA is Critical for ARM: On the FT-2000Plus, using NUMA-aware memory allocation provided a massive speedup (up to 6x for the ELL format), highlighting that memory placement is just as important as the storage format itself on many-core ARM chips.
- Vectorization Disparity: While manual vectorization significantly boosted performance on Intel KNL (up to 1.6x), it provided no gain on the FTP due to the lack of efficient gather instructions in the ARMv8 instruction set at the time of the study.
Key Results
- Oracle-Level Performance: The predictive model delivered an average of 95% of the best available performance on KNL and 91% on FTP.
- Efficiency: The model is "immediately deployable." While training takes a few days, the actual prediction for a new matrix takes less than 10 milliseconds.
- Format Distribution: On the FTP platform, the SELL format was optimal for nearly 50% of matrices. On KNL, the traditional CSR format remained the winner for over 50% of cases, followed by CSR5.
Limitations and Future Work
- Format Variety: The study is limited to five specific formats. While these are mainstream, other emerging formats (like those optimized for specific GPU architectures) were not included.
- Static vs. Dynamic Matrices: The model assumes the matrix structure is static. In some simulations, the sparsity pattern changes over time, which would require the model to account for the overhead of re-converting formats on the fly.
- Deep Learning Potential: The authors mention that while Decision Trees are effective, future work could explore Convolutional Neural Networks (CNNs) to automatically learn features from matrix "images," potentially reducing selection errors even further.
Summary updated