fix(hlo): GroupNorm emits real stablehlo.reduce (IREE-compilable) - #754
Merged
Merged
Conversation
The 0.32.0 GroupNorm converter lowered mean/variance with `stablehlo.custom_call @reduce_mean` / `@reduce_variance` (mirroring the LayerNorm style). Those custom_calls are opaque to stock `iree-compile`, so a groupNorm module exported fine but failed to compile on IREE — caught by the downstream skainet-iree-conformance harness (groupnorm:compile). Emit real `stablehlo.reduce` (add region) + divide instead, computing variance as E[x^2] - E[x]^2 (population, ddof=0) — exactly as the standalone `sum`/`mean`/`variance` converters already do. The module now compiles on llvm-cpu and runs. Verified end-to-end via the conformance harness against this source build: iree-compile + iree-run-module + numpy validate -> PASS, max_abs_err=1.2e-7. GroupNormConverterTest updated to assert real `stablehlo.reduce` and the absence of any `custom_call`. (LayerNorm/RMSNorm still use the @reduce_* custom_calls; making them IREE-compilable the same way is a follow-up.) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 23, 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.
Bug
The GroupNorm converter shipped in 0.32.0 (#752) lowered mean/variance with
stablehlo.custom_call @reduce_mean/@reduce_variance(copied from the LayerNorm style). Those custom_calls are opaque to stockiree-compile— so agroupNormmodule exports cleanly but fails to compile on IREE.This was caught by the downstream
skainet-iree-conformanceharness, which wired agroupnormop into its IREE pipeline and gotGATE FAIL: groupnorm:compile.Fix
Emit real
stablehlo.reduce(add region) +divide, computing variance asE[x²] − E[x]²(population, ddof=0) — exactly as the standalonesum/mean/varianceconverters already do. Nocustom_callin the output.Verified end-to-end
Against this source build, through the conformance harness (
iree-compile+iree-run-module+ numpyallclose):GroupNormConverterTestupdated to assert realstablehlo.reduce(and the absence of anycustom_call; fullskainet-compile-hlojvmTest suite passes.Follow-up
LayerNorm/RMSNorm still emit the⚠️ status downstream). Giving them the same real-
@reduce_*custom_calls (they're not exercised on IREE in-tree, hence theirreducetreatment would make them IREE-compilable too — left as a separate change.Targets a 0.32.1 patch release.
🤖 Generated with Claude Code