Repository navigation
[Bugfix][PCP] Align MoE routing padding with gathered tokens - #60946
wangyicong52 wants to merge 1 commit into
Conversation
Extract the generic PCP MoE padding-mask fix from vllm-project#59857 as requested by LucasWilkinson. Match the routing mask to gathered token rows and restore the local ForwardContext mask after the call. Cache the gathered mask per forward and cover normal and exceptional exits for PCP1/2/4 and the all-to-all bypass. Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: wangyicong <wangyicong@bytedance.com>
Resolve LucasWilkinson's review comments by extracting the generic PCP MoE padding-mask fix into draft vllm-project#60946 and reverting the corresponding shared MoERunner changes from this PR. Move PCP token-ID gathering and per-forward caching into the DeepSeek-V4.1 MoE model, covering both the normal and deferred-finalization entry points while retaining local IDs for embedding and Engram. Review discussions: vllm-project#59857 (comment) and vllm-project#59857 (comment). Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: wangyicong <wangyicong@bytedance.com>
|
This is a Bytebell Pull request verifier bot. Findings — 9 in 2 files
|
|
@LucasWilkinson Could you have a look when you have time? Thanks! |
|
Apologies for the delay; it's a holiday here in Canada, I will try to look tomorrow or the day after 👍 |
No worries at all—thanks for letting me know! Just enjoy the Thanksgiving holiday! |
Purpose
The non-all-to-all PCP path gathers hidden states and router logits across PCP ranks, but the router still reads the rank-local padding mask. With N local rows and P PCP ranks, routing processes P*N rows while the mask still has N entries. CUDA top-k checks that the mask length matches the token count and can raise an
is_paddingsize mismatch.This PR aligns the MoE padding mask with the PCP-gathered token rows and restores the original rank-local mask in a
finallyblock. The dispatch/combine interfaces and PCP1/all-to-all paths remain unchanged. Regression tests cover PCP1/2/4, the all-to-all bypass, per-forward caching, and exception cleanup.A search of open PRs covering PCP padding, PCP MoE, and the relevant padding-cache key found no equivalent fix. Nearby PRs #53639, #60049, and #56258 address different paths.
Implementation
Validation
Environment
mistralai/Mistral-Small-4-119B-2603native FP8 checkpoint.vllm/vllm-openai:nightly-81198e97ba7eee2a22540caaa756b7fdddcb4d93.vLLM startup arguments
Result
Without this fix (baseline):
With the unmodified image and model, all seven native weight shards loaded (29.34 GiB per rank). The unpatched run then failed during vLLM's standard startup memory profiling, before the API server became ready:
With this PR:
Applying the
_sequence_parallel_contextchange from this PR at startup allowed the TP2/PCP2 deployment to start and generate successfully. It passed all five chat smoke requests, including a 2,235-token input and concurrent requests of different lengths.Using the official
tests/evals/gsm8k/gsm8k_eval.pyscoring logic, we evaluated all 1,319 test examples with 5-shot prompts, temperature=0, seed=42,max_tokens=256, and concurrency=4. Results:AI assistance was used to extract the change, prepare regression tests and run the validation described above. The human submitter retains responsibility for line-by-line review and final sign-off.