Fix NCCL AllGather hanging issue for Qwen3 Next MTP (#22458)
This commit is contained in:
@@ -7,8 +7,13 @@ import torch
|
||||
import torch.nn.functional as F
|
||||
|
||||
from sglang.srt.constrained.base_grammar_backend import BaseGrammarObject
|
||||
from sglang.srt.distributed import get_tp_group
|
||||
from sglang.srt.environ import envs
|
||||
from sglang.srt.layers.attention.utils import create_flashinfer_kv_indices_triton
|
||||
from sglang.srt.layers.dp_attention import (
|
||||
get_attention_tp_group,
|
||||
is_dp_attention_enabled,
|
||||
)
|
||||
from sglang.srt.layers.logits_processor import LogitsProcessorOutput
|
||||
from sglang.srt.layers.sampler import apply_custom_logit_processor
|
||||
from sglang.srt.managers.overlap_utils import FutureIndices
|
||||
@@ -377,6 +382,20 @@ class EagleVerifyInput(SpecInput, EagleVerifyInputV2Mixin):
|
||||
deterministic=True,
|
||||
)
|
||||
|
||||
# Sync sampling results across TP ranks: different GPUs may
|
||||
# produce slightly different target_probs due to floating-point
|
||||
# non-determinism in softmax/top_k/top_p, causing different
|
||||
# sampled tokens. Broadcast from rank 0 to ensure consistency.
|
||||
tp_group = (
|
||||
get_attention_tp_group()
|
||||
if is_dp_attention_enabled()
|
||||
else get_tp_group()
|
||||
)
|
||||
if tp_group.world_size > 1:
|
||||
tp_group.broadcast(predict, src=0)
|
||||
tp_group.broadcast(accept_index, src=0)
|
||||
tp_group.broadcast(accept_length, src=0)
|
||||
|
||||
if SIMULATE_ACC_LEN > 0.0:
|
||||
# Do simulation
|
||||
accept_index = generate_simulated_accept_index(
|
||||
|
||||
@@ -8,6 +8,11 @@ import torch.nn.functional as F
|
||||
import triton
|
||||
import triton.language as tl
|
||||
|
||||
from sglang.srt.distributed import get_tp_group
|
||||
from sglang.srt.layers.dp_attention import (
|
||||
get_attention_tp_group,
|
||||
is_dp_attention_enabled,
|
||||
)
|
||||
from sglang.srt.layers.logits_processor import LogitsProcessorOutput
|
||||
from sglang.srt.managers.schedule_batch import ModelWorkerBatch, ScheduleBatch
|
||||
from sglang.srt.managers.utils import get_alloc_len_per_decode
|
||||
@@ -412,6 +417,20 @@ class EagleVerifyInputV2Mixin:
|
||||
deterministic=True,
|
||||
)
|
||||
|
||||
# Sync sampling results across TP ranks: different GPUs may
|
||||
# produce slightly different target_probs due to floating-point
|
||||
# non-determinism in softmax/top_k/top_p, causing different
|
||||
# sampled tokens. Broadcast from rank 0 to ensure consistency.
|
||||
tp_group = (
|
||||
get_attention_tp_group()
|
||||
if is_dp_attention_enabled()
|
||||
else get_tp_group()
|
||||
)
|
||||
if tp_group.world_size > 1:
|
||||
tp_group.broadcast(predict, src=0)
|
||||
tp_group.broadcast(accept_index, src=0)
|
||||
tp_group.broadcast(accept_length, src=0)
|
||||
|
||||
if SIMULATE_ACC_LEN > 0:
|
||||
# Do simulation
|
||||
accept_index = generate_simulated_accept_index(
|
||||
|
||||
Reference in New Issue
Block a user