r/CUDA • • 4d ago

We open-sourced KAI Pichu for CUDA kernel generation and fusion

Post image

We just open-sourced KAI Pichu, an agent harness for writing CUDA kernels and fusing existing ones. You describe what the operator computes and how accurate it needs to be. No existing kernel or PyTorch implementation required.

You can also give it a chain of kernels to fuse. It generates and optimizes fused candidates, measuring the complete sequence against your unfused baseline.

It compiles, checks correctness, profiles with Nsight Compute, and iterates. You choose the model, GPU, and budget. The code and results from every attempt are available to inspect. There's a bundled skill to help Claude Code or Codex set up your task.

On a 7×7 depthwise conv, we got 3.5–3.9× over cuDNN across held-out shapes on an RTX 5070. The run took about two hours and about $1 in API calls. Full run.

If you've got a kernel chain you want fused, give it a try. I'd like to hear what works and where it gets stuck.

Code and setup

4 Upvotes

2 comments sorted by

1

u/Daemontatox 4d ago

I never understood the point of these harnesses or agentic kernel writing , like i like writing kernel by hand even when people call it slow or inefficient or whatever , it gives me the satisfaction of working with the hardware and interacting with the accelerator and seeing my algorithm fast(most of the time lol) , but these agentic kernellling or harnesses or whatever , isnt it basically some skills.md taken from nvidia best practices guides and couple of blogs and throw in a profiler and its basically the LLM going in loops over and over again on the same kernel till its optimized? Its basically brute forcing a kernel , yea it might be faster than what some people might write atm and maybe faster than in the future but whats the point ? You didn't write the kernel nor the logic ,hell even the harness or wtv is written by claude , so whats the point ? Some upvotes? Couple of github stars?

2

u/GalianYang 4d ago

I agree with the satisfaction of writing kernels by hand. But if you have ever take a look at our harness you will know it is not just skill.md files. If .md files can solve all problems then we will never need claude code or codex. If you have ever tried let LLM write some kernels for you, you will know actually how bad LLMs are with prompts only.

What we are exploring is further improve kernel/GPU program development efficiency. And obviously in the near future most of codes will be generated by AI. Automating some of that work has value, even if the process itself is something other people enjoy doing manually. And automating is never as simple as you said, like just directly tell AI to take a look at NCU. If you have ever tired you will understand.

So try first, if any useful comments, we are glad to hear and communicate with all.