Unverified Commit f13e86d8 authored by Andreas Karatzas's avatar Andreas Karatzas Committed by GitHub
Browse files

[Kernels] Fix Helion GPU utils to use platform-agnostic device name API (#34537)


Signed-off-by: default avatarAndreas Karatzas <akaratza@amd.com>
parent 9ca768c7
...@@ -2,14 +2,21 @@ ...@@ -2,14 +2,21 @@
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Utility functions for Helion kernel management.""" """Utility functions for Helion kernel management."""
import torch import logging
from vllm.platforms import current_platform
logger = logging.getLogger(__name__)
def get_gpu_name(device_id: int | None = None) -> str: def get_gpu_name(device_id: int | None = None) -> str:
if device_id is None: if device_id is None:
device_id = torch.cuda.current_device() logger.warning(
props = torch.cuda.get_device_properties(device_id) "get_gpu_name() called without device_id, defaulting to 0. "
return props.name "This may return the wrong device name in multi-node setups."
)
device_id = 0
return current_platform.get_device_name(device_id)
def canonicalize_gpu_name(name: str) -> str: def canonicalize_gpu_name(name: str) -> str:
...@@ -18,6 +25,7 @@ def canonicalize_gpu_name(name: str) -> str: ...@@ -18,6 +25,7 @@ def canonicalize_gpu_name(name: str) -> str:
Converts to lowercase and replaces spaces and hyphens with underscores. Converts to lowercase and replaces spaces and hyphens with underscores.
e.g., "NVIDIA A100-SXM4-80GB" -> "nvidia_a100_sxm4_80gb" e.g., "NVIDIA A100-SXM4-80GB" -> "nvidia_a100_sxm4_80gb"
"AMD_Instinct_MI300X" -> "amd_instinct_mi300x"
Raises ValueError if name is empty. Raises ValueError if name is empty.
""" """
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment