Added RISC-V Vector Support for selected functions #731
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.
Description
This pull request introduces RISC-V Vector (RVV 1.0) support for selected functions, extending the project with vectorized implementations inspired by my research. The goal is to leverage the RVV extension in order to improve performance in computationally intensive routines. The changes are based on my findings, which explored the acceleration of homomorphic encryption primitives on RISC-V processors using the Vector Extension. It is focused on BFV, the general techniques of instruction fusion and vectorization proved effective in accelerating arithmetic kernels.
Changes
Results
According to experiments in a Gem5 simulated RISC-V system, vectorization can provide up to 13× theoretical speedup, though practical results vary depending on workload. This PR lays the groundwork for further improvements by integrating RVV support directly into the codebase.
The RISC-V Vector intrinsics support is added for the following functions
[Compilation]
Ubuntu: 24.04
Build environment:
To compile the project with RISC-V RVV extension support enabled, make sure to enable the appropriate target flags during the build stage.
Directly on RISC-V cpu
cmake -S . -B build -DRISCVRVV=ON
For Cross Compilation
cmake -S . -B build -DRISCVRVV=ON -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++
Notes