Skip to content

x86 groupnorm instancenorm support bf16 storage with avx512bf16 dispatch#6594

Merged
nihui merged 4 commits intoTencent:masterfrom
nihui:in-gn-x86-bf16
Mar 10, 2026
Merged

x86 groupnorm instancenorm support bf16 storage with avx512bf16 dispatch#6594
nihui merged 4 commits intoTencent:masterfrom
nihui:in-gn-x86-bf16

Conversation

@nihui
Copy link
Copy Markdown
Member

@nihui nihui commented Mar 10, 2026

No description provided.

@github-actions github-actions bot added the x86 label Mar 10, 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 sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 10, 2026

Codecov Report

❌ Patch coverage is 98.44720% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.29%. Comparing base (cba96a6) to head (cbec927).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/layer/x86/groupnorm_bf16s.h 97.41% 4 Missing ⚠️
src/layer/x86/groupnorm_x86.cpp 97.77% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #6594    +/-   ##
========================================
  Coverage   93.29%   93.29%            
========================================
  Files         852      856     +4     
  Lines      271477   271866   +389     
========================================
+ Hits       253266   253636   +370     
- Misses      18211    18230    +19     

☔ 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

This PR adds bfloat16 (bf16) storage execution paths for the x86 InstanceNorm and GroupNorm layers, including AVX512BF16 runtime dispatch plumbing consistent with existing x86 bf16 patterns in the repo.

Changes:

  • Enable support_bf16_storage for InstanceNorm_x86 and GroupNorm_x86 and route forward_inplace() to bf16 implementations when opt.use_bf16_storage is enabled.
  • Add bf16 kernels for InstanceNorm/GroupNorm (*_bf16s.h) using SSE/AVX/AVX512 code paths with scalar fallbacks.
  • Add AVX512BF16 runtime-dispatch entrypoints (*_x86_avx512bf16.cpp) to allow calling a BF16-flag-compiled implementation when supported at runtime.

Reviewed changes

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

Show a summary per file
File Description
src/layer/x86/instancenorm_x86_avx512bf16.cpp Adds AVX512BF16 runtime-dispatch target symbol for InstanceNorm bf16 kernel.
src/layer/x86/instancenorm_x86.h Declares InstanceNorm_x86() and bf16 forward helper.
src/layer/x86/instancenorm_x86.cpp Enables bf16 storage support + implements bf16 inplace forward using new helper kernels.
src/layer/x86/instancenorm_bf16s.h Adds bf16 mean/var + affine transform kernel with AVX512BF16 runtime dispatch hook.
src/layer/x86/groupnorm_x86_avx512bf16.cpp Adds AVX512BF16 runtime-dispatch target symbol for GroupNorm bf16 kernel.
src/layer/x86/groupnorm_x86.h Declares bf16 forward helper for GroupNorm.
src/layer/x86/groupnorm_x86.cpp Enables bf16 storage support + implements bf16 inplace forward (including packing handling).
src/layer/x86/groupnorm_bf16s.h Adds bf16 GroupNorm kernel with AVX512BF16 runtime dispatch hook.

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

@nihui nihui merged commit de50bea into Tencent:master Mar 10, 2026
80 of 82 checks passed
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