moe: mxfp_moe gemm1 fp4 A-LDS read -> crd2idx (fp8 kept manual) - #929
Draft
coderfeli wants to merge 1 commit into
Draft
moe: mxfp_moe gemm1 fp4 A-LDS read -> crd2idx (fp8 kept manual)#929coderfeli wants to merge 1 commit into
coderfeli wants to merge 1 commit into
Conversation
fp4 read swizzle -> crd2idx over composed SwizzleType(3,0,4); bit-identical to the manual XOR and perf-neutral (-0.1% median-of-15 on gfx950). fp8 (a8w4) read stays manual: crd2idx is bit-identical but ~10% slower (measured, median-of-15) from hot-loop instruction scheduling despite equal-or-leaner static ISA. Cold fp4 cos passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
coderfeli
marked this pull request as draft
July 30, 2026 09:22
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.
Summary
Follow-up to #913. Ports the fp4 mxfp_moe gemm1 A-LDS read swizzle from the manual XOR to the
crd2idxlayout form (reusing_a_lds_swz_block_layout/_a_lds_swz_block_idxlanded in #913), matching gemm2. fp8 (a8w4) is intentionally kept on the manual XOR.Why fp4 only (measured, not inferred)
Rigorous median-of-15 on gfx950 (interleaved A/B, order-reversed, cache off, 7168×2048 t8192 e32 k8):
Both forms are bit-for-bit identical to the manual index (verified exhaustively; fp8 uses the split-16@64 reuse of the 8-block helper). The fp8 crd2idx form has equal-or-leaner static ISA (fewer instrs, 148<152 VGPR, no spills) yet is reproducibly ~10% slower — pure hot-loop instruction-scheduling sensitivity, non-overlapping across all 15 paired rounds. So fp8 stays manual.
Cold fp4 cos passes (
✓ Check passed, Logits Diff 0.911). black + ruff clean.🤖 Generated with Claude Code