[MoonEP] Fix BF16 physical row semantics and unsupported config checks - #36133
Open
charliechenye wants to merge 3 commits into
Open
charliechenye wants to merge 3 commits into
charliechenye wants to merge 3 commits into
Conversation
charliechenye
requested review from
BBuf,
Edwardf0t1,
Fridge003,
HaiShaw,
Ying1123,
ch-wan,
ispobock and
merrymercy
as code owners
August 24, 2026 03:54
21 tasks
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
Part of #35783.
The MoonEP BF16 reference path added in #33249 currently conflates physical MoonEP VM groups with logical expert identities in the expert runner. For prefetched experts, MoonEP copies a logical source expert into a physical prefetch slot
E + b, so the BF16 runner should execute that physical slot directly rather than remapping it back to the logical source row.This PR tightens that correctness boundary and makes unsupported configurations fail early. It also removes the silent rank 0 fallback when resolving logical expert metadata.
This is intentionally a narrow correctness and support-contract change. It does not add MXFP4/DeepGEMM support, asynchronous overlap, CUDA graph support, lifecycle handling, or observability.
Modifications
Separate physical VM group rows from logical expert identities:
group_iddirectly to index Gate, Up, and Down weightscu_seqlensMoonEPDispatchOutput.expert_idsremains logical metadata for downstream consumers such as the DeepGEMM path in [MoonEP] MXFP4 experts for Kimi K3 on the DeepGEMM runner in symmetric memory #34874Remove the silent rank 0 fallback:
dist.get_rank(group=self.group)directlyReject unsupported expert bias:
FusedMoEis constructed withwith_bias=TrueReject unsupported overlap modes:
Add focused unit coverage for:
This PR intentionally does not change padded-route accounting. Excluding padded rows only from
tokens_per_expertwhile still passing the static padded top-k tensor would make MoonEP's planner inputs inconsistent. A correct solution requires an explicit MoonEP planner/API contract for inactive static rows.Accuracy Tests
Focused Linux unit tests pass:
Result:
The physical VM-row regression specifically covers a prefetched physical group whose logical expert ID differs from its physical weight row, and verifies that the BF16 runner uses the physical row.
Additional checks passed:
The BF16 integration in #33249 was previously validated on 8x H100 SXM with zero numerical error.
Distributed MoonEP validation has not yet been rerun after the physical-row correction in this PR. In particular, the stronger dispatch -> remote prefetch -> physical-slot compute -> combine validation for this change is still pending.
Speed Tests and Profiling
Not run.
This PR is a correctness and support-contract change and does not intentionally change the MoonEP communication algorithm or add a new optimized kernel path. No performance improvement is claimed.
MoonEP performance benchmarking against DeepEP is tracked separately in #35783.
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ci(https://docs.sglang.io/developer_guide/contribution_guide.html#write-documentations).
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Missing
run-cilabel -- add it to run CI tests.Latest PR Test (Extra): ❌ Blocked --
run-ciis required first.Latest PR Test (AMD ROCm 7.2): ➖ No AMD PR run found for this commit.