[CI/Build][BugFix][The Rock] Fix get_ssm_device_name to return sanitized, usable filename (#47781)
Signed-off-by: Randall Smith <Randall.Smith@amd.com>
rasmith committed
Jul 8, 2026 at 07:12 UTC
934eeaecfb13c4e5d5aa5a4a420cff35f5bd9821
8 files changed
+24
-9
benchmarks/kernels/benchmark_flydsl_moe_w4a16.py
+2
-2
@@ -17,7 +17,7 @@ from vllm.model_executor.layers.fused_moe.fused_flydsl_moe import fused_flydsl_m
17
from vllm.model_executor.layers.quantization.compressed_tensors.compressed_tensors_moe import ( # noqa: E501
18
compressed_tensors_moe_w4a16_flydsl,
19
)
20
-from vllm.platforms import current_platform
20
+from vllm.utils.platform_utils import get_device_name_as_file_name
21
22
RoutingBuffers = tuple[
23
torch.Tensor, # sorted_token_ids
@@ -259,7 +259,7 @@ def tune_flydsl_moe_w4a16(
259
)
260
us_best = us
261
tuned_config[str(num_tokens)] = tile_config
262
- device_name = current_platform.get_device_name().replace(" ", "_")
262
+ device_name = get_device_name_as_file_name()
263
tuned_config_file_name = (
264
f"E={num_experts},N={inter_dim},device_name={device_name},"
265
f"dtype=int4_w4a16,backend=flydsl.json"
benchmarks/kernels/benchmark_w8a8_block_fp8.py
+2
-1
@@ -19,6 +19,7 @@ from vllm.model_executor.layers.quantization.utils.fp8_utils import (
19
from vllm.platforms import current_platform
20
from vllm.triton_utils import triton
21
from vllm.utils.argparse_utils import FlexibleArgumentParser
22
+from vllm.utils.platform_utils import get_device_name_as_file_name
23
24
mp.set_start_method("spawn", force=True)
25
@@ -264,7 +265,7 @@ def save_configs(
265
input_type="fp8",
266
) -> None:
267
os.makedirs(save_path, exist_ok=True)
267
- device_name = current_platform.get_device_name().replace(" ", "_")
268
+ device_name = get_device_name_as_file_name()
269
json_file_name = (
270
f"N={N},K={K},device_name={device_name},dtype={input_type}_w8a8,"
271
f"block_shape=[{block_n},{block_k}].json"
vllm/model_executor/layers/fused_moe/fused_flydsl_moe.py
+2
-2
@@ -15,7 +15,7 @@ from aiter.ops.flydsl.kernels.moe_gemm_2stage import (
15
)
16
17
from vllm.logger import init_logger
18
-from vllm.platforms import current_platform
18
+from vllm.utils.platform_utils import get_device_name_as_file_name
19
from vllm.utils.torch_utils import direct_register_custom_op
20
21
logger = init_logger(__name__)
@@ -106,7 +106,7 @@ def build_routing_buffers(
106
107
@functools.lru_cache
108
def try_get_optimal_config(num_experts, inter_dim):
109
- device_name = current_platform.get_device_name().replace(" ", "_")
109
+ device_name = get_device_name_as_file_name()
110
json_file_name = (
111
f"E={num_experts},N={inter_dim},device_name={device_name},"
112
"dtype=int4_w4a16,backend=flydsl.json"
vllm/model_executor/layers/fused_moe/fused_moe.py
+2
-1
@@ -31,6 +31,7 @@ from vllm.model_executor.layers.fused_moe.utils import (
31
)
32
from vllm.platforms import current_platform
33
from vllm.triton_utils import tl, triton
34
+from vllm.utils.platform_utils import get_device_name_as_file_name
35
from vllm.utils.torch_utils import direct_register_custom_op
36
37
logger = init_logger(__name__)
@@ -1034,7 +1035,7 @@ def zero_experts_compute_triton(
1035
def get_config_file_name(
1036
E: int, N: int, dtype: str | None, block_shape: list[int] | None = None
1037
) -> str:
1037
- device_name = current_platform.get_device_name().replace(" ", "_")
1038
+ device_name = get_device_name_as_file_name()
1039
# Set device_name to H200 if a device from the H200 family is detected
1040
if "H200" in device_name.split("_"):
1041
device_name = "NVIDIA_H200"
vllm/model_executor/layers/mamba/ops/mamba_ssm.py
+2
-1
@@ -19,6 +19,7 @@ from vllm.logger import init_logger
19
from vllm.model_executor.layers.mamba.ops.triton_helpers import fast_exp
20
from vllm.platforms import current_platform
21
from vllm.triton_utils import HAS_TRITON, tl, triton
22
+from vllm.utils.platform_utils import get_device_name_as_file_name
23
from vllm.v1.attention.backends.utils import NULL_BLOCK_ID
24
25
if current_platform.is_xpu():
@@ -53,7 +54,7 @@ def get_ssm_config_file_name(
54
55
56
def get_ssm_device_name() -> str:
56
- return current_platform.get_device_name().replace(" ", "_")
57
+ return get_device_name_as_file_name()
58
59
60
def _canonical_cache_dtype(cache_dtype: str) -> str:
vllm/model_executor/layers/quantization/utils/fp8_utils.py
+2
-1
@@ -33,6 +33,7 @@ from vllm.utils.deep_gemm import (
33
is_deep_gemm_e8m0_used,
34
transform_sf_into_required_layout,
35
)
36
+from vllm.utils.platform_utils import get_device_name_as_file_name
37
from vllm.utils.torch_utils import direct_register_custom_op
38
39
logger = init_logger(__name__)
@@ -864,7 +865,7 @@ def get_w8a8_block_fp8_configs(
865
866
# First look up if an optimized configuration is available in the configs
867
# directory
867
- device_name = current_platform.get_device_name().replace(" ", "_")
868
+ device_name = get_device_name_as_file_name()
869
json_file_name = f"N={N},K={K},device_name={device_name},dtype=fp8_w8a8,block_shape=[{block_n},{block_k}].json" # noqa: E501
870
871
config_file_path = os.path.join(
vllm/model_executor/layers/quantization/utils/int8_utils.py
+2
-1
@@ -12,6 +12,7 @@ import torch
12
13
from vllm.platforms import current_platform
14
from vllm.triton_utils import tl, triton
15
+from vllm.utils.platform_utils import get_device_name_as_file_name
16
17
logger = logging.getLogger(__name__)
18
@@ -329,7 +330,7 @@ def get_w8a8_block_int8_configs(
330
331
# First look up if an optimized configuration is available in the configs
332
# directory
332
- device_name = current_platform.get_device_name().replace(" ", "_")
333
+ device_name = get_device_name_as_file_name()
334
json_file_name = f"N={N},K={K},device_name={device_name},dtype=int8_w8a8,block_shape=[{block_n}, {block_k}].json" # noqa: E501
335
336
config_file_path = os.path.join(
vllm/utils/platform_utils.py
+10
@@ -7,6 +7,7 @@ from concurrent.futures.process import ProcessPoolExecutor
7
from functools import cache
8
from typing import Any
9
10
+import regex as re
11
import torch
12
13
@@ -62,3 +63,12 @@ def num_compute_units(device_id: int = 0) -> int:
63
from vllm.platforms import current_platform
64
65
return current_platform.num_compute_units(device_id)
66
+
67
+
68
+@cache
69
+def get_device_name_as_file_name(device_id: int = 0) -> str:
70
+ from vllm.platforms import current_platform
71
+
72
+ name = current_platform.get_device_name(device_id)
73
+ name = re.sub(r"[\s/]+", "_", name)
74
+ return name