add riscv rvv support for lstm operator#6736
Conversation
… speedup over scaler implementation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c76a349eae
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| static inline float dot_product(const float* a, const float* b, int n) | ||
| { | ||
| size_t max_vl = __riscv_vsetvlmax_e32m8(); | ||
| vfloat32m8_t sum_v = __riscv_vfmv_v_f_f32m8(0.f, max_vl); |
There was a problem hiding this comment.
Add non-RVV fallback for LSTM_riscv implementation
lstm_riscv.cpp unconditionally uses RVV intrinsics (__riscv_vsetvl*, vfloat32m8_t, etc.) without any #if __riscv_vector guard, so generic RISC-V builds that compile baseline sources with -march=rv64gc (the default in toolchains/riscv64-linux-gnu.toolchain.cmake) fail to compile this layer. In this repo, cmake/ncnn_add_layer.cmake always adds src/layer/riscv/lstm_riscv.cpp for RISC-V and only generates a separate _rvv variant for vector builds, so the base file must either provide a scalar path or delegate to LSTM::forward when __riscv_vector is unavailable.
Useful? React with 👍 / 👎.
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## master #6736 +/- ##
===========================================
- Coverage 93.16% 87.26% -5.91%
===========================================
Files 847 350 -497
Lines 266225 121443 -144782
===========================================
- Hits 248040 105974 -142066
+ Misses 18185 15469 -2716 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
all test cases passed on musepi and k230.