diff --git a/vllm/config/parallel.py b/vllm/config/parallel.py index c0eb67cac1..6e8f78e4ee 100644 --- a/vllm/config/parallel.py +++ b/vllm/config/parallel.py @@ -900,12 +900,18 @@ class ParallelConfig: # (torch.distributed.batch_isend_irecv doesn't # support stateless mode), so we use PyNCCL backend self.eplb_config.communicator = "pynccl" - elif self.eplb_config.use_async: - # Torch Gloo is a backend that allows avoiding hangs - # due to NCCL multi-thread conflicts in async EPLB - self.eplb_config.communicator = "torch_gloo" else: - self.eplb_config.communicator = "torch_nccl" + # Avoid torch_nccl: NCCL is fundamentally incompatible + # with async EPLB due to multi-stream conflicts, and + # batched isend/irecv hangs under high load. + # See https://github.com/pytorch/pytorch/issues/174288 + # Prefer nixl when available; fall back to torch_gloo. + from vllm.distributed.nixl_utils import is_nixl_available + + if is_nixl_available(): + self.eplb_config.communicator = "nixl" + else: + self.eplb_config.communicator = "torch_gloo" @property def use_ray(self) -> bool: diff --git a/vllm/distributed/nixl_utils.py b/vllm/distributed/nixl_utils.py index d7d262672d..634d59976f 100644 --- a/vllm/distributed/nixl_utils.py +++ b/vllm/distributed/nixl_utils.py @@ -79,4 +79,17 @@ def __getattr__(name: str) -> Any: raise AttributeError(f"module {__name__!r} has no attribute {name!r}") -__all__ = ["NixlWrapper", "nixl_agent_config", "nixlXferTelemetry"] +def is_nixl_available() -> bool: + """Lightweight check for nixl/rixl package without importing it.""" + import importlib.util + + pkg = "rixl" if current_platform.is_rocm() else "nixl" + return importlib.util.find_spec(pkg) is not None + + +__all__ = [ + "NixlWrapper", + "nixl_agent_config", + "nixlXferTelemetry", + "is_nixl_available", +]