[MoonEP] Harden BF16 reference adapter contracts and validation - #19
Open
charliechenye wants to merge 11 commits into
Open
charliechenye wants to merge 11 commits into
charliechenye wants to merge 11 commits into
Conversation
wirybeaver
force-pushed
the
sg-moonep-upstream-draft-20260802
branch
from
August 14, 2026 14:37
7b0cdf6 to
ffdf6f9
Compare
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.
This stacks directly on
sg-moonep-upstream-draft-20260802and keeps the scope intentionally narrow: harden the current BF16/unquantized MoonEP reference adapter before moving on to Kimi-K3 SiTU, MXFP4, optimized expert compute, or model-level A2A integration.What this fixes
1. Enforce the BF16 reference weight contract
[Gate, Up]expert storage and reject transformed Triton / FlashInfer TRTLLM layouts and CUTLASS[Up, Gate]loading order.FusedMoE.weight_loader()regression with distinguishable Gate/Up checkpoint values.2. Use MoonEP physical VM-group rows for reference compute
The original PoC mapped prefetched physical group
E+bback throughplan.experts_to_copy[b]and computed from source rowe.MoonEP's actual contract is:
physical group g -> physical weight row gFor a prefetched expert,
experts_to_copy[b]tellsprefetch_weightwhich source expert to copy into physical slotE+b; it is not a compute-row mapping.This stack:
expert_ids/ rank-remapping layerThe validation now verifies the prefetched slot, poisons the original source row after prefetch, runs the real physical-row compute + combine path, and compares the final result against an independent logical top-k PyTorch reference.
3. Make MoonEP communication resources lifecycle-safe
destroy()fails so cleanup can be retried.4. Reject unsupported runtime mutation and overlap
SGLANG_DEEPEP_BF16_DISPATCHto DeepEP only so DeepEP-specific fallback policy cannot silently divert MoonEP.Why this is stacked separately
I kept this as four reviewable commits rather than folding all of the hardening directly into the original draft.
The commits separate four concerns:
Validation status
This remains a narrow BF16 reference-adapter PoC.
It does not yet claim production Kimi-K3 support. SiTU, K3 model-level
_ep_a2a, MXFP4, optimized expert compute, and production symmetric expert residency remain follow-up work.CI States
Latest PR Test (Base): ❌ Run #31779992496
Latest PR Test (Extra): ❌ Run #31779992393