Guide · Open source
How to use Triton: install, run the interpreter and debug kernels
Updated · written with AI from the project's own documentation and checked against our catalogue data
Triton is a language and compiler for writing custom low-level routines, called kernels, used in deep learning, such as specialized matrix operations. This guide covers how to install it with pip or from source, how to run kernel code without a GPU using the interpreter, and which settings help when you debug. After reading, you will be able to set up a working Triton environment and know where to find the official tutorials.
Quick start
- 1Check your Python version. Confirm you have CPython between 3.10 and 3.14 and pip available. Binary wheels are only listed for that range.
- 2Install Triton from pip. Run pip install triton to get the latest stable release.
- 3Try the interpreter. Set TRITON_INTERPRET=1 and run a kernel to test code without a GPU.
- 4Clone the repository for a source build. Use git to clone triton-lang/triton if you need to work on the compiler itself.
- 5Install build dependencies and Triton in editable mode. Run pip install -r python/requirements.txt, then pip install -e . inside the repo.
- 6Debug with IR dumps. Use MLIR_ENABLE_DUMP=1 to inspect IR before each pass, and clear the cache if the dump is missing.
Install Triton with pip
The quickest way to start is to install the latest stable release from pip. The source says binary wheels are available for CPython 3.10 to 3.14, so make sure your Python falls in that range before you install.
- Python with CPython 3.10 to 3.14
- pip
pip install tritonInstall Triton from source
To build from source, you need git and a Python virtual environment. Clone the repository, then install the build-time dependencies and Triton in editable mode. The README also shows a version that creates a virtualenv first, which keeps the build isolated from your other Python packages.
- Clone the repository from GitHub.
- Install build-time dependencies from python/requirements.txt.
- Install Triton in editable mode with pip install -e .
git clone https://github.com/triton-lang/triton.git
cd triton
pip install -r python/requirements.txt # build-time dependencies
pip install -e .Run kernels without a GPU using the interpreter
Setting the environment variable TRITON_INTERPRET=1 runs kernels in the Triton interpreter instead of on the GPU, and you can insert Python breakpoints in your kernel code. The README also points to third-party Triton puzzles that can all be run with the interpreter, with no GPU required.
- Set TRITON_INTERPRET=1 to use the interpreter.
- Use Python breakpoints inside kernel code to inspect behavior.
TRITON_INTERPRET=1 python your_kernel.pySpeed up and tune source builds
The README lists several optional settings for building. They are useful if builds are slow, you run out of memory, or you use an editor that needs C++ code completion.
- TRITON_BUILD_WITH_CLANG_LLD=true uses clang and lld; lld in particular results in faster builds.
- TRITON_BUILD_WITH_CCACHE=true builds with ccache.
- TRITON_HOME=/some/path changes where the .triton directory with the cache and downloads is stored. By default it is your home directory.
- MAX_JOBS limits the number of build jobs if you run out of memory.
- --no-build-isolation passed to pip install makes repeated no-op builds faster.
- The build creates compile_commands.json under the Triton repo directory, which VSCode IntelliSense and clangd use.
Debug kernels with IR dumps and cache cleaning
For debugging the backend, the README lists environment variables that dump intermediate representations. If an MLIR dump does not appear, the Triton cache may be interfering, and the README suggests clearing it. For debugging the frontend, the README points to an official debugging tutorial.
- MLIR_ENABLE_DUMP=1 dumps the IR before every MLIR pass; use MLIR_ENABLE_DUMP=kernelName for one kernel.
- MLIR_DUMP_PATH sets where the dump goes; if unset, it goes to stderr.
- LLVM_IR_ENABLE_DUMP=1 dumps the IR before every pass over the LLVM IR.
- TRITON_REPRODUCER_PATH=<reproducer_path> writes an MLIR reproducer before each compiler stage.
- If dumps do not work, clear the cache with rm -r ~/.triton/cache/*.
MLIR_ENABLE_DUMP=1 python your_kernel.pyRun the tests
The README says there is no turnkey way to run all Triton tests. It offers a recipe instead: a one-time dev install, then a test target that needs a GPU, or a test target that runs without one. The dev install is needed because torch overwrites the local Triton with the public version.
- make dev-install is a one-time setup step.
- make test runs all tests and requires a GPU.
- make test-nogpu runs tests without a GPU.
make dev-install
make test-nogpuWhat people use it for
- Writing a custom matrix operation kernel to use inside a PyTorch-based model.
- Experimenting with fast GPU kernels without writing raw CUDA.
- Stepping through kernel logic with Python breakpoints using the interpreter on a machine without a GPU.
- Learning how GPU kernels and compiler stages fit together by dumping IR before each pass.
Frequently asked questions
Is Triton free to use?
Triton is open source under the MIT licence, as listed for this repository. You can install it with pip or build it from source.
What do I need to install Triton?
You need Python with CPython 3.10 to 3.14 and pip. For a source build, you also need git and a Python virtual environment.
Can I run Triton without a GPU?
Yes. Setting TRITON_INTERPRET=1 runs kernels in the interpreter instead of on the GPU. The README also says the third-party Triton puzzles can all be run this way.
How is Triton different from CUDA?
The project aims to let you write fast GPU code with higher productivity than CUDA, while offering more flexibility than other existing domain-specific languages. It is a language and compiler for custom deep learning kernels.
Why does my Triton debug dump not appear?
The Triton cache can interfere with dumps. The README suggests cleaning it with rm -r ~/.triton/cache/* and trying again.
Can I run all the Triton tests with one command?
No. The README says there is no turnkey way to run all tests. It gives a recipe using make dev-install, then make test for GPU machines or make test-nogpu without one.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Triton suits machine learning engineers, researchers and students who write or study custom GPU kernels for deep learning, especially PyTorch-based work. If you only need to train or run existing models and never write kernels, you do not need a compiler like this. The README also warns that it has no stable LLVM API and no simple test-everything command, so teams wanting a fully documented test suite or a stable LLVM base should look elsewhere.
Install options & downloads