correct allreduce fusion and dummy_run alignment in SCATTERED MLP mode (moe_dense_tp_size=1) (#19918)

This commit is contained in:
weireweire
2026-05-22 19:18:25 -07:00
committed by GitHub
parent d226f75669
commit 629b6c6a85
3 changed files with 10 additions and 2 deletions
+5
View File
@@ -742,6 +742,11 @@ class LayerCommunicator:
else 0
)
# When mlp_mode is SCATTERED, the MLP runs on scattered data with no TP
# all-reduce, so there is nothing to fuse with the next layer.
if self.layer_scatter_modes.mlp_mode == ScatterMode.SCATTERED:
return False
return (
(
apply_flashinfer_allreduce_fusion(batch_size)
@@ -209,6 +209,7 @@ from sglang.srt.utils import (
set_cuda_arch,
slow_rank_detector,
)
from sglang.srt.utils.common import ceil_align, require_mlp_sync
from sglang.srt.utils.network import NetworkAddress, get_local_ip_auto
from sglang.srt.utils.nvtx_pytorch_hooks import PytHooks
from sglang.srt.utils.offloader import (
@@ -2454,10 +2455,11 @@ class ModelRunner(ModelRunnerKVCacheMixin):
num_tokens = batch_size * num_tokens_per_bs
if require_gathered_buffer(self.server_args):
# Keep warmup aligned with scheduler MLP-sync padding.
if require_mlp_sync(self.server_args):
attn_tp_size = get_attention_tp_size()
if attn_tp_size > 1 and num_tokens % attn_tp_size != 0:
num_tokens = num_tokens // attn_tp_size * attn_tp_size
num_tokens = ceil_align(num_tokens, attn_tp_size)
batch_size = num_tokens // num_tokens_per_bs
seq_len_fill_value = self.attn_backend.get_cuda_graph_seq_len_fill_value()