Repository navigation
[draft] refactor(moe): share remote MoE runners for GPU P2P. - #55
Draft
Mohammad-nassar10 wants to merge 1 commit into
Draft
Mohammad-nassar10 wants to merge 1 commit into
Mohammad-nassar10 wants to merge 1 commit into
Conversation
Mohammad-nassar10
marked this pull request as draft
November 9, 2026 21:42
Mohammad-nassar10
force-pushed
the
stack/pr-562
branch
from
November 10, 2026 07:52
d768908 to
2f44642
Compare
Mohammad-nassar10
force-pushed
the
refactor/gpu-remote-moe-runner
branch
from
November 10, 2026 07:52
8642321 to
08d297a
Compare
On CUDA with P2pNcclAFDConnector, the Attention role now builds the MoE layers of the DeepSeek V2 family and Qwen3.5/3.6 through vLLM's own FusedMoEFactory, with an AFD runner (runner_cls) and parameter-free routed experts (routed_experts_cls), instead of the hand-made AFDAttentionFusedMoE stand-in. This is phase 1 of RFC vllm-project#225 for GPU P2P. It ports vllm-project#406 to vLLM v0.32.0 (5df63a72) and to the ffn/ layout of vllm-project#562. ffn/remote.py: - AFDRemoteMoEMethod allocates no expert weights and runs no kernel; AFDRemoteRoutedExperts selects it. - AFDRemoteMoERunner sends the hidden states through the existing RemoteFFNProxy transport (send, DBO yield, receive). AFDExternalRoutingMoERunner also applies the gate it holds, as native MoERunner does, and sends the router logits. Both reject input_ids and shared_experts_input. - build_attention_moe_runner() accepts only CUDA with P2pNcclAFDConnector and takes the model's gate exactly when compute_gate_on_attention is set. It rejects Attention-local EPLB, redundant experts, routed-expert capture (aux_output_config in vLLM 0.32) and a non-finite routed_scaling_factor, and fixes the arguments that describe local experts. - AFDAttentionFusedMoE is deleted. Model adapters: - AFDDeepseekV2RemoteExpertsMoE takes vllm_config, keeps its gate (assigned before the experts, so the mlp.gate.* checkpoint names hold) and passes it to the factory with the native 0.32 arguments. Its forward override is gone; the shell runs vLLM's native forward. - The decoder-layer EPLB check moves into the factory. The DeepEP M2N shell keeps a parameter-free RemoteFFNProxy transport and rejects EPLB itself. - AFDQwen3_5RemoteExpertsMoE matches the native constructor signature and builds the gate-on-FFN runner. Outputs are unchanged: a new CUDA test checks that the Attention MoE sends the payload its gate placement requires and returns the output of the unsplit native MoE bit for bit (rtol=0, atol=0), for both gate placements and for 1 and 7 tokens. Co-authored-by: lirx-pd <616517220@qq.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Mohammad-nassar10
force-pushed
the
refactor/gpu-remote-moe-runner
branch
from
November 12, 2026 08:50
08d297a to
b3c24c2
Compare
Mohammad-nassar10
force-pushed
the
stack/pr-562
branch
from
November 12, 2026 08:50
2f44642 to
11b8891
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.
It's stacked on PR 562 (the base branch is a copy of its head), so the diff shows only our commit. Once PR 562 lands, we'll rebase on main and open the real PR upstream, replacing PR 406.
Stacked on vllm-project#562.
Summary
On the Attention role, MoE layers are now built by vLLM's own
FusedMoEFactoryinstead of our hand-writtenAFDAttentionFusedMoE, which is removed. We plug two small pieces into the factory: experts that allocate no weights, and a runner that sends the hidden states to the FFN role (plus the router logits when the gate runs on Attention). vLLM's native MoEforwardnow works as is, so DeepSeek's copiedforwardis gone too. Outputs don't change.This is @lirx-pd PR vllm-project#406 , ported to vLLM 0.32 and to the
ffn/layout from PR 562. The main difference: in vLLM 0.32 the runner owns the gate, so with the gate on Attention our runner applies it before sending.ffn/remote.py, used by DeepSeek V2 and Qwen3.5/3.6.P2pNcclAFDConnectoronly. Anything else (other devices or connectors, Attention-side EPLB, routed-expert capture) is rejected when the layer is built.RemoteFFNProxy.RemoteFFNProxysends its whole MoE block to the FFN role.Validation
tests/unitpasses (1462 passed, 47 skipped), including the newffn/test_remote.py; pre-commit passes on the changed files.rtol=0, atol=0), for both gate placements. It passes locally on an RTX A4500.Documentation
Updated the model-integration design page, one sentence in the NCCL P2P guide, and the review-pr skill notes.