Closer in the Gap: Towards Portable Performance on RISC-V Vector Processors
Ruimin Shi, Maya Gokhale, Pei-Hung Lin, Xavier Teruel, Ivy Peng ✉ · 2026
Read Closer in the Gap: Towards Portable Performance on RISC-V Vector Processors by Ruimin Shi, Maya Gokhale, Pei-Hung Lin, Xavier Teruel, Ivy Peng ✉ (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2605-10860.txt.
Introduction
Ruimin Shi and four colleagues measure how close real compilers come to portable speed on RISC-V vector hardware. The RISC-V Vector Extension promises lasting compute for science and machine learning, but compiler support and performance counters for version 1.0 hardware are still maturing.
Assembly microbenchmarks on Banana Pi F3 hardware calibrate the counters and expose predication overhead and strided loads as bottlenecks that compiler cost models miss. Across six applications, GCC 15 beats Clang 21 in four, with Clang ahead only on two dense matrix kernels, and a new vector backend for Google's Qsim simulator shows the same pattern. Chip and compiler teams get a calibrated map of where the gap still lies.
Catalog record
| CREATOR | Ruimin Shi, Maya Gokhale, Pei-Hung Lin, Xavier Teruel, Ivy Peng ✉ |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 37757 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2605.10860
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Closer in the Gap: Towards Portable Performance on RISC-V Vector Processors Ruimin Shi, Maya Gokhale, Pei-Hung Lin, Xavier Teruel, Ivy Peng ✉ Abstract The RISC-V Vector Extension (RVV) is a cornerstone for sustaining compute throughout in scientific and machine learning workloads. However, compiler support and performance monitoring on RVV 1.0 hardware remain actively evolving. In this work, we design a suite of assembly microbenchmarks to calibrate performance counters on the BananaPi-F3 RVV hardware. Using the benchmarks, we find that predication overhead and stride load pose performance bottlenecks that current compiler cost models do not yet fully capture. Evaluating GCC 15 and Clang 21 across six scientific and ML applications, GCC 15 produces more stable and efficient code generation, outperforming Clang 21 in four of six benchmarks. Clang 21 achieves superior performance only in SGEMM and DGEMM, attributable to more aggressive instruction reduction as confirmed by our validated perf counters. Default LMUL selection proves near-optimal in most cases, though GCC 15 shows greater potential for performance gains through larger LMUL tuning than Clang 21. Finally, we contribute an RVV backend for Google’s Qsim quantum circuit simulator implemented using RVV intrinsics, where GCC 15 again outperforms LLVM 21 on this complex, real-world workload. 1 Introduction The RISC-V Instruction Set Architecture (ISA) has attracted increasing interest from both industry and academia for its open, modular design and suitability for workload-specific customization [ 15 , 5 , 10 , 13 ] . A cornerstone of RISC-V’s relevance to High-Performance Computing is the RISC-V Vector Extension (RVV). Many HPC workloads, including ML training and inference, scientific simulations, and signal processing, are built around data-parallel algorithms that benefit directly from wide vector execution. Unlike traditional SIMD with fixed vector lengths in ISA, RVV adopts a Vector-Length-Agnostic (VLA) model where the active vector length can be determined at runtime. Another popular VLA realization is ARM’s scalable vector extension (SVE), which was first implemented in Fujitsu’s A64FX processor powering the Fugaku supercomputer, and widely adopted in recent NVIDIA Grace and AWS Graviton processors [ 16 ] . For achieving portable performance on various RVV hardware, compiler support and performance profiling are both important. Auto-vectorization compiler support is the key enabler for portable performance on broad RVV hardware. At the fast pace of new RVV hardware emerging, compiler support allows applications to harness different vector hardware without rewriting applications. However, compared to vector length-specific SIMD, RVV’s VLA model imposes new challenges on the compiler support for auto-vectorization. One particular challenge is that under uncertainty about the hardware vector width at compilation time, a compiler must generate correct vsetvl sequences that set active vector length at runtime, select an appropriate value for the vector length multiplier (LMUL), and handle tail elements and masks. Addressing these difficulties, GNU and LLVM are both under active development to ramp up RVV support. Prior works have characterized compiler support for RVV, including comparative evaluations of GCC 14 and LLVM 19 on ratified RVV 1.0 hardware [ 1 , 10 , 6 ] . However, both compilers have since undergone substantial RVV-specific development. For instance, GCC 15 introduced early-break loop vectorization, corrected memory misaligned access, and dynamic LMUL selection. LLVM 21 added multiple hardware-specific scheduling models for recent RVV hardware. An up-to-date evaluation of these compiler advances is therefore timely and necessary. Meanwhile, performance monitoring on RISC-V hardware remains significantly less mature than on x86 or AArch64 [ 3 ] . The RISC-V specification mandates only two HPM counters, cycle and instruction , leaving other events to custom-specific implementation. Therefore, validating the availability and reliability of performance monitoring counters remains necessary for optimizing performance on RVV hardware. In this paper, we make the following contributions: • We design a suite of assembly microbenchmarks targeting key RVV 1.0 arithmetic and data access operations, and validate RVV-specific hardware performance events in perf on RVV hardware. • We evaluate the enhanced support for RVV autovectorization in GCC15 and LLVM21 in six HPC and ML proxy applications on two RVV1.0 hardware. • We quantify that predication masks introduce 35% overhead w.r.t unmasked vsetvl for tailing elements, and strided vector ld/st instructions incur up to 4 \times the cost of unit-stride equivalents • We contribute an RVV backend for a production quantum circuit simulator Qsim using RVV intrinsics and find that GCC 15 outperforms LLVM 21 on this complex, real-world workload. 2 Background RVV Processors and VLA. The RVV version v1.0 [ 2 ] was ratified in 2021 and since then, hardware implementation has gained traction in vendors and undergone active development [ 13 ] . RVV supports the VLA programming model, similar to ARM scalable vector extension (SVE). Different from vector length specific (VLS), such as x86 AVX and ARM NEON, which require the vector length known at compilation time, VLA allows the same binary to be portable across RVV hardware with different vector length (VLEN). RVV defines 32 VLEN-bit long vector registers. Recent implementations support VLEN from 128 up to 16384 [ 13 ] . Through dynamic register typing, RVV tag data element types and size to vector registers instead of instructions, to enable a fixed ISA supporting growing VLEN. The active vector length (VL) is determined at runtime via the vsetvl instruction and depends on the memory allocated to vector registers in hardware implementation, the number of activated vector registers, and the selected element width (SEW). LMUL is a multiplier of values 1/8, 1/4, 1/2, 1, 2, 4, or 8, which groups multiple vector registers into one ‘logical’ vector so that when LMUL is larger than 1, more elements can be executed in one instruction. Combining these architectural parameters, the theoretical maximum number of elements that can be operated on with a single vector instruction is VL=\frac{LMUL*VLEN}{SEW} . RVV also provides the masking mechanism to support predicated vector execution and non-unit stride and indexed gather/scatter operations for irregular loop patterns. Compiler Support for VLA model. RVV intrinsics and autovectorization are the primary mechanisms to translate RVV’s architectural portability into practical performance portability in applications. Both GCC and LLVM have offered code generation compliant with RVV 1.0 specification. A capable compiler can generate code that automatically adapts to the underlying vector hardware at runtime, removing the need for platform-specific hand tuning required by VLS. Both GCC and LLVM have invested heavily in RVV 1.0 support. The RVV 1.0 C intrinsics provide developers with direct access to individual vector instructions from the C/C++ source code, including control over SEW, LMUL, VL and masks. Intrinsics thus represent the performance ceiling against which compiler-generated autovectorized outcomes can be measured. For irregular access patterns, hand-written intrinsic code consistently outperforms compiler-generated code in earlier LLVM Clang releases. [ 1 ] . Compiler autovectorization transforms scalar loops into vector code automatically, selecting appropriate LMUL values, emitting vsetvl instructions [ 6 ] . GCC 14 and Clang 19 were the first GNU and LLVM releases with production-quality RVV autovectorization and full C intrinsics. GCC 15 extends this with saturating arithmetic( vssubu.vv , vnclipu.wi ), early-break vectorization (loops with conditional break statements), and an improved -O2 cost model. LLVM’s RISC-V backend has received intensive investment since then, in areas including VL tail folding and split register allocation between the RVV and scalar register files. LLVM 21