[WideEP] Change DeepEPv2 to auto select hybrid mode by default (#57991)

Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com> Co-authored-by: Codex <noreply@openai.com>

Tyler Michael Smith committed Sep 29, 2026 at 18:36 UTC 50239dfc4d10f007887f2cbc042809e3f4c2ceeb
3 files changed +14 -6
vllm/distributed/device_communicators/all2all.py
+3 -1
@@ -1065,7 +1065,9 @@ class DeepEPV2All2AllManager(All2AllManagerBase):
1065 if os.environ.get("EP_DISABLE_GIN", "0") != "0":
1066 return
1067
1068 - gin_type = query_nccl_gin_type(group)
1068 + gin_type = query_nccl_gin_type(
1069 + group, railed=envs.VLLM_DEEPEP_V2_ALLOW_HYBRID_MODE
1070 + )
1071 if gin_type is None:
1072 raise RuntimeError(
1073 "DeepEPv2 communicator properties query failed; "
vllm/envs.py
+6 -2
@@ -2009,9 +2009,13 @@ environment_variables: dict[str, Callable[[], Any]] = {
2009 "VLLM_DEEPEP_LOW_LATENCY_USE_MNNVL": lambda: bool(
2010 int(os.getenv("VLLM_DEEPEP_LOW_LATENCY_USE_MNNVL", "0"))
2011 ),
2012 - # DeepEP v2: enable two-tier NVLink+RDMA hybrid mode
2012 + # DeepEP v2: use NVLink+RDMA hybrid communication across NVLink domains.
2013 + # * hybrid mode = multi-node RDMA
2014 + # * non hybrid mode = nvlink
2015 + # Set to 1 (the default) to allow DeepEP to autoselect hybrid vs non-hybrid.
2016 + # Set to 0 to disable hybrid mode.
2017 "VLLM_DEEPEP_V2_ALLOW_HYBRID_MODE": lambda: bool(
2014 - int(os.getenv("VLLM_DEEPEP_V2_ALLOW_HYBRID_MODE", "0"))
2018 + int(os.getenv("VLLM_DEEPEP_V2_ALLOW_HYBRID_MODE", "1"))
2019 ),
2020 # DeepEP v2: use fewer SMs at slight throughput cost
2021 "VLLM_DEEPEP_V2_PREFER_OVERLAP": lambda: bool(
vllm/utils/nccl.py
+5 -3
@@ -83,8 +83,10 @@ def find_nccl_library_paths() -> list[str] | None:
83 return paths or None
84
85
86 -def query_nccl_gin_type(group: torch.distributed.ProcessGroup) -> int | None:
87 - """Return the GIN type for an initialized group, or ``None`` on failure."""
86 +def query_nccl_gin_type(
87 + group: torch.distributed.ProcessGroup, *, railed: bool = False
88 +) -> int | None:
89 + """Return the full or railed GIN type, or ``None`` on query failure."""
90 from vllm.distributed.device_communicators.pynccl_wrapper import (
91 NCCL_COMM_PROPERTIES_LAYOUT_VERSION,
92 NCCLLibrary,
@@ -126,4 +128,4 @@ def query_nccl_gin_type(group: torch.distributed.ProcessGroup) -> int | None:
128 if result != 0:
129 logger.warning("ncclCommQueryProperties returned error %d", result)
130 return None
129 - return props.ginType
131 + return props.railedGinType if railed else props.ginType