[Mooncake] Use all HCAs on multi-NIC hosts instead of GPU-indexed RNIC selection (#43799)
Signed-off-by: Dao Le <Dao007forever@gmail.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
01d8cd92dd
commit
c1d754d681
@@ -5,8 +5,6 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any
|
||||
|
||||
import torch
|
||||
|
||||
import vllm.envs as envs
|
||||
from vllm.logger import init_logger
|
||||
|
||||
@@ -20,22 +18,6 @@ def normalize_string_override(value: Any) -> str | None:
|
||||
return normalized or None
|
||||
|
||||
|
||||
def get_current_physical_gpu_index() -> int | None:
|
||||
try:
|
||||
from vllm.platforms import current_platform
|
||||
except ImportError:
|
||||
return None
|
||||
|
||||
try:
|
||||
device_index = torch.accelerator.current_device_index()
|
||||
physical_device_id = current_platform.device_id_to_physical_device_id(
|
||||
device_index
|
||||
)
|
||||
return int(physical_device_id)
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
def get_requester_local_hostname(local_ip: str) -> str:
|
||||
override = normalize_string_override(envs.MOONCAKE_REQUESTER_LOCAL_HOSTNAME)
|
||||
if override is not None:
|
||||
@@ -62,54 +44,3 @@ def get_configured_preferred_segment(
|
||||
)
|
||||
return env_value
|
||||
return None
|
||||
|
||||
|
||||
def _get_explicit_worker_rnic(device_list: str) -> str:
|
||||
entries = [entry.strip() for entry in device_list.split(",")]
|
||||
if any(not entry for entry in entries):
|
||||
raise ValueError(
|
||||
"Mooncake worker device_name contains an empty RDMA device entry"
|
||||
)
|
||||
if len(entries) == 1:
|
||||
return entries[0]
|
||||
|
||||
gpu_index = get_current_physical_gpu_index()
|
||||
if gpu_index is None:
|
||||
raise RuntimeError(
|
||||
"Mooncake RDMA requester could not determine the local physical GPU index"
|
||||
)
|
||||
if gpu_index >= len(entries):
|
||||
raise ValueError(
|
||||
"Mooncake worker device list does not cover local GPU "
|
||||
f"{gpu_index}: {device_list}"
|
||||
)
|
||||
device_name = entries[gpu_index]
|
||||
logger.info(
|
||||
"Mooncake selected worker RNIC %s from explicit device list for local GPU %s",
|
||||
device_name,
|
||||
gpu_index,
|
||||
)
|
||||
return device_name
|
||||
|
||||
|
||||
def get_configured_worker_rnic(
|
||||
*,
|
||||
protocol: str,
|
||||
configured_device: str,
|
||||
) -> str:
|
||||
normalized_device = normalize_string_override(configured_device)
|
||||
if normalized_device is not None:
|
||||
return _get_explicit_worker_rnic(normalized_device)
|
||||
|
||||
if protocol not in {"rdma", "efa"}:
|
||||
return ""
|
||||
|
||||
logger.warning(
|
||||
"No RDMA devices specified for Mooncake backend (protocol=%s). "
|
||||
"Set 'device_name' in mooncake_config.json to a single RNIC name "
|
||||
"or a comma-separated CSV indexed by physical GPU; falling back to "
|
||||
"Mooncake's built-in auto-selection, which may converge on the same "
|
||||
"NIC across all DP ranks and saturate bandwidth.",
|
||||
protocol,
|
||||
)
|
||||
return ""
|
||||
|
||||
@@ -141,7 +141,7 @@ class MooncakeStoreConfig:
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def load_from_env() -> "MooncakeStoreConfig":
|
||||
def load_from_config() -> "MooncakeStoreConfig":
|
||||
config_path = os.getenv("MOONCAKE_CONFIG_PATH")
|
||||
if not config_path:
|
||||
raise ValueError(
|
||||
@@ -983,16 +983,12 @@ class MooncakeStoreWorker:
|
||||
)
|
||||
|
||||
# Initialize MooncakeDistributedStore with its own TransferEngine
|
||||
store_config = MooncakeStoreConfig.load_from_env()
|
||||
store_config = MooncakeStoreConfig.load_from_config()
|
||||
extra_config = (
|
||||
vllm_config.kv_transfer_config.kv_connector_extra_config
|
||||
if vllm_config.kv_transfer_config
|
||||
else {}
|
||||
)
|
||||
store_config.device_name = rdma_utils.get_configured_worker_rnic(
|
||||
protocol=store_config.protocol,
|
||||
configured_device=store_config.device_name,
|
||||
)
|
||||
self.store = MooncakeDistributedStore()
|
||||
local_ip = get_ip()
|
||||
local_hostname = rdma_utils.get_requester_local_hostname(local_ip)
|
||||
|
||||
Reference in New Issue
Block a user