← /editions
#100

Show HN: Agentic CUDA Kernel Optimizer

// An open-source LangGraph agent writes, compiles, validates, profiles, and iteratively refines CUDA kernels, keeping only the fastest validated candidate. It is a clean template for agents in domains where results can be measured automatically.

$ today_in_10_seconds

A Show HN project gives an agent a compiler, a benchmark harness, and Nsight Compute, then lets it iterate on CUDA kernels until one is both correct and faster. The interesting part isn't the model. It's the loop, where every candidate gets measured and nothing ships on vibes.

$ lead_story

Show HN: Agentic CUDA Kernel Optimizer

A new open-source LangGraph agent takes a plain-English workload description (for example, "single-precision GEMM with rectangular matrices") and turns it into an optimized CUDA kernel. It works through a closed loop of generating code, compiling it with NVRTC, checking outputs against a reference, benchmarking, and refining. The agent can change both the kernel code and the launch configuration for each case. It can also query GPU properties, pull NVIDIA optimization docs, and read Nsight Compute counters to decide what to try next. Only the fastest candidate that passes every validation case survives, and the whole experiment history is logged. It uses gpt-5-mini by default and was built on an RTX 3060 laptop GPU. For builders, it's a clean template for any domain where success can be measured automatically: give the agent a harness it can't argue with, and let it iterate.

// why_it_matters: When the reward signal is a stopwatch and a correctness check, agents stop guessing and start doing engineering.

read more →

$ also_worth_attention

  • The harness is the real product

    Compilation and launch run through a standalone C++ harness on the CUDA Driver API, while Python handles comparison and candidate selection. Candidates are ranked by the geometric mean of latency across performance cases, using 10 warmup launches and 100 timed launches with CUDA events, and compile time is excluded. If you're building any self-improving agent, copy this separation: the model proposes, and deterministic code decides.

    link →
  • Read the limits section before you get excited

    The author is refreshingly blunt. Passing the supplied test cases doesn't prove the kernel is correct in general, and a model-generated reference kernel isn't an independent oracle. There is also no comparison against cuBLAS yet. That last gap is the real test: beating your own starting kernel is easy, and beating vendor libraries is the job.

    link →
  • No sandbox. Plan accordingly.

    Input-generation scripts written by the model run as local Python subprocesses without a sandbox, and the generated kernels run directly on your GPU. That's fine for a weekend experiment on a dev box. It's not fine for anything that shares a machine with credentials or production workloads.

    link →

$ bigger_picture

The trend behind the headlines

Agents are most useful where the environment grades them. Kernel optimization is a near-perfect fit because outputs either match or they don't, and latency is a number. This project shows the pattern well: tools for observation (profiler counters, GPU properties), tools for research (vendor docs), a repair path for broken candidates, and a fixed iteration budget. The weak point is the same one every self-verifying agent has, which is that the agent can be graded by an oracle it helped write. The next leap here isn't a smarter model. It's independent references and real baselines.

$ tool_of_the_day

KernelBench

KernelBench is Stanford's benchmark for LLM-generated GPU kernels. It gives models PyTorch workloads to rewrite as faster kernels and checks both correctness and speedup against the PyTorch baseline. It's the independent yardstick today's project is missing, and a good way to test whether your kernel agent actually beats a real baseline.

explore KernelBench →

$ subscribe --free

Get the next edition in your inbox

// DAIly Agent covers agentic AI three times a week

// free, no spam, exit anytime