hn.today

Show HN: Agentic CUDA Kernel Optimizer

github.com4 points0 comments
Screenshot of Show HN: Agentic CUDA Kernel Optimizer

An agent-driven CUDA kernel optimizer that uses LangGraph and a large language model to iteratively generate, validate, benchmark, and refine GPU kernels and launch configurations. It compiles candidate kernels on the fly with NVRTC and launches them via the CUDA Driver API from a C++ harness, while Python orchestrates output comparison (against a NumPy reference), candidate selection, and result recording. The agent can query GPU properties, inspect Nsight Compute counters, and retrieve NVIDIA documentation to guide optimizations; every experiment is recorded and the fastest validated implementation is preserved. Ranking is based on the geometric mean of latency across performance cases, and the model can repair invalid candidates within an iteration budget.

Practical details include development on Windows with an RTX 3060, requirements of Python 3.12+, an NVIDIA GPU and compatible CUDA toolkit/driver, CMake, a C++17 compiler, and an OpenAI API key; the default LLM is gpt-5-mini. Timing defaults to 10 warmups and 100 measured launches; compilation and profiler replay are excluded from ranking. Runs produce a results/run-NNN directory with sources, inputs/outputs, history.json, summary.json, best.cu, and heatmaps; optional flags enable Nsight profiling and NVIDIA research. This is experimental: per-case passes do not guarantee general correctness, generated references are not independent oracles, improvements are workload-dependent, no vendor-library comparisons are included, and generated code/scripts execute locally without sandboxing.

Read on github.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.