[Fix] Offer the fused MoE finalize all-reduce only to a block that owes the sum (#42479)

This commit is contained in:
Cheng Wan
2026-10-04 16:39:06 -07:00
committed by GitHub
parent f07c1a398e
commit 5c8fb9e938
2 changed files with 65 additions and 3 deletions
+2
View File
@@ -1106,6 +1106,8 @@ class DeepseekV2MoE(nn.Module):
# The mHC post-split consumes the reduced row without an RMSNorm.
use_fused_finalize_all_reduce = (
self._fuse_finalize_all_reduce
# The kernel completes the tensor-parallel sum itself.
and self.reduce_results
and has_shared_output
and hidden_states.shape[-1] == 5120
and not self._shared_expert_tp1