A controlled A/B benchmark of the same agent model with and without a custom cuda-kernel-super skill, on KernelBench problems, executed end to end on one RTX 5080 Laptop GPU: the measured evidence and the honest verdict
Amp (ampcode.com) · the agent under test
ESL · skill design, hardware, scoringOne base model, one serial evaluator, every run preserved on disk
fp16 tensor-core GEMM vs fp32 cuBLAS reference, 4096×4096
less GPU time per matmul with the skill's fp16 tensor-core kernel (2.81×)
Embedded software consultancy, Parasoft and Perforce partner in Israel for over 20 years. This brief documents the ESL KernelBench agent skill pilot.
linkedin.com/in/liezrowiceThe selection criterion was brutal and simple: the benchmark must execute on a 16 GB consumer Blackwell GPU in WSL2 without renting cloud silicon
| Benchmark | What it evaluates | Baseline hardware | Runs on RTX 5080 Laptop? |
|---|---|---|---|
| KernelBench (ScalingIntelligence) | Agent writes optimized CUDA/Triton kernels from PyTorch references; fast_p metric = correct and faster | Any local GPU; published runs on RTX 3090 | Yes · selected |
| NVIDIA SOL-ExecBench | 235 production kernel problems scored against B200 roofline (SOL-Score) | B200, SM clocks locked 1500 MHz | Harness runs locally, but SOL-Score normalization is B200-specific; relative-only locally |
| NVIDIA SWE-Serve | 53 SWE-style tasks from SGLang: 41 GPU inference-serving tasks, 12 CPU tasks | H100 80 GB | No · 16 GB VRAM cannot hold the serving workloads |
4 problems spanning the performance regimes: memory-bound reduction (Softmax, sum reduction), compute-bound GEMM (square matmul), and a Level-2 fusion chain (GEMM + multiply + LeakyReLU).
A solution scores only if it passes allclose(rtol=1e-2, atol=1e-2) on multiple seeds against the PyTorch reference; the reported number is the median speedup ratio.
Everything ran on the laptop the pilot owns: the same machine that browses email also compiled and timed every kernel
NVIDIA GeForce RTX 5080 Laptop, Blackwell, 16 GB GDDR7, 55 W power cap (80 W default); this detail shapes the whole methodology
Host driver 595.71 / CUDA 13.2; toolkit CUDA 12.8 at /usr/local/cuda-12.8; WSL2 kernel 6.6
torch 2.14.1+cu130 on Python 3.10 (KernelBench pins ==3.10.*), built with uv sync, ~6.6 GB of wheels
uv venv --python 3.10 + uv sync: 22 min, dominated by the CUDA wheel setload_inline first compile per extension: 30-90 s (nvcc, arch=compute_120,code=sm_120)~/.cache/torch_extensions makes later iterations near-instant; the skill teaches agents to keep CUDA source stable to reuse itAt a 55 W cap the GPU dynamically throttles: SM clocks observed as low as 180 MHz, and the reference softmax measured 55.9 ms in one session and 716.7 ms in another. Sequential A-then-B timing is worthless on this machine; the pilot's protocol uses interleaved ref/candidate timing to cancel it (slide 09).
cuda-kernel-super did not exist; no CUDA optimization skill was installed. It was built the morning of the pilot from researched public material plus machine-specific truths
KernelFlow cuda-kernel-optimizer (MIT, GitHub) KernelBench eval methodology (ICML '25) · ncu-driven profile → optimize → verify loop · task contract: same Model.__init__/forward, · roofline gap analysis (Δc / Δm / Δl) same shape, same dtype · SASS verification of claimed optimizations · 2-seed allclose(rtol=1e-2, atol=1e-2) gate · per-method ablation attribution · anti-reward-hacking stance └──────────────┬──────────────────────────────────────┘ ▼ ┌─────────────────────────────────────────────┐ │ cuda-kernel-super (SKILL.md + reference/ │ │ + pitfalls + bundled scripts/bench.py) │ └─────────────────────────────────────────────┘ ▲ Machine-specific truths (none of the sources had these) · arch flag compute_120/sm_120 (a silent failure otherwise) · interleaved ref/cand timing (the 55 W throttle) · Triton autotune timeouts; TORCH_CUDA_ARCH_LIST="12.0"
Hugging Face cuda-kernels (HF Hub packaging, irrelevant to KernelBench), NVIDIA TileGym (cuTile-DSL only), and KernelFlow's heavyweight orchestration scripts (geared to optimizing an existing kernel with fixed dims, not writing one from a problem statement). The skill keeps the methodology, not the machinery.
SKILL.md (workflow, contract, checklist) + reference/techniques.md (bottleneck → technique catalog with CUDA snippets) + reference/pitfalls.md (failure modes that waste turns) + scripts/bench.py (the honest evaluator itself ships with the skill).
The skill forces an analysis step before any code: classify the op's regime, compute the roofline, and only then pick techniques in expected-impact order
| Bottleneck | Diagnostic | Techniques, in order |
|---|---|---|
| Bytes moved (memory-bound) | element-wise, norms, reductions; ceiling = bytes / ~900 GB/s | 1. fuse the op chain · 2. coalesce + vectorize (float4) · 3. shared-memory staging with bank-conflict padding · 4. __ldg / read-only path · 5. warp-shuffle reductions |
| Math throughput (compute-bound) | large GEMM/conv; ceiling = tensor-core TFLOPS | 1. tiled matmul in shared memory · 2. mma.sync / TF32 or fp16 tensor cores, fp32 accumulate · 3. cp.async K-tile pipelining · 4. occupancy repair (--ptxas-options=-v) · 5. or: stay on cuBLAS and fuse the epilogue instead |
| Launch overhead (tiny kernels) | runtime ≈ 2-5 µs per launch | merge kernels · precompute in __init__ · CUDA graphs only for static sequences |
Iterate one technique per edit, re-verify, re-benchmark. Stop at 10-20% from the roofline, or after three consecutive attempts gain under 2% (the noise floor). This rule exists because the throttling makes endless micro-tuning a trap.
The skill quotes ~900 GB/s GDDR7 as the spec ceiling. The skill-condition agent later measured 540 GB/s achievable linear read under the throttle; the skill's numbers are spec sheets; the pilot's numbers are the machine (slide 10).
Both conditions are the same base model instantiated as subagents of the same thread; nothing differs except access to the skill
KernelBench problem (reference Model + get_inputs + fixed shapes) │ ├──▶ Condition NOSKILL: plain task prompt │ └─▶ agent run ──▶ pilot/<problem>/noskill/model_new.py │ │ └──▶ Condition SKILL: same prompt │ + "read and follow │ cuda-kernel-super first" │ └─▶ agent run ──▶ pilot/<problem>/skill/model_new.py │ ▼ ┌────────────────────────────────────────────────────────┐ │ SINGLE SERIAL EVALUATOR (bench.py, one scoring session)│ │ 1. two-seed correctness, allclose(1e-2, 1e-2) │ │ 2. L2 cache flushed (256 MB zero_) between reps │ │ 3. ref and candidate INTERLEAVED, medians of 100 reps │ └────────────────────────────────────────────────────────┘ │ ▼ speedup = ref_ms / cand_ms (ratio only; slide 09 explains why absolute milliseconds do not travel)
The two agents of a wave run in parallel but their self-timing shares the GPU; final scores are always produced serially afterward, never from an agent's own claim. Agent self-timings are recorded only as corroboration.
Two seeds with fresh inputs, a reward-hacking rule in both prompts ("no caching, no hard-coded outputs"), and an evaluator that reseeds before each model construction.
Median speedup vs the PyTorch reference, bench.py final harness, 100 interleaved L2-flushed reps. All scores from a single session on 10 November 2026
Max absolute deviation from the reference for each scoring run, on a log10 axis. The gate is allclose(rtol=1e-2, atol=1e-2); every bar left of 10⁰ passes with margin
The two softmax kernels differ from the reference by ~10⁻¹²: bit-level agreement on a numerically hard op, because both reimplemented the same online-softmax rescaling in fp32.
The 10⁻²-to-10⁻¹ bars are tensor-core runs: TF32 and fp16 input rounding. Legal, they pass the gate, and the skill's tolerance-margin analysis (diff 0.055 against a per-element budget of ~10) is exactly the reasoning that keeps them honest.
Every scored run was verified on two seeds with fresh inputs; no solution caches outputs or hard-codes results. The gate plus fresh inputs is what makes the speedup numbers on the previous slide trustworthy.
Median time of the identical softmax reference across scoring sessions. Absolute milliseconds do not survive this machine; ratios do. This is why the pilot's metric is the speedup ratio and nothing else
torch.softmax on the identical problem, five scoring runs across two days, no kernel change between any of them. The 630-717 ms cluster predates the final measurement harness and was measured under 55 W throttling; 253 ms is the final harness; 55.9 ms was the agents' healthier-clock session. Same GPU, same kernel, 12.8x spread.Speedup ratios from interleaved reps stayed in a narrow band across all of this (0.80-1.25x on softmax across sessions); raw milliseconds moved 12x. Cross-session comparisons of absolute time on this machine are meaningless, and any benchmark protocol that does not control for it produces fiction.
The skill-condition agent measured the machine before optimizing: pure linear read bandwidth under throttle. That single number explains the softmax and sum-reduction results
When the ceiling is bandwidth and the reference already touches it, no kernel technique wins. The 0.79x-0.97x scores on memory-bound problems are not agent failures; they are the machine refusing to be beaten at parity. The skill's stop rule (three attempts under 2% → stop) prevented both agents from burning turns on an impossible target.
Compute-bound problems are a different story: torch's fp32 SGEMM leaves 2-3x on the table for any solution that may change input precision under the tolerance gate. That is where both conditions' only >1.4x results came from.
Same model, same problems, same evaluator. The difference the skill makes is not uniform; it is concentrated exactly where its guidance has something to say
skill condition (3 runs) vs 1.22x noskill (4 runs)
fp16 tensor-core GEMM with fused bias + scale + LeakyReLU epilogue
fp16 tensor-core GEMM with fp32 accumulate: the skill's "don't hand-roll against cuBLAS; change precision under the tolerance gate; fuse the epilogue" path
Memory-bound problems: both conditions scored 0.79-0.97x against references that already saturate the throttled 540 GB/s. The skill cannot repeal the roofline; it correctly told its agent to stop trying (the stop rule), which saved turns, not milliseconds.
Three rule changes shipped into the skill during the pilot itself: interleaved timing, profiling hygiene, and a robustness rule (slide 12). The next agent inherits them for free.
A skill is only worth installing if the benchmark can change it. Three changes shipped while the pilot was still running
| Change | Trigger | Where it lives now |
|---|---|---|
| Interleaved timing rule: never time A fully before B; alternate reps, compare medians | Smoke test showed identical code at 0.65x; both wave-1 agents independently hit the same wall | SKILL.md §Benchmark honestly + bench.py itself |
| Clone once, outside the clock; realistic-shape profiling | Skill agent proved the timed region was 94% memcpy on 8.6 GB inputs | bench.py + pitfall material |
| Pitfall #15: never manipulate global RNG state; report harness anomalies, never patch them in the solution | Robustness review of the fusion run | reference/pitfalls.md |
Benchmark → failure → rule → skill. Each iteration is cheap (one pitfall, one paragraph), which is the same economy the ESL zero-program applies to MISRA fixes: versioned, reviewable units of improvement, not one-off patches.
The technique catalog needed no edits: every technique it recommends was either used by a winning run or correctly deprioritized by a stop rule. The catalog predicted the matmul result before the pilot ran it.
No cloud, no secrets, no lost state: the pilot is a directory tree plus one venv
Repo /home/danie/KernelBench (KernelBench clone, main) Environment /home/danie/KernelBench/.venv (Python 3.10, torch 2.14.1+cu130) Skill /home/danie/KernelBench/.agents/skills/cuda-kernel-super/ Solutions /home/danie/KernelBench/pilot/<problem>/{noskill,skill}/model_new.py Resume state /home/danie/KernelBench/pilot/STATE.md Progress log Amp artifact: KernelBench CUDA skill A/B pilot (rev 6) # score any solution the way this deck did /home/danie/KernelBench/.venv/bin/python \ /home/danie/KernelBench/.agents/skills/cuda-kernel-super/scripts/bench.py \ --ref KernelBench/level1/1_Square_matrix_multiplication_.py \ --cand pilot/matmul/skill/model_new.py --reps 100 # next experiments the data points to · re-run the fusion skill condition with pitfall #15 in place (expect: correct, ~3.7x) · rescore both conditions in a fixed-clock session (plugged in, locked power) · extend to Level 3 full-model problems where fusion compounding shows up
One glance: the same agent, with and without the CUDA skill, scored by one honest evaluator
with the skill, vs 1.43× plain: the fastest kernel of the pilot
less GPU time per matmul with the skill's tensor-core kernel (2.81×)
with the skill vs 1.22× plain; compute-bound gain roughly doubles
| Problem | Plain agent | With CUDA skill | Reading |
|---|---|---|---|
| Square matmul (compute-bound) | 1.43× | 2.81× | skill doubles the GPU-time saving |
| GEMM + LeakyReLU (fusion) | 1.71× | 3.69× | fastest kernel of the pilot; its working practice is now a rule in the skill |
| Softmax (memory-bound) | 0.95× | 0.80× | parity; the hardware wall decides, not the agent |
| Sum reduction (memory-bound) | 0.79× | 0.97× | parity at the 540 GB/s bandwidth limit |
Where GPU time costs money (compute-bound kernels), the skill roughly doubles the agent's speedup, up to 2.81× (64% less GPU time). Where the reference already saturates memory bandwidth, nothing wins. Every lesson of the pilot is already built into the skill, so the next run starts ahead.
The pattern generalizes beyond CUDA: one question, two conditions, one honest evaluator, and every lesson becomes a rule the next run starts with
KernelBench
github.com/ScalingIntelligence/KernelBench
cuda-kernel-super
KernelFlow methodology + KernelBench contract + machine truths
Pilot artifact, rev 6
all scores, reports, and decisions
Embedded software consultancy, Parasoft and Perforce partner in Israel for over 20 years.
linkedin.com/in/liezrowice