arXiv:2609.11352cs.DCSep 2026

Manuscript Offprint

arXiv:2609.11352

Rethinking Sparse Formats for RISC-V: A Hierarchical Approach to High-Performance SpMV

Anna Pirova, Anastasia Vodeneeva, Konstantin Kovalev, Alexander Ustinov, Maksim Zagriadskov, Daniil Litvyakov, Arthur Kulik, Evgeny Kozinov, Valentin Volokitin, Iosif Meyerov

Abstract

The sparse matrix-vector multiplication (SpMV) algorithm is a fundamental computational kernel of linear algebra and serves as a building block for numerous applications, primarily iterative solvers for systems of linear equations used in scientific and engineering simulations. This paper compares vectorized implementations of the SpMV algorithm across eight established sparse matrix storage formats and proposes a novel modification of the CSR format, Hierarchical CSR (HCSR), which enhances SpMV performance on RISC-V processors. Our SpMV implementations utilize RVV 1.0 intrinsics and are publicly available as an open-source C++ library named RVVLASparse. Computational experiments conducted on SpacemiT K1 and K3 RISC-V boards demonstrate that selecting an appropriate matrix storage format accelerates SpMV computations by an average of 1.6x, while the proposed HCSR format achieves the shortest execution time among all considered formats across a broad class of sparse matrices.

Keywords: linear algebra, RISC-V, HPC, sparse matrix, vectorization, matrix-vector multiplication, mathematical libraries, benchmarking, performance

1. Introduction

The emergence of the RISC-V open and patent-free instruction set architecture (ISA) has opened new research directions and opportunities for computer architects and high-performance software developers. Within just 15 years, the RISC-V ISA has evolved significantly from a research prototype to commercially available microprocessors and microcontrollers. Although the vast majority of currently produced devices belong to the IoT segment, early prototypes of server processors featuring dozens of modern out-of-order computational cores with RVV 1.0 vector extensions have emerged, making them suitable for many problems in the HPC domain [4], [5]. The development of the RISC-V ecosystem requires optimization of the entire software stack, ranging from system-level and low-level software to end-user application packages. A potential solution is to rely entirely on an optimizing compiler, delegating code optimization responsibilities to it. This approach offers obvious advantages, including rapid adaptation speed, minimal effort expenditure, and the ability to simply recompile the code upon the release of newer, more advanced hardware. Nevertheless, a number of architecture-specific optimizations can still only be implemented manually, which entails substantial effort when adapting numerous applications.

The problem of mathematical software optimization for RISC-V is actively being investigated by the scientific and engineering communities. For instance, recent studies [21], [22] examine an approach to optimizing codes in computational fluid dynamics and bioinformatics. In [16], the authors propose a method for RISC-V specific vectorization within the CatBoost machine learning package. In [8], performance issues are studied for astrophysics codes implemented using HPX and Kokkos, while [26] proposes an optimization for the Fast Fourier Transform. Overall, the problem of tailoring mathematical software to the specifics of the new RISC-V ISA is of significant practical interest.

In this work, we investigate the dependence of sparse matrix-vector multiplication (SpMV) performance on the sparse matrix storage format for RISC-V processors. The SpMV algorithm is one of the key computational kernels in linear algebra. Specifically, it serves as the primary computationally intensive kernel for iterative solvers of sparse systems of linear equations (SLAE), which are applied to solve a wide range of engineering problems using supercomputers. Despite the apparent simplicity of this algorithm, efficient representation of sparse matrices that allows unlocking the potential of modern computing systems remains an unsolved challenge. Researchers proposed various approaches to increasing SpMV performance for x86 CPUs and GPUs through the use of specialized sparse matrix storage formats, leveraging SIMD instructions, and applying non-trivial parallelization schemes. The most common sparse linear algebra libraries for CPUs (e.g., Intel oneAPI MKL, AOCL-Sparse, SparseBLAS) utilize classic matrix storage formats that often fail to fully exploit the SIMD mechanisms supported by modern processors and are not adapted for RISC-V architectures. Meanwhile, most implementations of non-standard storage formats

∗^{*}Corresponding author.

Email address: meerov@vmk.unn.ru (Iosif Meyerov) are distributed as standalone libraries and are not integrated into SLAE solvers.

Thus, although the problem is well-studied for traditional architectures, there remains room for further SpMV algorithm optimizations. These can be performed at different levels, ranging from leveraging the architectural peculiarities of the new RISC-V platform to attempting to overcome the fundamental memory wall issue, which prevents achieving acceptable performance in the SpMV operation (current results show a two-order-of-magnitude gap on the HPCG benchmark compared to Linpack test results).

In this paper, we present RVVLASparse 1^{1}, a software library designed for RISC-V processors that enables the SpMV operation across nine different sparse matrix storage formats. Supported formats include CSR, Sell-C- σ\sigma, CSR2, CSR5, LAV, VHCC, VNEC, CVR, as well as a novel format, Hierarchical CSR (HCSR). The core idea behind the new format lies in improving memory subsystem efficiency by partitioning matrices into blocks of CSR and COO formats.

The scientific contributions of this work are as follows:

  1. We propose a new sparse matrix storage format, HCSR. Compared to scalar and typical vectorized SpMV implementations for the CSR format, the new format improves average SpMV performance on RISC-V CPUs by 1.6x.

  2. We present a comparative performance analysis of the SpMV operation on two generations of RISC-V processors across different storage formats.

  3. We discuss the tunability of hyperparameters for various storage formats and identify the main characteristics of sparse matrices that influence format selection.

  4. We release the RVVLASparse library, which implements SpMV algorithms for nine sparse data structures for RISC-V CPUs, as publicly available open-source software.

The remainder of this paper is structured as follows. Section section 2 provides an overview of sparse matrix storage formats. Section section 3 describes several matrix storage formats along with their corresponding SpMV algorithms and details the new HCSR format. Section section 4 presents experimental results for all implemented formats and analyzes SpMV performance. Section section 5 describes the results of automatic storage format selection based on matrix sparsity pattern characteristics using gradient boosting of decision trees. Finally, Section section 6 concludes the paper and outlines future work plans.

References (34)