Skip to content

support mips elu erf gelu selu#6607

Merged
nihui merged 2 commits intoTencent:masterfrom
futz12:some-activation-opt-on-mips
Mar 18, 2026
Merged

support mips elu erf gelu selu#6607
nihui merged 2 commits intoTencent:masterfrom
futz12:some-activation-opt-on-mips

Conversation

@futz12
Copy link
Copy Markdown
Contributor

@futz12 futz12 commented Mar 17, 2026

No description provided.

@github-actions github-actions bot added the mips label Mar 17, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.64%. Comparing base (7237643) to head (91c3405).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6607      +/-   ##
==========================================
- Coverage   93.41%   92.64%   -0.78%     
==========================================
  Files         868      873       +5     
  Lines      275540   273876    -1664     
==========================================
- Hits       257391   253726    -3665     
- Misses      18149    20150    +2001     

☔ 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
Copy Markdown
Contributor

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

Adds MIPS (MSA-accelerated) implementations for several activation/unary layers to improve performance on MIPS targets, including vectorized erf support needed by GELU.

Changes:

  • Introduces new MIPS layer implementations: ELU, SELU, GELU, and Erf (with MSA vector paths + scalar fallback).
  • Extends MSA math utilities with a vectorized erf_ps() approximation used by GELU/Erf.
  • Adds an MSA helper elu_ps() to the shared MIPS activation utilities.

Reviewed changes

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

Show a summary per file
File Description
src/layer/mips/selu_mips.h Declares SELU_mips layer class for MIPS backend.
src/layer/mips/selu_mips.cpp Implements SELU forward with optional MSA vectorization and packing support.
src/layer/mips/gelu_mips.h Declares GELU_mips layer class for MIPS backend.
src/layer/mips/gelu_mips.cpp Implements GELU forward (fast + exact modes) with optional MSA vectorization.
src/layer/mips/erf_mips.h Declares Erf_mips layer class for MIPS backend.
src/layer/mips/erf_mips.cpp Implements Erf forward with optional MSA vectorization using erf_ps.
src/layer/mips/elu_mips.h Declares ELU_mips layer class for MIPS backend.
src/layer/mips/elu_mips.cpp Implements ELU forward with optional MSA vectorization using elu_ps.
src/layer/mips/msa_mathfun.h Adds MSA vector erf_ps() and supporting constants.
src/layer/mips/mips_activation.h Adds MSA helper elu_ps() for reuse in ELU and potentially other codepaths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nihui nihui merged commit 939f24f into Tencent:master Mar 18, 2026
47 of 48 checks passed
@nihui
Copy link
Copy Markdown
Member

nihui commented Mar 18, 2026

Thanks for your contribution !

chenglimin pushed a commit to chenglimin/ncnn that referenced this pull request Apr 1, 2026
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