Repository navigation
[RISC-V] Vectorize col2im accumulation in convolution backward - #13
Open
ww8191201-coder wants to merge 3 commits into
Open
ww8191201-coder wants to merge 3 commits into
ww8191201-coder wants to merge 3 commits into
Conversation
Co-authored-by: Yang Wang <yangwang@iscas.ac.cn> Co-authored-by: Yuansheng <yuansheng@isrc.iscas.ac.cn>
This reverts commit ae89f72.
Co-authored-by: Yang Wang <yangwang@iscas.ac.cn> Co-authored-by: Yuansheng <yuansheng@isrc.iscas.ac.cn>
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.
[RISC-V] Vectorize col2im accumulation in convolution backward
Motivation
CPU convolution backward-data uses
col2imto accumulate columns back into the input-gradient tensor. The inner loop performs a bounds check and scalar addition for every output column. For a fixed kernel position, the in-bounds columns form one contiguous interval, which allows the padding work to be skipped and the accumulation to be vectorized on RVV systems.Implementation
col2imloop.dst += src; use unit-stride loads and stores where possible and strided accesses when required by the destination layout.im2coloptimization.Testing
The patch was tested against commit
b84609d3fc73d20929c114eab95faaa56e6c5edeon a RISC-V host with eight SpacemiT A100 cores (CPUs 0-7), GCC 14.3.0, and Linux 6.18.3.Apply and build:
The full build completed successfully. Functional operator tests were not run as part of this performance-validation pass; the results below are performance measurements, not a numerical-correctness claim.
The benchmark used MXNet's
benchmark.opperf.utils.benchmark_utils.run_performance_testwith the native profiler, float32 CPU tensors, 50 warm-up iterations, and 300 measured iterations. Backward execution was enabled. Each result below is from an independent invocation withOMP_NUM_THREADS=8,OMP_DYNAMIC=FALSE, andtaskset -c 0-7.Performance
Lower is better.
git apply patch-opt.diffThe median latency is reduced by 25.70%, corresponding to a 1.35x speedup. The patched run-to-run range was 1.18% of its median.