Repository navigation
Add AVX512BF16 bf16_f32 igemm micro-kernels - #11946
Open
JakeStevens wants to merge 4 commits into
Open
JakeStevens wants to merge 4 commits into
JakeStevens wants to merge 4 commits into
Conversation
JakeStevens
force-pushed
the
bf16-conv-4
branch
from
November 23, 2026 16:57
185ed13 to
842d8fc
Compare
Adds bf16 x bf16 -> fp32 scalar depthwise and c2 igemm micro-kernels, their
weight packers and micro-kernel tests, as the base for a native bf16
convolution. The scalar micro-kernels are reference implementations that test
the packers and aren't dispatched; the SIMD micro-kernels and the operator
follow in separate changes.
bf16-f32-dwconv-minmax-test # Apple M4 Max: [ PASSED ] 60 tests.
bf16-f32-igemm-minmax-test # Apple M4 Max: [ PASSED ] 52 tests.
Adds xnn_{create,reshape,setup}_convolution2d_nhwc_bf16_f32 and lets
xnn_define_{depthwise_,}convolution_2d accept bf16 inputs and filters, which
they previously rejected with xnn_status_unsupported_parameter (e.g. the
causal conv1d in Qwen3.5). The bf16 fallback keeps a convolution native, with
an fp32 output, when a bf16_f32 micro-kernel is available on a CPU with
hardware bf16 other than Apple's and its bias is absent or fp32. No configs
have micro-kernels yet, so for now bf16 convolutions run through the existing
fp32 rewrite. Also adds bf16_f32 operator tests (skipped until a config has
micro-kernels), BF16Convolution and BF16DepthwiseSeparable subgraph
benchmarks, and the CMake target for the existing subgraph convolution
benchmark.
convolution-2d-test # Apple M4 Max: [ PASSED ] 30 tests.
depthwise-convolution-2d-test # Apple M4 Max: [ PASSED ] 25 tests.
convolution-nhwc-test # Apple M4 Max: [ PASSED ] 911 tests (bf16_f32 skipped).
Adds widen-and-FMA AVX512SKX bf16_f32 depthwise micro-kernels. The subgraph uses them for depthwise bf16 convolutions on CPUs with AVX512BF16; the operator API uses them on any AVX512SKX CPU. Genoa, 1 thread pinned, batch 1, subgraph-depthwise-separable-bench BF16DepthwiseSeparable, median of 5; the fp32 fallback is the parent commit. The pointwise convolution runs in fp32 either way, because its input is the depthwise convolution's fp32 output: | shape (W=H, CI->CO, 3x3) | fp32 fallback | native | speedup | peak memory | |---|---:|---:|---:|---| | 112, 32->16 | 296 us | 267 us | 1.11x | 3.4 -> 2.6 MiB | | 14, 576->160 | 182 us | 177 us | 1.03x | 1.5 -> 1.2 MiB | | 7, 960->320 | 113 us | 103 us | 1.09x | 2.7 -> 2.5 MiB | bf16-f32-dwconv-minmax-test passed on the Genoa (GCC 15) before these changes were split up. At this commit an x86-64 build runs under Rosetta on an Apple M4, where the AVX512SKX tests are skipped and the rest pass.
Adds VDPBF16PS c2 bf16_f32 igemm micro-kernels (1-8 x 16/32) and uses 7x32 and 1x32 for bf16 convolutions on CPUs with AVX512BF16. Genoa, 1 thread pinned, batch 1, subgraph-convolution-bench BF16Convolution, median of 5; the fp32 fallback is the parent commit: | shape (W=H, CI->CO, 3x3) | fp32 fallback | native | speedup | peak memory | |---|---:|---:|---:|---| | 112, 32->16 | 860 us | 643 us | 1.34x | 3.2 -> 1.6 MiB | | 56, 96->24 | 1195 us | 461 us | 2.59x | 1.8 -> 0.6 MiB | | 14, 576->160 | 1344 us | 685 us | 1.96x | 6.9 -> 1.7 MiB | | 7, 960->320 | 885 us | 434 us | 2.04x | 21.3 -> 5.3 MiB | bf16-f32-igemm-minmax-test passed on the Genoa (GCC 15) before these changes were split up. At this commit an x86-64 build runs under Rosetta on an Apple M4, where the AVX512 tests are skipped and the rest pass.
JakeStevens
force-pushed
the
bf16-conv-4
branch
from
November 24, 2026 15:16
842d8fc to
ae1523f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds VDPBF16PS c2 bf16_f32 igemm micro-kernels (1-8 x 16/32) and uses 7x32
and 1x32 for bf16 convolutions on CPUs with AVX512BF16.
Genoa, 1 thread pinned, batch 1, subgraph-convolution-bench BF16Convolution,
median of 5; the fp32 fallback is the parent commit:
Stacked on #11945; only the last commit is new.
Authored with Claude Code.