feat(hlo): add GroupNorm StableHLO converter - #752
Merged
Merged
Conversation
GroupNorm had no converter — a `groupNorm` node fell through to the
"Operation not supported" path. Add `convertGroupNorm` to
NeuralNetOperationsConverter, register the op names in `supportedOperations`
and the dispatch `when`, mirroring the existing LayerNorm/RMSNorm decomposition
(no custom_call stub):
xg = reshape(x, [N, G, M]) # M = (C/G) * prod(spatial)
out = (xg - mean(xg)) / sqrt(var(xg) + eps) # reduce over the trailing axis
out = reshape(out, [N, C, *spatial]) * scale + offset # affine optional
Per-group stats reuse the @reduce_mean / @reduce_variance custom_calls (as
LayerNorm does) by collapsing each group's channels+spatial into one axis;
scale/offset (shape C) broadcast over the channel dim only.
Adds GroupNormConverterTest (structural, mirrors LayerNormConverterTest);
full skainet-compile-hlo jvmTest suite passes.
Refs #751
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 22, 2026
MacOS
pushed a commit
to MacOS/SKaiNET
that referenced
this pull request
Jul 10, 2026
Patch release. Bumps VERSION_NAME 0.31.2 -> 0.32.1 and brings the release metadata current: develop never received the 0.32.0 release back-merge (PR SKaiNET-developers#753 was tagged + published but blocked from merging), so this consolidates the 0.32.0 AND 0.32.1 CHANGELOG / README "What's New" entries (supersedes SKaiNET-developers#753). 0.32.1 fix: GroupNorm now emits real stablehlo.reduce instead of @reduce_mean/@reduce_variance custom_calls, so a groupNorm module compiles on stock iree-compile. Verified end-to-end via skainet-iree-conformance: PASS max_abs_err=1.2e-7. (PR SKaiNET-developers#754) 0.32.0 (folded in): GroupNorm StableHLO converter (SKaiNET-developers#752), SKEEP proposals docs (SKaiNET-developers#750), quantization-process doc (SKaiNET-developers#747), dependency bumps. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Why
groupNormhad no converter — agroupNormnode fell throughNeuralNetOperationsConverterto the "Operation not supported" path and never lowered to StableHLO. It's one of the gaps tracked in #751 (left over after #666 closed).What
Add
convertGroupNormmirroring the existing LayerNorm/RMSNorm decomposition (nocustom_callstub):@reduce_mean/@reduce_variancecustom_calls (exactly as LayerNorm does) by collapsing each group's channels + spatial into one trailing axis.scale/offset(shapeC) broadcast over the channel dim (dims=[1]) only.groupNorm/groupNormalization/GroupNormalization/group_norm) insupportedOperationsand the dispatchwhen.Emitted MLIR for
(N=1,C=4,H=2,W=2),num_groups=2:Tests
Adds
GroupNormConverterTest(structural, mirrorsLayerNormConverterTest): asserts the real reshape + reductions + broadcast + sqrt + divide + affine, and that it never hits the stub / unsupported path. The fullskainet-compile-hlojvmTestsuite passes locally ondevelop.Notes / follow-ups (per #751)
skainet-iree-conformanceharness.upsample/interpolateandRoPEremain — tracked in StableHLO converter: missing ops RoPE, groupNorm, upsample/interpolate (gaps remaining after #666) #751.Closes part of #751.