[Fix] Skip cross-node probe in MultimemAllGatherer on single-node runs (fixes mooncake EP segfault) (#30139)

This commit is contained in:
Cheng Wan
2026-07-04 15:36:23 -07:00
committed by GitHub
parent 00f088f6be
commit 754524d8de
@@ -466,10 +466,19 @@ class MultimemAllGatherer:
# Lazy import avoids a module-load dependency on the distributed facade.
from sglang.srt.distributed import get_tp_group
from sglang.srt.distributed.parallel_state import in_the_same_node_as
from sglang.srt.runtime_context import get_server_args
tp_group = get_tp_group()
if tp_group.world_size > 1 and not all(
in_the_same_node_as(tp_group.cpu_group, source_rank=0)
# Only probe node topology when the deployment can actually span
# nodes. Check world_size first so a TP=1 gatherer short-circuits
# before reading server args (which may be unpublished on offline
# paths). On a single node every TP rank is co-located, so skip the
# in_the_same_node_as() all-reduce, which can segfault under some
# EP/mooncake setups, and keep multimem enabled.
if (
tp_group.world_size > 1
and get_server_args().nnodes > 1
and not all(in_the_same_node_as(tp_group.cpu_group, source_rank=0))
):
logger.warning(
"multimem all-gather disabled because the TP group spans "