fix(moe): realign mixed Trellis with QSRT ABI - #137
Open
voipmonitor wants to merge 1 commit into
Open
Conversation
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe PR updates W4A16 pair execution, mixed Trellis LUT ABI handling, MCG codebook selection, and AST-based ABI contract tests. ChangesMixed Trellis and W4A16 pipeline
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant MixedTrellisDispatch
participant SharedMoEBody
participant W4A16GemmKernel
participant MCGDecoder
MixedTrellisDispatch->>SharedMoEBody: pass zero LUT ABI values
SharedMoEBody->>W4A16GemmKernel: dispatch paired or non-paired tiles
W4A16GemmKernel->>MCGDecoder: decode Trellis data through MCG hooks
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
35 tasks
brandonmmusic-max
added a commit
to brandonmmusic-max/b12x
that referenced
this pull request
Aug 9, 2026
R7 encoders choose K independently per (expert, projection). The mixed path tiers per expert -- one trellis_bits per tier for FC1 and FC2, a single-row descriptor -- so an expert that is K3-gate/K4-down cannot be expressed. - descriptor_map becomes int32[3 * stride], rows gate/up/down, same (tier << 8) | local encoding. Dispatch resolves the row per projection: FC2 at compile time, FC1 by N-half from output_n_tile, which trellis3_t256_proj keeps projection-aligned. - FC1 and FC2 expert counts may differ per tier. The FC2 count is derived from the W2 payload extent and carried through bounds, W2/global-scale logical layouts, compile arguments, and launches, so both phases keep real bounds and truthful CuTe extents. ABI_VERSION 6 -> 7. - build_tiered_maps() keeps its signature and repeats its single row three times, so existing per-expert mixed checkpoints resolve bit-identically. - New validated public builder build_projection_tiered_maps(); slot arity, range, disjointness and per-tier capacity are enforced. Based on the canonical r33 composition (master 9bbae67 + local-inference-lab#125, local-inference-lab#126, local-inference-lab#133, local-inference-lab#135, local-inference-lab#136, local-inference-lab#137), verified byte-identical to the r33 image kernel tree before these changes. CPU contract tests added; suite parity confirmed against the unmodified base (same 9 pre-existing GPU-dependent failures, 8 additional tests passing). Ruff clean. Co-Authored-By: Claude Opus 5 <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.
Summary
Root cause
masterat9bbae67changed several shared W4A16 signatures without updating the existing mixed K3/K4 direct calls. Arguments shifted position, soactive_mreceived a callable and compilation failed withfunctools.partial * Int32. The forced GLM FC2 tile was also rejected by the generic tile floor despite having a valid e4m3-k32 geometry.This PR is deliberately narrower than #129: it restores the already-supported MCG mixed path on current
master; it does not adopt the broader Fruit/SQG serving feature. If #129 is rebased, it should preserve or supersede these ABI regression contracts explicitly.Validation
master:tests/moe/test_w4a16_mixed_trellis.py-> 10 failed, 5 passed.git diff --check: pass.Summary by CodeRabbit
Bug Fixes
Tests