Datasets:
Download kernel_bench/kernel_v08.py from code-roamer/gpu-kernel-benchmark: direct link, hf CLI and curl.
- Browser
- Download file 4.01 kB
-
https://huggingface.co/datasets/code-roamer/gpu-kernel-benchmark/resolve/main/kernel_bench/kernel_v08.py
- Command line
-
hf download hf://datasets/code-roamer/gpu-kernel-benchmark/kernel_bench/kernel_v08.py
-
curl -L -o kernel_v08.py https://huggingface.co/datasets/code-roamer/gpu-kernel-benchmark/resolve/main/kernel_bench/kernel_v08.py
4.01 kB
| """Build the v0.8 scoring and diagnostic tracks from the frozen kernel workloads.""" | |
| import json | |
| import shutil | |
| from . import kernel_v07, main_h100 | |
| from .build_sparse_suites import write | |
| ROOT = kernel_v07.ROOT | |
| VERSION = "0.8.0" | |
| PACK = "v0.8-kernels" | |
| DIAGNOSTIC_PACK = "v0.8-diagnostics" | |
| MOVED = {"masked_softmax", "merge_attention_states"} | |
| DIAGNOSTICS = main_h100.DIAGNOSTICS | MOVED | |
| def catalog(diagnostic=False): | |
| data = kernel_v07.catalog() | |
| tasks = data["tasks"] | |
| if diagnostic: | |
| tasks = tasks + [spec for spec in main_h100.previous.catalog()["tasks"] | |
| if spec["id"] in main_h100.DIAGNOSTICS] | |
| tasks = [s for s in tasks if (s["id"] in DIAGNOSTICS) == diagnostic] | |
| return dict(data, version=VERSION, track="diagnostic" if diagnostic else "main", | |
| research_entries=len({s["research_ids"][0] for s in tasks}), | |
| diagnostic_tasks=sorted(DIAGNOSTICS), tasks=tasks) | |
| def suite(smoke=False, seed=None, private=False, diagnostic=False): | |
| data = kernel_v07.suite(smoke, seed, private) | |
| cases = [c for c in data["cases"] if (c["task"] in MOVED) == diagnostic] | |
| if diagnostic: | |
| cases += main_h100.suite(smoke, seed, private, diagnostic=True)["cases"] | |
| track = "diagnostic" if diagnostic else "main" | |
| split = data["suite_id"].rsplit("-", 1)[1] | |
| return dict(data, protocol_version=VERSION, track=track, split=split, cases=cases, | |
| suite_id=f"kernel-v08-{track}-{split}", provenance=f"v0.8 {track} selection of frozen workloads.") | |
| def validate(data): | |
| if data.get("protocol_version") != VERSION: | |
| return | |
| track = data.get("track") | |
| if track not in ("main", "diagnostic"): | |
| raise ValueError("v0.8 suite requires a main or diagnostic track") | |
| diagnostic = track == "diagnostic" | |
| legacy_controls, inherited = [], [] | |
| for case in data["cases"]: | |
| task = case["task"] | |
| if (task in DIAGNOSTICS) != diagnostic: | |
| raise ValueError(f"{task} belongs to a different v0.8 track") | |
| if task in main_h100.DIAGNOSTICS: | |
| legacy_controls.append(case) | |
| else: | |
| inherited.append(case) | |
| main_h100.validate_cases(dict(data, protocol_version=main_h100.VERSION, track="diagnostic", cases=legacy_controls)) | |
| kernel_v07.validate(dict(data, protocol_version=kernel_v07.VERSION, track="main", cases=inherited)) | |
| def score_trials(rows): | |
| ranking = main_h100.score_trials(rows, catalog()["tasks"], VERSION) | |
| if ranking is not None: | |
| ranking["task_packs"] = ranking.pop("interfaces") | |
| return ranking | |
| def build(): | |
| for diagnostic, pack in ((False, PACK), (True, DIAGNOSTIC_PACK)): | |
| specs = catalog(diagnostic) | |
| suffix = "_diagnostics" if diagnostic else "" | |
| write(ROOT / f"kernel_catalog_v08{suffix}.json", specs) | |
| public = suite(diagnostic=diagnostic) | |
| splits = {"public": public, "calibration": suite(seed=2026111307, diagnostic=diagnostic), | |
| "smoke": suite(smoke=True, diagnostic=diagnostic)} | |
| for name, data in splits.items(): | |
| write(ROOT / "suites" / f"kernel_v08{suffix}_{name}.json", data) | |
| for spec in specs["tasks"]: | |
| task = spec["id"] | |
| origin = "v0.5-h100-kernels" if task in main_h100.DIAGNOSTICS else kernel_v07.PACK | |
| target = ROOT / "taskpacks" / pack / task | |
| shutil.copytree(ROOT / "taskpacks" / origin / task, target, dirs_exist_ok=True) | |
| path = target / "public_cases.json" | |
| original = json.loads(path.read_text()) | |
| cases = [c for c in public["cases"] if c["task"] == task] | |
| if cases != original["cases"]: | |
| raise ValueError(f"Public workloads changed for {task}") | |
| write(path, dict(original, protocol_version=VERSION, track=public["track"], split="public", | |
| suite_id=public["suite_id"] + "-" + task, provenance=public["provenance"])) | |
| if __name__ == "__main__": | |
| build() | |