CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
109 lines
2.5 KiB
Python
109 lines
2.5 KiB
Python
# Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
GEMM_AXES = [
|
|
"tile_m",
|
|
"tile_n",
|
|
"tile_k",
|
|
"warp_m",
|
|
"warp_n",
|
|
"warp_k",
|
|
"warp_tile_m",
|
|
"warp_tile_n",
|
|
"warp_tile_k",
|
|
"pipeline",
|
|
"epilogue",
|
|
"scheduler",
|
|
"pad_m",
|
|
"pad_n",
|
|
"pad_k",
|
|
"persistent",
|
|
]
|
|
|
|
GEMM_STREAMK_AXES = GEMM_AXES + ["reduction_strategy"]
|
|
|
|
GEMM_ABQUANT_AXES = [
|
|
"tile_m",
|
|
"tile_n",
|
|
"tile_k",
|
|
"warp_m",
|
|
"warp_n",
|
|
"warp_k",
|
|
"warp_tile_m",
|
|
"warp_tile_n",
|
|
"warp_tile_k",
|
|
"pipeline",
|
|
"epilogue",
|
|
"scheduler",
|
|
"pad_m",
|
|
"pad_n",
|
|
"pad_k",
|
|
"a_preshuffle_quant",
|
|
"b_preshuffle_quant",
|
|
"group_size_n",
|
|
]
|
|
|
|
CATEGORICAL_AXES = {
|
|
"pipeline",
|
|
"epilogue",
|
|
"scheduler",
|
|
"reduction_strategy",
|
|
"pad_m",
|
|
"pad_n",
|
|
"pad_k",
|
|
"persistent",
|
|
"a_preshuffle_quant",
|
|
"b_preshuffle_quant",
|
|
}
|
|
|
|
|
|
def normalize_axis_values(feasible_set, axes=None):
|
|
"""Compute normalization metadata for each axis.
|
|
|
|
Returns dict mapping axis name to:
|
|
- For numeric axes: {"type": "numeric", "min": v, "max": v, "range": v}
|
|
- For categorical axes: {"type": "categorical", "values": sorted list, "map": value->index}
|
|
"""
|
|
if axes is None:
|
|
axes = GEMM_AXES
|
|
|
|
meta = {}
|
|
for ax in axes:
|
|
values = [item[ax] for item in feasible_set if ax in item]
|
|
if not values:
|
|
continue
|
|
|
|
if ax in CATEGORICAL_AXES:
|
|
unique = sorted(set(str(v) for v in values))
|
|
meta[ax] = {
|
|
"type": "categorical",
|
|
"values": unique,
|
|
"map": {v: i for i, v in enumerate(unique)},
|
|
"count": len(unique),
|
|
}
|
|
else:
|
|
num_values = [float(v) for v in values]
|
|
mn, mx = min(num_values), max(num_values)
|
|
meta[ax] = {
|
|
"type": "numeric",
|
|
"min": mn,
|
|
"max": mx,
|
|
"range": mx - mn if mx != mn else 1.0,
|
|
}
|
|
return meta
|
|
|
|
|
|
def normalize_point(item, axes, meta):
|
|
"""Normalize a single point to [0, 1] per axis."""
|
|
coords = []
|
|
for ax in axes:
|
|
if ax not in meta or ax not in item:
|
|
coords.append(0.0)
|
|
continue
|
|
m = meta[ax]
|
|
if m["type"] == "numeric":
|
|
coords.append((float(item[ax]) - m["min"]) / m["range"])
|
|
else:
|
|
coords.append(m["map"].get(str(item[ax]), 0) / max(m["count"] - 1, 1))
|
|
return coords
|