HeadlinesBriefing favicon HeadlinesBriefing.com

Agentic CUDA Kernel Optimizer with LangGraph

Hacker News •
×

This project introduces an agentic CUDA kernel optimizer that transforms workload descriptions into GPU implementations through automated code generation, correctness checks, benchmarking, and refinement. Powered by LangGraph, the agent explores kernel implementations and launch configurations, queries GPU properties, and can research NVIDIA documentation for optimization guidance. It also inspects Nsight Compute counters to inform its next experiment. Each experiment is recorded, and the fastest validated implementation is retained.

The model can change both kernel code and per-case launch configurations. A standalone C++ harness compiles kernels with NVRTC, launches them through the CUDA Driver API, and saves outputs. Python handles comparison and candidate selection. The system requires Python 3.12+, an NVIDIA GPU, and compatible CUDA Toolkit/driver, along with CMake 3.24+ and a C++17 compiler. Setup involves creating a virtual environment, installing dependencies, and configuring the build with Visual Studio 2026.

Users can run the optimizer with a workload description, such as "Single-precision GEMM with rectangular matrices," and specify a maximum number of iterations. The default model is gpt-5-mini with medium reasoning effort, and API usage is billed to the user's account. Optional flags enable profiling with Nsight Compute and retrieving NVIDIA research guidance before generating kernels.