Canonicalize GPU name for use as a platform identifier.
Converts to lowercase, replaces spaces and hyphens with underscores, and maps known variant names to their canonical form via _GPU_NAME_ALIASES. e.g., "NVIDIA H100 80GB HBM3" -> "nvidia_h100" "NVIDIA A100-SXM4-80GB" -> "nvidia_a100" "AMD Instinct MI300X" -> "amd_instinct_mi300x"
Source code in vllm/kernels/helion/utils.py
| def canonicalize_gpu_name(name: str) -> str:
"""
Canonicalize GPU name for use as a platform identifier.
Converts to lowercase, replaces spaces and hyphens with underscores,
and maps known variant names to their canonical form via _GPU_NAME_ALIASES.
e.g., "NVIDIA H100 80GB HBM3" -> "nvidia_h100"
"NVIDIA A100-SXM4-80GB" -> "nvidia_a100"
"AMD Instinct MI300X" -> "amd_instinct_mi300x"
"""
if not name or not name.strip():
raise ValueError("GPU name cannot be empty")
name = name.lower()
name = name.replace(" ", "_")
name = name.replace("-", "_")
if name in _GPU_NAME_ALIASES:
return _GPU_NAME_ALIASES[name]
return name
|