Repository navigation
[diffusion] perf: fuse MiniMax-H3's RMSNorm and indexed AdaLN under quality lossless - #43327
Merged
Merged
Conversation
…uality lossless Co-Authored-By: Claude Opus 5.5 <[email protected]>
mickqian
requested review from
AgainstEntropy,
BBuf,
HaiShaw,
kevin-mii,
niehen6174,
ping1jing2 and
yichiche
as code owners
October 9, 2026 07:45
mickqian
requested review from
JustinTong0323,
sogalin,
wisclmy0611 and
zijiexia
as code owners
October 9, 2026 07:45
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
This was referenced Oct 9, 2026
This was referenced Oct 11, 2026
This branch was successfully deployed
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.
Motivation
Each MiniMax-H3 DiT block normalizes its residual stream twice, before attention and before the MLP. Each time it runs two memory-bound kernels:
nn.RMSNorm, then the indexed AdaLN modulationx * (1 + scale[idx]) + shift[idx]. That is one full read and write of the[tokens, 5376]activations more than the math needs, and the chain rounds to BF16 after the norm and again after each modulation op.A fused RMSNorm + AdaLN kernel was removed from this path before, because it drifted the 2-GPU consistency goldens. That drift is exactly what the
losslesstier allows: same math and operand precision, only the rounding moves. So this PR brings the fusion back under the quality gate.exactand every CI golden keep the reference chain.Modifications
rmsnorm_indexed_scale_shift(Triton): computesrmsnorm(x) * (1 + scale[idx]) + shift[idx]in one FP32 pass with a single rounding. It reads the AdaLN tables per row by index, so they are never materialized per token.QualityGatedFusionsite "MiniMax-H3 fused RMSNorm + AdaLN", registered at tierlosslessin_QUALITY_FUSION_HANDLERS. Every DiT block marks it, and both modulate sites use the fused kernel while it is mounted.quality="lossless"(the default) and"high"mount it."exact"unmounts it and keepsnn.RMSNormplusindexed_scale_shift_bf16_bit for bit.losslesschanges in the denoise path.Accuracy Tests
test/registered/kernels/ops/diffusion/test_rmsnorm_indexed_scale_shift.py(new): checks the kernel against the same math in FP32 with one rounding, and against the reference rounding chain, at widths 1024 and 5376 and 1/37/1025 rows.No H3 CI golden moves. Every MiniMax-H3 consistency case pins
quality="exact", astestcase_configs.pydoes for any case that names no level.End to end, with the fusion against without it (both at the default level, same seed, 4×H200), the outputs are not pixel-close. Neither are two
exactruns that split the work differently: H3's 50-step trajectory turns rounding differences into a different sample.exactat Ulysses 2 vsexactat Ulysses 4Side by side, the frames show the same scene, subject and quality, with different camera framing and details. At Ulysses 4 the shot is closer and the shirt differs, as it also does between the two
exacttopologies. Both runs of every arm are md5-identical, so the fused path is deterministic.Speed Tests and Profiling
Kernel, H200, D=5376. For scale, H3's rows per rank are 24826 for Ref2VA at Ulysses 2, 18871 for T2VA at Ulysses 2 and 9436 at Ulysses 4.
nn.RMSNorm+indexed_scale_shift_bf16_End to end, client latency, 4×H200, 50 steps,
--performance-mode speed, default quality. The arms ran ABBA on one box (without, with, with, without), on top of the Ulysses copy-engine pipeline (#43164):Each cell is the two runs of an arm. The two arms differ only by this PR.
Checklist
🤖 Generated with Claude Code
CI States
Latest PR Test (Base): 🚫 Run #37900840565
Latest PR Test (Extra): ❌ Run #37900840101
Latest PR Test (AMD ROCm 10): ⏳ Run #37900840445