Skip to content

add riscv rvv support for lstm operator#6736

Open
chenglimin wants to merge 14 commits into
Tencent:masterfrom
chenglimin:patch-lstm
Open

add riscv rvv support for lstm operator#6736
chenglimin wants to merge 14 commits into
Tencent:masterfrom
chenglimin:patch-lstm

Conversation

@chenglimin
Copy link
Copy Markdown
Contributor

all test cases passed on musepi and k230.

@github-actions github-actions Bot added the riscv label May 22, 2026
@tencent-adm
Copy link
Copy Markdown
Member

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ chenglimin
❌ nihui
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +23 to +26
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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@nihui nihui closed this May 22, 2026
@nihui nihui reopened this May 22, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.26%. Comparing base (1b847b1) to head (4486cf9).
⚠️ Report is 118 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (1b847b1) and HEAD (4486cf9). Click for more details.

HEAD has 30 uploads less than BASE
Flag BASE (1b847b1) HEAD (4486cf9)
32 2
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants