[ROCm] Derive device capability from GCN arch string without CUDA init (#35069)

Signed-off-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
Andreas Karatzas
2026-02-27 23:55:28 -06:00
committed by GitHub
parent 88e8525f2e
commit 94029ffaf0
2 changed files with 120 additions and 7 deletions

View File

@@ -16,6 +16,7 @@ import psutil
import vllm.envs as envs
from vllm.logger import init_logger
from vllm.platforms import current_platform
from vllm.platforms.interface import in_wsl
from vllm.ray.lazy_utils import is_in_ray_actor
@@ -111,6 +112,17 @@ def unique_filepath(fn: Callable[[int], Path]) -> Path:
# Process management utilities
def _sync_visible_devices_env_vars():
"""Sync HIP/CUDA visibility env vars before spawning (ROCm only)."""
if not current_platform.is_rocm():
return
from vllm.platforms.rocm import _sync_hip_cuda_env_vars
_sync_hip_cuda_env_vars()
def _maybe_force_spawn():
"""Check if we need to force the use of the `spawn` multiprocessing start
method.
@@ -156,6 +168,10 @@ def get_mp_context():
VLLM_WORKER_MULTIPROC_METHOD.
"""
_maybe_force_spawn()
# (ROCm): Sync GPU visibility env vars so spawned children inherit
# consistent values. Must run after _maybe_force_spawn and regardless
# of whether spawn was already set.
_sync_visible_devices_env_vars()
mp_method = envs.VLLM_WORKER_MULTIPROC_METHOD
return multiprocessing.get_context(mp_method)