Add RISC-V Vector (RVV) support for CPU Execution Provider

Merged
VE
6mo ago
+1377-9

Motivation and Context

Close #17466 and #24596

MLAS already provides architecture-specific optimized kernels for multiple vector ISAs, such as SSE/AVX/AVX2/AVX512 on x86/x64, NEON/SVE on Arm, VSX on POWER, LSX/LASX on LoongArch, and zvector on s390x. However, riscv64 has not had comparable RVV-optimized coverage for the operators in this PR and has mainly fallen back to scalar code.

This PR introduces RISC-V Vector (RVV) extension support to the ONNX Runtime CPU Execution Provider.

This PR focuses on two operators: SGEMM and Softmax.
We have already completed optimizations for several other operators. Following the acceptance of this PR, I will work with @qiurui144 to upstream the remaining optimized kernels in a series of subsequent PRs.

Benchmark Results

SGEMM

Casepack_bRVV pack msRVV compute msScalar pack msScalar compute msCompute speedupEnd-to-end speedup
128x3072x768163.21114.5266.71414.443.62x2.71x
64x1024x1024122.0727.6623.1496.643.49x2.41x
32x4096x10241119.0456.82118.86188.343.31x1.75x

Softmax

CaseScalar msRVV msSpeedup
4096x1281955.25611.653.20x
1024x1024717.26236.733.03x