[ROCm] Enable pinned memory on supported WSL2 kernels (#50126)

Signed-off-by: Flora Cui <flora.cui@amd.com>
This commit is contained in:
Flora Cui
2026-08-07 10:43:42 -05:00
committed by GitHub
parent 448344c0e2
commit 7e85d3a42c
2 changed files with 29 additions and 3 deletions
@@ -8,6 +8,6 @@ ARCH_TAG="${BUILDKITE_COMMIT}-$(uname -m)-xpu"
PLATFORM_TAG="${BUILDKITE_COMMIT}-xpu"
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${REGISTRY}
docker manifest rm ${REGISTRY}/${REPO}:${PLATFORM_TAG} || true
docker manifest create ${REGISTRY}/${REPO}:${PLATFORM_TAG} ${REGISTRY}/${REPO}:${ARCH_TAG} --amend
docker manifest rm "${REGISTRY}/${REPO}:${PLATFORM_TAG}" || true
docker manifest create "${REGISTRY}/${REPO}:${PLATFORM_TAG}" "${REGISTRY}/${REPO}:${ARCH_TAG}" --amend
docker manifest push ${REGISTRY}/${REPO}:${PLATFORM_TAG}
+27 -1
View File
@@ -2,6 +2,7 @@
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import os
import platform
from datetime import timedelta
from functools import cache, lru_cache, wraps
from typing import TYPE_CHECKING
@@ -15,7 +16,7 @@ import vllm.envs as envs
from vllm.logger import init_logger
from vllm.v1.attention.backends.registry import AttentionBackendEnum
from .interface import DeviceCapability, Platform, PlatformEnum
from .interface import DeviceCapability, Platform, PlatformEnum, in_wsl
if TYPE_CHECKING:
from vllm.config import VllmConfig
@@ -113,6 +114,16 @@ def _rocm_device_count_stateless(cuda_visible_devices: str | None = None) -> int
return r
@cache
def _get_wsl_kernel_version() -> tuple[int, ...] | None:
try:
release = platform.uname().release
parts = release.split("-")[0].split(".")
return tuple(int(part) for part in parts[:3])
except (TypeError, ValueError):
return None
def _sync_hip_cuda_env_vars():
"""Ensure HIP_VISIBLE_DEVICES and CUDA_VISIBLE_DEVICES are consistent.
Treats empty string as unset. Raises on genuine conflicts."""
@@ -536,6 +547,21 @@ class RocmPlatform(Platform):
with contextlib.suppress(ImportError):
import vllm._rocm_C # noqa: F401
@classmethod
def is_pin_memory_available(cls) -> bool:
if in_wsl():
version = _get_wsl_kernel_version()
if version is None or version < (4, 19, 121):
# warning_once() causes a circular import on WSL, see #48397.
logger.warning(
"Using 'pin_memory=False' as WSL is detected and the "
"WSL2 kernel version is below 4.19.121. This may slow "
"down performance. Please run `wsl --update`."
)
return False
return True
@classmethod
def get_valid_backends(
cls,