triton-lang/triton
Development repository for the Triton language and compiler
What is Triton?
Triton is an open‑source programming language and compiler that lets you write custom GPU kernels for deep‑learning operations. It sits between high‑level frameworks (like PyTorch) and low‑level CUDA/ROCm code, offering higher productivity than raw CUDA while still giving you the flexibility to hand‑craft performance‑critical primitives (e.g., attention, matrix‑multiplication, convolutions).
Key ideas
| Idea | What it means for you |
|---|---|
| DSL for GPU kernels | Write kernels in a Python‑like syntax (tl.* ops). The compiler translates them to efficient GPU machine code. |
| MLIR‑based backend | The compiler uses LLVM’s MLIR infrastructure, making the pipeline easier to extend and to target both NVIDIA (NVPTX) and AMD (AMDGPU) GPUs. |
| Auto‑tuning | Triton can automatically explore tile sizes and other parameters to find the fastest version of a kernel on the current hardware. |
| Interpreter mode | Set TRITON_INTERPRET=1 to run kernels on the CPU without a GPU, useful for debugging. |
| Plug‑in pipeline | You can inject custom compiler passes via the add_stages_inspection_hook API. |
Getting started
# Install the latest stable release from PyPI (Python 3.10‑3.14)
pip install triton
Binary wheels are provided for Linux with NVIDIA Compute Capability 8.0+ and AMD ROCm 6.2+.
If you want to build from source (e.g., to use a custom LLVM), the README outlines the steps:
- Clone the repo and install Python build requirements.
- Run
make dev-install-llvmto fetch and compile the LLVM version Triton expects, or follow the manual LLVM build instructions. - Install the package in editable mode (
pip install -e .).
Typical workflow (Python example)
import triton
import triton.language as tl
@triton.jit
def matmul_kernel(A, B, C, M, N, K,
BLOCK_M: tl.constexpr, BLOCK_N: tl.constexpr, BLOCK_K: tl.constexpr):
pid = tl.program_id(0)
# compute block indices …
# load tiles, compute, store result …
# launch
matmul_kernel[(grid_x,)](A, B, C, M, N, K,
BLOCK_M=128, BLOCK_N=128, BLOCK_K=32)
The @triton.jit decorator tells Triton to compile the function into a GPU kernel. Tile sizes (BLOCK_*) can be left to the auto‑tuner or set manually.
What you can build with Triton
- Custom attention kernels – e.g., flash‑attention implementations.
- Optimized matrix‑multiplication – replace cuBLAS for specific shapes.
- Experimental operators – try new primitives before they appear in mainstream libraries.
- Research prototypes – quickly iterate on kernel ideas without writing CUDA.
Community & resources
- Documentation: https://triton-lang.org – installation guide, programming guide, and debugging tutorial.
- Conference: Annual Triton Developer Conference (2026 details in the repo) with talks, lightning talks, and posters.
- Puzzles: A collection of small challenges (
srush/Triton-Puzzles) that can be run with the interpreter, great for learning. - Contributing: Open to pull requests; see
CONTRIBUTING.mdfor guidelines. - Dev containers: Ready‑made Docker/VSCode dev containers are provided via the
triton-dev-containersrepo for a reproducible development environment.
Compatibility & hardware support
- OS: Linux only (as of the current release).
- GPUs: NVIDIA GPUs with compute capability 8.0 or newer, AMD GPUs with ROCm 6.2 or newer. CPU support is under development.
TL;DR
Triton is a Python‑friendly DSL and compiler that lets you write high‑performance GPU kernels for deep‑learning workloads without dropping to raw CUDA/ROCm. Install it with pip install triton, write kernels with the @triton.jit decorator, and let the MLIR‑based backend handle code generation, auto‑tuning, and cross‑vendor support. The project is actively maintained, has a full docs site, a yearly developer conference, and a welcoming open‑source community.
Related
- Dispatch
- Project
- Project
- Project
- Project