Repository navigation
Add RISC-V RVV (rv64gcv) implementation for ML-KEM - #2624
Open
fengpengboa wants to merge 1 commit into
Open
fengpengboa wants to merge 1 commit into
fengpengboa wants to merge 1 commit into
Conversation
fengpengboa
requested review from
baentsch,
bhess,
dstebila,
mkannwischer and
xuganyu96
as code owners
October 12, 2026 01:44
Integrate the RISC-V vector (RVV 1.0) backend from mlkem-native v2.0.0 into liboqs, following the existing x86_64 (AVX2) / aarch64 (NEON) variant pattern. Measurements on K3 hardware show a 44%–61% speedup across keygen, encaps, and decaps, with automatic runtime detection and full C fallback on non-RVV cores. - Vendored per-parameter-set copies (512/768/1024) carrying the upstream native/riscv64 backend; config_riscv64.h derived from config_aarch64.h (namespace-only). - Build registration gated on GCC >= 14.1 / Clang >= 17 (minimum for complete RVV 1.0 intrinsics); targets compiled with -march=rv64gcv. - Runtime detection: HWCAP_ISA_V via getauxval() + VLEN >= 256 check; per-API dispatch falls back to C when RVV is unavailable, so non-RISC-V platforms and pre-RVV cores are unaffected. - ALGORITHMS.md platform column updated with RISC-V (RVV). Verified on K3 hardware (RVV 1.0, VLEN=256,gcc15.2): | ML-KEM-512 | baseline | RVV | RVV/baseline | | ---------- | -------- | ----- | ------------ | | keygen | 22800 | 32990 | 144.69% | | encaps | 18967 | 28725 | 151.45% | | decaps | 15864 | 25653 | 161.71% | | ML-KEM-768 | baseline | RVV | RVV/baseline | | ---------- | -------- | ----- | ------------ | | keygen | 14281 | 20201 | 141.45% | | encaps | 12648 | 18807 | 148.70% | | decaps | 10720 | 16639 | 155.21% | | ML-KEM-1024 | baseline | RVV | RVV/baseline | | ----------- | -------- | ----- | ------------ | | keygen | 9785 | 13867 | 141.72 | | encaps | 8741 | 12905 | 147.64% | | decaps | 7597 | 11562 | 152.19% | Signed-off-by: fengpengbo <feng.pengbo@zte.com.cn>
fengpengboa
force-pushed
the
mlkem-riscv64-rvv
branch
from
October 12, 2026 01:56
0816f0a to
6db8626
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Integrate the RISC-V vector (RVV 1.0) backend from mlkem-native v2.0.0 into liboqs, following the existing x86_64 (AVX2) / aarch64 (NEON) variant pattern. Measurements on K3 hardware show a 44%–61% speedup across keygen, encaps, and decaps, with automatic runtime detection and full C fallback on non-RVV cores. Related to #2580
Verified on K3 hardware (RVV 1.0, VLEN=256,gcc15.2):