"vllm/model_executor/layers/attention/attention.py" did not exist on "7b700ec8c8ed66c505cb9e98e8f706807ee64bbf"
test_utils.py 1.15 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Unit tests for Helion utility functions."""

import pytest

from vllm.kernels.helion.utils import canonicalize_gpu_name


@pytest.mark.parametrize(
    "driver_reported_name,expected",
    [
        ("NVIDIA H200", "nvidia_h200"),
14
15
16
17
        ("NVIDIA A100-SXM4-80GB", "nvidia_a100"),
        ("NVIDIA H100 80GB HBM3", "nvidia_h100"),
        ("NVIDIA H100 PCIe", "nvidia_h100"),
        ("NVIDIA H100 SXM5", "nvidia_h100"),
18
19
        ("NVIDIA GeForce RTX 4090", "nvidia_geforce_rtx_4090"),
        ("AMD Instinct MI300X", "amd_instinct_mi300x"),
20
        ("Tesla V100-SXM2-32GB", "tesla_v100"),
21
22
23
24
25
26
27
28
29
30
31
32
    ],
)
def test_canonicalize_gpu_name(driver_reported_name, expected):
    """Test GPU name canonicalization."""
    assert canonicalize_gpu_name(driver_reported_name) == expected


@pytest.mark.parametrize("invalid_name", ["", "   ", "\t", "\n"])
def test_canonicalize_gpu_name_rejects_empty(invalid_name):
    """Test that empty or whitespace-only names are rejected."""
    with pytest.raises(ValueError, match="cannot be empty"):
        canonicalize_gpu_name(invalid_name)