A personal study and engineering notebook of hand-written CUDA kernels, CUTLASS/CuTe, Triton examples and LLM optimization notes.
RightNow-AI/autokernel
An autonomous agent pipeline that profiles a PyTorch model and optimizes its bottleneck GPU kernels in Triton or CUDA C++.
- Stars
- 1,619
- Forks
- 164
- Open issues
- 16
- Last commit
- 2 days ago
What is it?
AutoKernel takes an arbitrary PyTorch model, profiles it with torch.profiler to rank kernels by GPU time, and extracts the top bottlenecks into standalone Triton or CUDA C++ kernels. A coding agent then edits one kernel file at a time, runs a fixed benchmark with five stages of correctness checks plus roofline analysis, and keeps or reverts each change. An orchestrator uses Amdahl's law to decide when to move to the next kernel.
The project targets NVIDIA GPUs and includes starter kernels for matmul, softmax, layernorm, rmsnorm, flash attention, fused MLP, cross entropy, rotary embeddings and reduce. It also ships self-contained GPT-2, LLaMA and BERT model definitions, and an integration with the KernelBench benchmark for iterative optimization of its problems. Results are logged to a TSV file, and optimized kernels can be exported to the HuggingFace Hub.
Key features
- 01Profiles any PyTorch model and ranks kernels by GPU time, classifying them as compute- or memory-bound.
- 02Extracts bottleneck kernels into Triton or CUDA C++ files via a --backend flag.
- 03Runs a fixed benchmark with multi-stage correctness checks before measuring performance.
- 04Schedules kernel optimization by estimated end-to-end impact using Amdahl's law.
- 05Verifies optimized kernels inside the full model and reports total speedup.
- 06Integrates with KernelBench and exports kernels to the HuggingFace Hub.
Use cases
- Speeding up inference or training of a custom PyTorch model by optimizing its slowest GPU operations overnight.
- Experimenting with autonomous coding agents on a well-defined GPU performance task.
- Benchmarking AI-generated kernels against PyTorch references using KernelBench problems.
- Generating and sharing hand-tuned Triton or CUDA kernels as HuggingFace kernel packages.
Quick start
- 1
Install uv (or follow the official uv install instructions from the README)
- 2
Clone the repository
git clone https://github.com/RightNow-AI/autokernel.git - 3
Install dependencies from inside the cloned folder
uv sync - 4
Run the one-time setup for test data and baselines, then verify the benchmark
uv run prepare.py
Things to know
- Requires an NVIDIA GPU; the README reports testing only on H100, A100 and RTX 4090.
- Needs Python 3.10+ and uv.
- Running the optimization agent requires a separate coding agent such as Claude or Codex.
In collections
Topics
FAQ
- What is autokernel?
- An autonomous agent pipeline that profiles a PyTorch model and optimizes its bottleneck GPU kernels in Triton or CUDA C++. AutoKernel takes an arbitrary PyTorch model, profiles it with torch.profiler to rank kernels by GPU time, and extracts the top bottlenecks into standalone Triton or CUDA C++ kernels. A coding agent then edits one kernel file at a time, runs a fixed benchmark with five stages of correctness checks plus roofline analysis, and keeps or reverts each change. An orchestrator uses Amdahl's law to decide when to move to the next kernel.
- Is autokernel free to use? What license does it have?
- autokernel is open source under the MIT license. Check the license terms before using it in commercial products.
- Is autokernel still maintained?
- Actively maintained. The last commit to autokernel was on Nov 5, 2026.
- What can I use autokernel for?
- Speeding up inference or training of a custom PyTorch model by optimizing its slowest GPU operations overnight. Experimenting with autonomous coding agents on a well-defined GPU performance task. Benchmarking AI-generated kernels against PyTorch references using KernelBench problems. Generating and sharing hand-tuned Triton or CUDA kernels as HuggingFace kernel packages.
- How do I install autokernel?
- Install uv (or follow the official uv install instructions from the README) Clone the repository: git clone https://github.com/RightNow-AI/autokernel.git Install dependencies from inside the cloned folder: uv sync Run the one-time setup for test data and baselines, then verify the benchmark: uv run prepare.py
- Where can I get autokernel?
- The source code and installation instructions are on GitHub: https://github.com/RightNow-AI/autokernel
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A self-evolving GPU kernel agent that optimizes CUDA and CuTe DSL kernels by promoting each accepted kernel to the next reference.
Official implementation of FlashAttention, a memory-efficient exact attention kernel for training and inference of Transformer models on GPUs.
NVIDIA's PyTorch extension providing utilities for mixed precision and distributed training, with optional fused CUDA and C++ kernels.
A Python framework that compiles deep neural networks into fp16 CUDA/HIP C++ code for fast inference on NVIDIA and AMD GPUs.
A Claude Code, OpenCode and Codex skill that runs goal-driven modify-verify-keep/discard loops, inspired by Karpathy's autoresearch.