Repository navigation
[Fix] Decide the MoE padded-row bound from the layer scatter mode - #40672
Conversation
|
/rerun-test test/registered/unit/model_executor/test_num_token_non_padded_localization.py registered/ep/test_eplb_no_a2a.py registered/moe/test_moe_ep.py registered/dp_attn/test_dp_attention.py registered/dp_attn/test_dp_attention_bcg_kl.py registered/moe/test_topk_padded_region.py registered/moe/test_glm4_moe_models.py test/registered/ep/test_deepep_small.py test/registered/ep/test_routed_experts_dp_readback.py test/registered/cp/test_dsa_prefill_cp.py test/registered/cp/test_deepseek_v3_cp_single_node.py test/registered/moe/test_zero_experts.py |
|
Results for 🚀 🚀 🚀 🚀 🚀 🚀 |
…l-project#40672) Co-authored-by: Mohammad Angkad <[email protected]> (cherry picked from commit 7b977ce)
…ound on ROCm sgl-project#40672 bounds padded rows from the layer scatter mode, so the HIP-only drop absorbed from sgl-project#39804 is no longer needed and upstream has reverted it.
Summary
A more general fix for the truncation reported in #40643, which #39574 introduced: rather than special-casing DP attention, the bound is decided from the layer communicator's scatter mode, which also covers the non-DP and CP gathered cases and the other MoE models on the same path.
forward_batch.num_token_non_paddedis LOCAL (forward_batch_info.py). It bounds a sparse MoE's input only while that input is this rank's own shard. On a gathered buffer each source rank contributes its own padded slot, so the real rows are not a prefix — masking with the local count drops every peer rank's tokens, and under--moe-a2a-backend noneeach rank sums a truncated partial output.This moves that decision to
ForwardBatch.moe_num_token_non_padded(), keyed on the scatter mode the layer communicator already computes for a sparse MLP.Decision table
SCATTEREDLOCALMOE_FULLMOE_FULLFULLFULLattn_dp_size > 1—dp_gatherinterleaves slotsFULLattn_dp_size == 1, attn-TP sharded — all-reduce, not gatherGLOBALFULLattn_dp_size == 1, replicatedLOCALnum_token_non_padded is None(no EP)Changes
forward_batch_info.pymoe_num_token_non_padded()— the one definitioncommunicator.py_compute_mlp_mode's sparse branch extracted assparse_mlp_scatter_mode()mega_moe.pydeepseek_v4.pynum_token_non_padded = Nonearound its MoE call dropped as redundanttest_num_token_non_padded_localization.pyVerification
test/registered/unit/model_executor+ scatter-modes testMOE_FULL-gate simulation (unconditionalNone)torch.compile(fullgraph=True)over the accessor's function-level importnum_token_non_padded=MoE routing reads left insrt/CI States
Latest PR Test (Base): ❌ Run #35743730051
Latest PR Test (Extra): ✅ Run #35743729422
Latest PR Test (AMD ROCm 10): ⏳ Run #35743730189