code-roamer's picture
Publish GPU Kernel Benchmark v0.8.1 public edition
5d12def verified
|
Raw History Blame Contribute Delete
13.1 kB
metadata
license: mit
language:
  - en
  - zh
pretty_name: GPU Kernel Benchmark
task_categories:
  - text-generation
size_categories:
  - n<1K
tags:
  - benchmark
  - code
  - cuda
  - triton
  - gpu
  - kernel-optimization
  - h100
  - b200
configs:
  - config_name: tasks
    default: true
    data_files:
      - split: public
        path: data/tasks.parquet
  - config_name: workloads
    data_files:
      - split: public
        path: data/workloads-public.parquet
      - split: calibration
        path: data/workloads-calibration.parquet
      - split: smoke
        path: data/workloads-smoke.parquet

GPU Kernel Benchmark

An executable benchmark for AI agents that implement and optimize GPU kernels. Protocol v0.8.1, public edition 1, source publication 2026-11-27.

Item Coverage
Scored research questions 50, equally weighted
Submission packs 51 across 14 capability groups
Public / calibration workloads 155 / 155
Smoke workloads 51
Hardware 50 packs on one H100 80GB; Shared Mega MoE on one 8xB200 node
Forward and backward CSA2 reindex/reuse and Shared Mega MoE
Agent development budget 4 hours per pack, including public evaluation; no round limit
Final submission policy Score the last submitted code

Correctness, CUDA Graph replay with changed inputs, paired latency, timing stability, and fixed-module integration are evaluated. The complete grader, numerical references, frozen performance baselines, task statements and submission templates are included. Parquet files provide a browsable index; GPU execution is required to obtain a score.

Browse and load the tasks

The default tasks configuration contains one row per submission pack. It includes the frozen task statement, contract, function template, hardware, baseline and public cases. workloads has separate public, calibration and smoke splits. Heterogeneous workload parameters are serialized in case_json or public_cases_json.

import json
from datasets import load_dataset

tasks = load_dataset("code-roamer/gpu-kernel-benchmark", "tasks", split="public")
workloads = load_dataset("code-roamer/gpu-kernel-benchmark", "workloads", split="public")
case = json.loads(workloads[0]["case_json"])

Download and run

pip install -U huggingface_hub
hf download code-roamer/gpu-kernel-benchmark --repo-type dataset --local-dir gpu-kernel-benchmark
cd gpu-kernel-benchmark
chmod +x python-gpu upstream-env.sh
python3 verify.py
python3 bench.py list

Follow the English quickstart to build H100 or B200 containers, install from public upstream sources, and run controls or submissions. Use Python 3.11 on x86-64 Linux for GPU evaluation. The portable release ZIP contains the same evaluation code and task packs, with executable file permissions. No private NAS, internal model gateway, or organization-specific service is required.

Capability coverage

Group Direction Packs
K01 Attention primitives 4
K02 Dense and structured attention 7
K03 Multi-head latent attention 3
K04 Sparse attention and CSA2 5
K05 Attention indexing 1
K06 FP8 attention and KV cache 3
K07 QK normalization, RoPE and cache writes 1
K08 Linear attention 4
K09 Projection and low-rank adaptation 3
K10 Quantized GEMM 4
K11 Fused activation, normalization and quantization 3
K12 MoE and expert parallelism 6
K13 State-space kernels 3
K14 Sampling and decoding kernels 4

Evaluation and scoring

Correctness is checked against independent mathematical references, separately from the performance baseline. Only correct, timing-stable submissions receive speedup credit. For eligible questions, points are 100 * max(0, log2(L)), where L is the paired 95% lower confidence bound of the hidden kernel speedup. Aggregate across all 50 questions. The two ATT-A06 interfaces share one question; their log-speedups are weighted by hidden case count. CSA2 and Shared Mega MoE weight forward/backward equally. Infrastructure failures and incomplete campaigns do not produce an official full score.

The public release excludes the original sealed evaluation inputs and private run artifacts. Generate a fresh hidden split with the supplied scaffold, keep it on the grader, and freeze it across compared agents. Give an agent only its task statement, contract, submission template and public development cases; the repository also contains trusted grader/reference code that should remain outside its working context.

Validation, provenance and limitations

validation.json records historical installation controls on native H100 and eight-B200 environments, for both the restored dependency path and public-source build path. These controls passed 51/51 smoke workloads for each installation path. They are not model scores and do not prove a complete Docker build on every host. New binaries, drivers or GPU models need local qualification and calibration. The four v0.8.1 reference kernels have frozen hashes and provenance.

The source publication includes the later artifact-compaction support; task contracts, workloads, reference-kernel hashes and scoring rules are unchanged. Python-only release checks and 33 relevant regression tests passed before this publication. Full GPU evaluation was not rerun as part of the upload. Historical comparison details may use different agent budgets and are not a fresh leaderboard for this publication.

This is a research benchmark for the specified hardware and workload distributions. The fixed integration block is synthetic, not a complete serving or training workload. The grader assumes cooperative submissions; process isolation is not an adversarial security sandbox. No energy-efficiency ranking is claimed. The task pack text is frozen and contains English and Chinese; reproduction guides are in English.

License

Original code and documentation use MIT. The derived Marlin layout helper retains its Apache-2.0 attribution and license; separately installed dependencies retain their own licenses. See NOTICE.md.

Detailed reproduction guide

GPU Kernel Benchmark · public edition 1

Protocol v0.8.1. 50 equally weighted research questions, 51 submission packs and 14 capability groups. The public and calibration splits each contain 155 workloads. The smoke split has one workload per pack. 50 packs run on one H100 80 GB each. Shared Mega MoE requires one host with eight peer-connected B200 GPUs (EP=8). CSA2 and Mega MoE evaluate both forward and backward.

Build from the extracted release with the single-H100 Dockerfile or the eight-B200 Dockerfile. The quickstart covers GPU access, the first baseline run, and submitting a kernel on your own machine.

Inspect the release

From the extracted directory, with Python 3.11:

python3 verify.py
python3 bench.py list

Every directory under kernel_bench/taskpacks/v0.8.1-kernels/ contains the statement (TASK.md), numerical and workload contract (contracts.md), callable signatures (submission.py), metadata and public cases. Copy the submission template outside the release and implement the functions. Use the other files as the agent's task input. The four historical reference kernels and their SHA-256 hashes are under kernel_bench/baseline_v081/. The evaluator computes expected outputs independently.

Prepare a Linux GPU host

Use x86-64 Linux, Python 3.11, NVIDIA driver compatible with CUDA 12.9, CUDA 12.9 toolkit (frozen nvcc 12.9.86), PyTorch 2.9.1+cu128 and Triton 3.5.1. Native builds also need GCC/G++ (the reference build used 13.4), Git, CMake, Ninja, Python headers, and development headers for libelf and libdw. B200 requires working NCCL, NVLink, CUDA symmetric memory and profiler access. Run the grader on idle exclusive GPUs.

  • Public upstream build. From the release root run bash upstream-env.sh. It creates a local virtual environment, installs pinned binary distributions and builds FlashMLA and DeepGEMM from pinned Git revisions with their submodules. On Debian, use the native system compiler for FlashMLA and, when needed, a GCC 13 compiler for DeepGEMM, e.g. CC=gcc CXX=g++ DEEPGEMM_CXX=g++-13 bash upstream-env.sh. The compiler and runtime host must have a matching libstdc++ (GCC 13 builds can require GLIBCXX_3.4.31). If using a separate compiler prefix, include its runtime library directory in LD_LIBRARY_PATH for both preflight and evaluation. A cross compiler additionally needs host multiarch headers and linker startup objects. The PyTorch wheel index, PyPI and GitHub must be reachable. Rebuilt native code must be qualified on the target driver and hardware before comparing scores.
  • Frozen dependency restore. If supplied with the companion archive named in kernel_bench/h100_runtime.lock.json, create the base environment and restore the expert binaries and Mamba source into this checkout:
bash upstream-env.sh base
python3.11 -m kernel_bench.restore_h100_runtime /path/to/h100-runtime-v05-linux-cp311-r2.tar.gz

An existing matching Python can be selected with KERNELBENCH_BASE_PYTHON (absolute executable path). On each H100 host, run ./python-gpu -m kernel_bench.preflight_h100. On the B200 host, run the 8-GPU control below. A different GPU model, software stack, or new binary build needs a separately reported calibration.

Run controls and submissions

python3 bench.py smoke window_prefix_attention --device 0 --out runs/h100-control
python3 bench.py run window_prefix_attention --candidate /path/to/submission.py --device 0 --out runs/my-window
python3 bench.py smoke csa2_reindex_reuse --device 0 --out runs/csa2-control
python3 bench.py smoke shared_mega_moe --device 0,1,2,3,4,5,6,7 --out runs/moe-control

Use a new output directory each time. The smoke commands use the trusted baseline as the candidate to check the installation. For scored submissions, the results include correctness, paired latency samples and stability. Ordinary kernels also include a fixed synthetic module measurement and allocator profiles. The module measurement describes that module, not serving latency.

The frozen dependency restore and the independent public-source build each passed 51/51 smoke workloads (50 on H100, one on 8×B200); per-task results and result hashes. These are installation controls. To repeat the additional 50-step training-trajectory check on an idle 8×B200 node, run:

./python-gpu -m torch.distributed.run --standalone --nproc-per-node=8 kernel_bench/candidates/shared_mega_moe/train_lm.py --native --steps 50

Reproduce an agent comparison

The scaffold accepts a configurable model endpoint and SSH-accessible Linux GPU grader(s). Install this same source on the controller and workers. The H100/B200 workers share the grader directory; model credentials are read on the controller. Copy agent.example.json to agent.local.json, edit your endpoint, model, key environment variable, paths and SSH hosts, then run from the checkout root:

python3 -m kernel_bench.agent_trial --config agent.local.json --out kernel_bench/results/my-trial
python3 -m kernel_bench.summarize_trials kernel_bench/results/my-trial

The standard agent run gives each model four hours per pack, shared by model calls, revisions and public GPU evaluation. Both turns and public_evaluation_seconds are null. Final grading runs after the last submission is frozen. Record the scaffold version, time limits, rounds, token usage and model latency with each score. The controller returns only public feedback during development. Omit turns or use null for time-budgeted iteration. Reuse a newly sealed split for comparisons using the first run's private_reference run basename and hidden_suite_sha256 map (configuration keys run and suite_sha256). Keep that split on the grader. Only the last submitted code is judged. The original leaderboard's sealed inputs are excluded.

Scoring

For each eligible research question, use the hidden kernel speedup's paired 95% lower bound L. Public and hidden correctness and hidden timing stability (CV ≤10%) are required. Points = 100 × max(0, log2 L). Both ATT-A06 interfaces share one question; their hidden cases contribute in proportion to case count. CSA2 and Mega MoE weight both phases equally. Average over the 50 questions. Infrastructure failures and incomplete campaigns do not yield a full ranking. A smoke run or a single public result is not a leaderboard score. Raw speedups, fixed module measurements and scores answer different questions.

Published comparison · Baseline qualification · License · Third-party provenance.