feat(RVV): Optimize MatrixAdd, MatrixSub, and MatrixMax with vector intrinsics#3913
Merged
jxt1234 merged 1 commit intoalibaba:masterfrom Nov 20, 2025
Merged
feat(RVV): Optimize MatrixAdd, MatrixSub, and MatrixMax with vector intrinsics#3913jxt1234 merged 1 commit intoalibaba:masterfrom
jxt1234 merged 1 commit intoalibaba:masterfrom
Conversation
…tions with RVV intrinsics This commit replaces the scalar implementations of element-wise matrix addition, subtraction, and maximum functions with versions optimized using RISC-V Vector (RVV) intrinsics. These changes significantly accelerate computation on supported hardware, with performance tests showing speedups of up to 13.48x for MatrixMax and over 6x for MatrixAdd and MatrixSub on large matrices. Signed-off-by: lyd1992 <liuyudong@iscas.ac.cn> Signed-off-by: ihb2032 <1355790728@qq.com>
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.
This PR introduces RISC-V Vector intrinsic optimizations for the following element-wise matrix operations:
MatrixAddMatrixSubMatrixMaxPerformance Gains
The RVV implementation shows substantial speedups compared to the scalar version. Here are some highlights from the test results:
MatrixAdd: Achieved up to 6.36x speedup.MatrixSub: Achieved up to 6.21x speedup.MatrixMax: Achieved up to 13.48x speed-up.Testing Environment
The tests were conducted using the same environment as in PR #3779.