Profile and tune a CUDA kernel with an agent

They used a LangGraph agent to test CUDA kernel tweaks, verify results, and profile candidates with Nsight.

Done with Custom agentยท Advanced

What they did
They started with a workload description or their own kernel, reference, and test cases. The agent suggested changes to the kernel and launch settings, while a C++ harness compiled each version with NVRTC and ran it through the CUDA Driver API. Python then compared results with NumPy and timed each candidate; if a version failed, the agent tried to repair it within the allowed iteration budget. Optional steps added Nsight Compute profiling and checks against NVIDIA documentation.
How it went
The README showed float32 GEMM running on an RTX 3060 Laptop GPU, and a second run picked up from the best kernel found earlier. It did not report speedup figures or compare the result with cuBLAS.
Tips
Be careful with generated scripts: they run on your machine without sandboxing, and API calls are billed to you. Treat any generated reference output as a helpful check, not as a full proof of correctness.

Try it yourself with Claude Code

I want to improve a CUDA kernel in [file path] for [operation]. Use a test harness to compile candidate versions with NVRTC, run them through the CUDA Driver API, compare outputs against [reference check, e.g. NumPy], and benchmark each one. Propose one change at a time, run Nsight Compute profiling when useful, and keep only versions that pass correctness. If a candidate fails, try to fix it within the current iteration limit. Pause and ask for my approval before any step that would send code, submit jobs, delete files, or make other irreversible changes. Finish by summarizing the best kernel, launch settings, and measured timings.

Fill in the [brackets]. Agents can make mistakes, so review anything before it is sent, paid or deleted.

Read the original on github.com โ†—

Get 3 agent uses like this every morning

With the day's top AI news. Free, and one click to unsubscribe.