KernelFoundry documentation#
KernelFoundry is an open-source framework for hardware-aware GPU kernel optimization. Point a coding agent at a slow GPU kernel and get a faster one back. The agent isolates the kernel, builds a reference to beat, finds your existing tests or writes new ones, and derives benchmark sizes from how the code is actually called, asking you only about what it cannot work out on its own.
From there KernelFoundry repeatedly generates, compiles, benchmarks and profiles candidate kernels on real hardware, keeping the fastest ones that still pass those tests. On KernelBench it reaches an speedup of 2.3x (geometric mean) for SYCL. See the paper for the full evaluation.
You can also author the reference and tests yourself and drive the search from the command line. The pages below cover both, starting with the agentic path.
Four terms run through the diagram, the guide and the CLI:
- Task
One kernel you want to speed up, defined by a reference implementation plus tests.
- Job
One run of the optimization on a task. A task can have many jobs.
- Task package
The folder KernelFoundry evaluates: kernel file, reference, tests and
config.yaml. The agent builds it for you, or you write it yourself. See Anatomy of a task package.- EVOLVE block
The region of the kernel file KernelFoundry may rewrite, marked
[EVOLVE_START]/[EVOLVE_END]. Everything outside it is left untouched.
Start here#
Go to |
If you |
|---|---|
Have a slow kernel and want it faster with the least work. Describe it in a sentence and a coding agent packages, validates and optimizes it. Start here. |
|
Would rather drive the search yourself. Runs the shipped example end to end from the command line, with no LLM API key. The shipped example is a SYCL kernel for an Intel GPU; on NVIDIA, start from the KernelBench task the page gives instead. |
|
Are writing a task package by hand. Continue to Writing tests. |
|
Are tuning a run. See also Optimization strategies. |
|
Have a finished run and want to know why it went that way. |
|
Are writing tests and need the exact signatures. Assumes you know the package format. |
For installation, the README is the single source of truth.
User guide
API reference