A personal study and engineering notebook of hand-written CUDA kernels, CUTLASS/CuTe, Triton examples and LLM optimization notes.
OpenBMB/ForgeKernel
A self-evolving GPU kernel agent that optimizes CUDA and CuTe DSL kernels by promoting each accepted kernel to the next reference.
- Stars
- 282
- Forks
- 39
- Open issues
- 1
- Last commit
- 3 days ago
What is it?
ForgeKernel starts from an existing reference GPU kernel, measures its timing and profile on the target hardware, and writes an architecture-first milestone plan that a coding agent implements. Each accepted kernel becomes the reference for the next generation, so optimization continues past the best known implementation. Hardware mechanisms certified by a GPU probe are stored in a knowledge base organized by GPU architecture and reused across operators.
The tool targets NVIDIA Hopper (sm90) and Blackwell (sm100) GPUs and supports CuTe DSL and CUDA C++ tasks. A task is defined by a description of the operator, a set of shapes, and a task.toml file, and the forge CLI runs the loop locally or over SSH. Runs produce a report and the best kernel source, and a self-evolution script chains generations until gains fall below the measurement noise floor.
The repository also releases kernels generated by the project for attention, sparse attention, linear attention, GEMM and convolution operators, along with the speedups and environments they were measured in.
Key features
- 01Turns a reference kernel into an architecture-first milestone plan for a coding agent.
- 02Promotes each accepted kernel to the next reference, chaining generations automatically.
- 03Judges correctness, times candidates against the reference, and profiles them with Nsight Compute.
- 04Stores GPU-probe-certified hardware mechanisms in a per-architecture knowledge base.
- 05Supports local and SSH-based GPU execution for CuTe DSL and CUDA C++ tasks.
Use cases
- Optimizing a PyTorch operator or custom kernel on Hopper or Blackwell GPUs.
- Running long unattended kernel tuning campaigns and reviewing the generated report.
- Studying generated attention, GEMM, or convolution kernels released with the project.
Quick start
- 1
Clone the repository
- 2
Create a virtual environment and install ForgeKernel
python3 -m venv .venv && source .venv/bin/activate && pip install -e . - 3
Install the recommended CuTe DSL package
pip install nvidia-cutlass-dsl - 4
Check the installed version
forge --version
Things to know
- Requires an NVIDIA Hopper (sm90) or Blackwell (sm100) GPU.
- Needs the Claude Code CLI with a login or an ANTHROPIC_API_KEY.
- A single run takes hours and the example reached 5.2x after about 1.5 hours on a B200.
- Early-stage project with only 8 stars and version 0.1.0.
In collections
Topics
FAQ
- What is ForgeKernel?
- A self-evolving GPU kernel agent that optimizes CUDA and CuTe DSL kernels by promoting each accepted kernel to the next reference. ForgeKernel starts from an existing reference GPU kernel, measures its timing and profile on the target hardware, and writes an architecture-first milestone plan that a coding agent implements. Each accepted kernel becomes the reference for the next generation, so optimization continues past the best known implementation. Hardware mechanisms certified by a GPU probe are stored in a knowledge base organized by GPU architecture and reused across operators.
- Is ForgeKernel free to use? What license does it have?
- ForgeKernel is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is ForgeKernel still maintained?
- Actively maintained. The last commit to ForgeKernel was on Nov 4, 2026.
- What can I use ForgeKernel for?
- Optimizing a PyTorch operator or custom kernel on Hopper or Blackwell GPUs. Running long unattended kernel tuning campaigns and reviewing the generated report. Studying generated attention, GEMM, or convolution kernels released with the project.
- How do I install ForgeKernel?
- Clone the repository Create a virtual environment and install ForgeKernel: python3 -m venv .venv && source .venv/bin/activate && pip install -e . Install the recommended CuTe DSL package: pip install nvidia-cutlass-dsl Check the installed version: forge --version
- Where can I get ForgeKernel?
- The source code and installation instructions are on GitHub: https://github.com/OpenBMB/ForgeKernel
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
An autonomous agent pipeline that profiles a PyTorch model and optimizes its bottleneck GPU kernels in Triton or CUDA C++.
NCCL is NVIDIA's library of optimized GPU communication primitives such as all-reduce and all-gather for single- and multi-node training.
A C++20 header-only library for NumPy-style tensor expressions that run on NVIDIA GPUs or multithreaded CPUs, with optional kernel fusion.
An open-source book and code collection of modern CUDA learning notes, with 200+ kernels covering HGEMM, FP8/FP4 GEMM, and Flash-Attention.
A unified collective communication library and API that implements operations like allreduce and broadcast across CPUs, GPUs and hardware accelerators for HPC and AI workloads.