[Fix] Improve ROCm detection in WSL environments (#38434)
Signed-off-by: Yizhou Liu <liu_yizhou@outlook.com>
This commit is contained in:
@@ -10,7 +10,7 @@ from vllm import envs
|
|||||||
from vllm.plugins import PLATFORM_PLUGINS_GROUP, load_plugins_by_group
|
from vllm.plugins import PLATFORM_PLUGINS_GROUP, load_plugins_by_group
|
||||||
from vllm.utils.import_utils import resolve_obj_by_qualname
|
from vllm.utils.import_utils import resolve_obj_by_qualname
|
||||||
|
|
||||||
from .interface import CpuArchEnum, Platform, PlatformEnum
|
from .interface import CpuArchEnum, Platform, PlatformEnum, in_wsl
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -125,6 +125,20 @@ def rocm_platform_plugin() -> str | None:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug("ROCm platform is not available because: %s", str(e))
|
logger.debug("ROCm platform is not available because: %s", str(e))
|
||||||
|
|
||||||
|
if not is_rocm and in_wsl():
|
||||||
|
try:
|
||||||
|
import torch
|
||||||
|
|
||||||
|
if (
|
||||||
|
not vllm_version_matches_substr("cpu")
|
||||||
|
and getattr(torch.version, "hip", None)
|
||||||
|
and torch.accelerator.is_available()
|
||||||
|
):
|
||||||
|
is_rocm = True
|
||||||
|
logger.debug("Confirmed ROCm platform is available in WSL via PyTorch.")
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug("WSL ROCm fallback detection failed because: %s", str(e))
|
||||||
|
|
||||||
return "vllm.platforms.rocm.RocmPlatform" if is_rocm else None
|
return "vllm.platforms.rocm.RocmPlatform" if is_rocm else None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user