Skip to content

Don't mask the DP-gathered MoE buffer with the local token count - #40643

Closed
alisonshao wants to merge 1 commit into
mainfrom
fix/eplb-dp-attention-token-mask
Closed

alisonshao wants to merge 1 commit into
mainfrom
fix/eplb-dp-attention-token-mask

Conversation

@alisonshao

@alisonshao alisonshao commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

TestEPLBNoA2ADPAttention::test_gsm8k has failed every nightly since 09-17, scoring 0.14–0.26 against its 0.55 threshold. The non-DP sibling TestEPLBNoA2A passes at 0.64 in the same job.

failure example: https://github.com/sgl-project/sglang/actions/runs/35610345178/job/106367717006

Cause

Bisected to #39574, which started passing forward_batch.num_token_non_padded into the non-a2a MoE path. That field is documented in forward_batch_info.py as scalar, LOCAL (derived) — the count for the current DP rank. With DP attention the MoE runs over the DP-gathered buffer spanning every DP rank, so masking it with the local count cuts off the other ranks' tokens. On --moe-a2a-backend none every rank sums its partial output, so the truncation compounds instead of cancelling.

Fix

Only pass the count when attn_dp_size == 1. That restores the pre-#39574 behaviour on the DP-attention path and leaves the padded-row fix untouched everywhere else, including the non-DP EP case the test above covers.

Verification

2-GPU A/B on the same commit, only this patch differing, using the test's server args. lmsys/sglang-ci-dsv3-test isn't reachable outside CI, so this used public deepseek-ai/DeepSeek-V2-Lite; its absolute gsm8k is lower but the collapse reproduces:

gsm8k
main 0.055
main + this patch 0.33

Bisect endpoints matched CI on the same setup — 832ec39cc0 (last passing nightly) 0.335, 7ccbf5fd04 (first failing) 0.04 — and the first bad commit was #39574's 0dabef3d30, whose parent fb91baedab scores 0.335.

cc @hnyls2002


CI States

Latest PR Test (Base): ❌ Run #35665798680
Latest PR Test (Extra): ❌ Run #35665798603
Latest PR Test (AMD ROCm 10): ❌ Run #35665798780

#39574 started passing forward_batch.num_token_non_padded into the
non-a2a MoE path. That value is the current DP rank's own token count,
but with DP attention the MoE runs over the DP-gathered buffer spanning
every DP rank, so the mask truncates it and each rank sums a differently
truncated partial output.

Only pass the count when attn_dp_size == 1.
@alisonshao
alisonshao force-pushed the fix/eplb-dp-attention-token-mask branch from a6bdd60 to 8ebde03 Compare September 21, 2026 23:04
@alisonshao

Copy link
Copy Markdown
Collaborator Author

/rerun-test test_eplb_no_a2a.py

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test_eplb_no_a2a.py:

🚀 2-gpu-h100 (1 test): ✅ View workflow run

cd test/ && python3 registered/ep/test_eplb_no_a2a.py

@alisonshao

This comment was marked as duplicate.

@github-actions

This comment was marked as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant