RVV: Optimize conv opt and common opt functions - #4821
Open
typer-J wants to merge 2 commits into
Open
Conversation
Add and refine RVV implementations for ConvOpt depthwise, int8, deconv, matrix, and related low-memory helper kernels. Co-authored-by: Sherlockzhangjinge <zjgzhangjinge@outlook.com> Co-authored-by: jxgxxx <1955992348@qq.com> Co-authored-by: lyd1992 <liuyudong@iscas.ac.cn> Signed-off-by: typer-J <2236066784@qq.com>
12 tasks
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.
Supersedes #4457.
This rebases the RVV convolution optimization work onto the latest
masterand resolves the conflicts called out in the review of #4457.Changes
MNNConvRunForUnitint8_tandMNNConvRunForLineint8_t.MNNAbsMaxFP32across therealSizedimension.Rebase conflict resolution
MNNPackedMatMul_int8.cppfrom [MNN:Refact] Delete 'MNN_CPU_DEQUANT_GEMM' code #4506 instead of restoring the obsoleteMNN_CPU_DEQUANT_GEMMpath.MNNAccumulateSequenceNumber_RVVimplementation, including the dirty-lane reduction fix from [CPU:Bugfix] Fix dirty data reduction in RVV AccumulateSequence #4590.alibaba/MNN@47a656ef.Earlier verification (before this update)
clang-format --dry-run --Werrorpassed for all eight changed RVV source files.rv64gcv(--target=riscv64-unknown-linux-gnu -march=rv64gcv -mabi=lp64d).MNN_BUILD_TEST=ONcompleted successfully.AbsMax regression repair (2026-09-10)
For
realSize=1, vectorizing across positions leaves only one active lane and performs repeated strided loads and output read/modify/write operations. Reduce contiguous channels in registers instead, preserving inactive accumulator lanes on the final tail and reducing once at the end. The C4 runtime layout is unchanged.On native RVV VLEN=128 (GCC 14.3.1), six independent alternating-order runs measured:
Across 60 shapes, no >5% slowdown against the previous PR kernel; all median speedups against the registered scalar baseline exceed 1 (minimum 1.36x). Scalar timings vary substantially; previous/new RVV timings are stable. These are kernel measurements, not model throughput claims.
Validation for this update:
op/convolution/weighti8i4conv2dINT4 async case fails with the same error in previous AbsMax, repaired AbsMax, and existing RVV baseline, with both 1 and 4 threads. The convolution group has 5 passes and 1 failure in each thread setting. This update does not claim a fully passing regression suite.Standalone reproduction:
test/backend/cpu/RVVAbsMaxTest.md.Module
CPU/RVV
Type
Checklist
[Module:Type] Descriptionformat