Skip to content

Add bias_riscv #6025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Apr 27, 2025
Merged

Add bias_riscv #6025

merged 21 commits into from
Apr 27, 2025

Conversation

AtomAlpaca
Copy link
Contributor

添加 bias 的 riscv 优化

@github-actions github-actions bot added the riscv label Apr 27, 2025
@codecov-commenter
Copy link

codecov-commenter commented Apr 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.64%. Comparing base (c9caafd) to head (71f9bc7).
Report is 2 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #6025       +/-   ##
===========================================
+ Coverage   94.69%   95.64%    +0.94%     
===========================================
  Files         769      414      -355     
  Lines      238897   111121   -127776     
===========================================
- Hits       226227   106280   -119947     
+ Misses      12670     4841     -7829     

☔ 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.

Copy link

The binary size change of libncnn.so (bytes)

architecture base size pr size difference
x86_64 16465128 16465128 0 😘
armhf 7335260 7335260 0 😘
aarch64 10704800 10704800 0 😘

@nihui nihui requested a review from Copilot April 27, 2025 07:38
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a RISC-V optimized implementation for applying bias in neural network layers, targeting improved performance with FP16 support. Key changes include:

  • Addition of a new source file (bias_riscv_zfh.cpp) implementing vectorized FP16 bias application using RISC-V intrinsics.
  • Extension of the Bias_riscv class in the header (bias_riscv.h) to declare the FP16-specific function.
  • Update of the Bias_riscv implementation (bias_riscv.cpp) to use the new FP16 vectorized function when appropriate.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/layer/riscv/bias_riscv_zfh.cpp New FP16 vectorized bias addition implementation using __riscv_zvfh intrinsics with a fallback scalar loop.
src/layer/riscv/bias_riscv.h Declaration of the new forward_inplace_fp16s function within the Bias_riscv class.
src/layer/riscv/bias_riscv.cpp Modifications to invoke the FP16 optimized function based on runtime conditions.

@nihui nihui merged commit cdaa54a into Tencent:master Apr 27, 2025
25 of 30 checks passed
@nihui
Copy link
Member

nihui commented Apr 27, 2025

Thanks for your contribution !

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.

3 participants