Conversation
Capture logical routed expert IDs at the shared DeepSeek V4 MegaMoE expert boundary before EPLB remapping. This also covers Kimi K3, whose MegaMoE experts inherit the same implementation.\n\nCo-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: aoshen02 <aoshen@inferact.ai>
Move logical-ID capture and EPLB mapping into the shared DeepGEMM MegaMoE helper used by both DeepSeek V4 and Kimi K3. Reuse the existing capture callback naming and consolidate the regression test.\n\nCo-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: aoshen02 <aoshen@inferact.ai>
Assign capture callbacks directly and preserve each model's existing inline EPLB path. This leaves only one guarded callback in each MegaMoE forward when routed-expert capture is disabled.\n\nCo-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: aoshen02 <aoshen@inferact.ai>
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
Add routed-experts (R3) capture support to the
deep_gemm_mega_moepath used by DeepSeek-V4 and Kimi-K3.Why
The existing binder only recognizes MoE layers implemented through
MoERunner. DeepGEMM MegaMoE bypasses that runner, even though its shared expert implementation already receives logicaltopk_idsbefore EPLB maps them to physical replicas. Enabling R3 therefore failed during model initialization withNo supported MoE router found for routed-experts capture.This does not duplicate an existing change. Upstream PR vllm-project#44214 exposes routing replay for FlashInfer TRT-LLM monolithic kernels; it does not cover DeepGEMM MegaMoE. Searches for open PRs matching
deep_gemm_mega_moe R3,routing replay MegaMoE, and related terms found no implementation.Design
topk_idsimmediately before each model's existing EPLB mapping block.Nonecheck; it adds no tensor operation, allocation, copy, or kernel launch.Unsupported MoE paths continue to fail closed during initialization.
Validation
pre-commiton all four changed files: passed, including Ruff, formatting, mypy, sign-off, forbidden-import and configuration checks.pytest tests/model_executor/test_routed_experts_capture.py -k public_binding -q: 2 passed.AI assistance
This change was developed with OpenAI Codex assistance. The human submitter must review and understand every changed line before submission upstream.