[Fix] Fall back to the process-group broadcast for DSA topk when PyNCCL is absent (#36963)
This commit is contained in:
@@ -154,11 +154,14 @@ def _broadcast_indexer_topk_from_rank0_impl(topk_indices: torch.Tensor) -> None:
|
||||
if group.world_size == 1:
|
||||
return
|
||||
|
||||
if topk_indices.device.type == "cuda" and torch.cuda.is_current_stream_capturing():
|
||||
if group.pynccl_comm is None:
|
||||
raise RuntimeError(
|
||||
"SGLANG_DSA_TOPK_BROADCAST requires PyNCCL during CUDA graph capture."
|
||||
)
|
||||
# PyNCCL is the faster path under capture, but it is not a precondition:
|
||||
# a split attn-TP group is built without one (parallel_state.py), and the
|
||||
# process-group broadcast captures and replays correctly.
|
||||
if (
|
||||
topk_indices.device.type == "cuda"
|
||||
and torch.cuda.is_current_stream_capturing()
|
||||
and group.pynccl_comm is not None
|
||||
):
|
||||
with group.pynccl_comm.change_state(enable=True):
|
||||
group.pynccl_comm.broadcast(topk_indices, src=0)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user