cpu: rv64: postops: add rvv postops eltwise op support #4281
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 PR adds eltwise operation support for
rvv_postops.hppusing a primitive-based approach according to previous proposal #4029.Motivation
Following the successful integration of primitive-based
binarypost-ops intorvv_postops.hpp, our next step is to introduceeltwisetype post-ops using the same primitive-based paradigm. This is crucial for establishing a generalpost_opsimplementation for the RISC-V 64-bit architecture at this early stage.Key Changes
eltwisetype of post-ops by integrating withrvv_eltwiseininitandexecutemethods.post_ops_okandapplymethods unchanged in a fused way, making other implementation used original version still correct.post_ops_okandapplymethods for other future implementations.reluwithoutalpha/beta(via original methods)eltwiseoperations thervv_eltwisesupported:reluwithalpha/beta,square,abs,sqrt,linear,clip,hardsigmoid, andhardswish.binaryoperations:add,div,max,min,mul,sub,ge,gt,le,lt,eq,ne, and the ternaryselect.rvv_nchw_poolingFuture Plans (on-going)
rvv_matmulin this primitive-based approach.rvv_gemm_convolutionin this primitive-based approach.post_ops_okandapplymethods safely.sumoperationsChecklist
General
Do all unit and benchdnn tests (
make testandmake test_benchdnn_*) pass locally for each commit?Have you formatted the code using clang-format?
test_postops_eltwise_ctest.log
Performance improvements
We test the changes using the RISC-V GNU toolchain(14.2) and verify the functionality under the sg2044 platform with cmd:
All tests passed with proper dispatching confirmed.
Before the changes: test_postops_without_eltwise.log
After the changes: test_postops_with_eltwise.log