A collection of out-of-tree extensions for the Triton compiler, including passes, dialects, backends, and language extensions.
NOTE: this project is under construction. It is currently in the early stages of development and parts of it will likely change. Contributions are welcome but be aware that the foundations may change rapidly.
This repository provides a framework for developing Triton compiler extensions that extend Triton without modifying the upstream codebase. Extensions are built as shared libraries that are dynamically loaded by Triton at runtime. Extensions are distributed as Python wheels.
The upstream infrastructure is documented:
- upstream.
- in slides from the January 2026 Triton Community Meetup
- in more slides from the July 2026 Triton Community Meetup.
Extensions live in subdirectories, each built as a separate Triton wheel:
-
backend/: For new Triton backends (e.g., a new device target). -
dialect/: For adding MLIR dialects to Triton. -
pass/: For adding MLIR passes to Triton (e.g.,arithmetic-intensity). -
extensions/: For extensions that bundle dialects, passes, and language bindings together (e.g.,utlx). -
support/: Contains infrastructure code to automatically register extensions with Triton.
- C++ compiler with C++17 support
- CMake
- GitHub CLI (
gh), for downloading pre-built dependencies (optional) - Ninja
- Python 3, for tests and build scripts; install dependencies with
pip install -r requirements.txt - Triton, built with
TRITON_EXT_ENABLED=ON, seedownload_triton_wheel.py. Note: Extensions are enabled by default in Triton releases 3.7 and beyond. - LLVM compilation artifacts, see
download_llvm.py
This extension repository is designed to be built out-of-tree. It expects to be
pointed to both LLVM compilation artifacts and an installed Triton wheel. List
available extensions with list_extensions.py.
To build the extensions:
-
Build LLVM, one of the following ways:
- download pre-built: run
download_llvm.py, optionally specifying a specific upstream build. - build locally: run something like the upstream
build-llvm-project.shand setLLVM_INSTALL_DIRin the environment.
- download pre-built: run
-
Build Triton, one of the following ways:
- download pre-built: run
download_triton_wheel.py, optionally with a specific<version>+git<commit>pattern, andpip install triton-*.whl. To list available wheels, runci/list_triton_wheels.py. - build locally: run
TRITON_EXT_ENABLED=1 python setup.py bdist_wheelin the Triton source tree, thenpip install triton-*.whlhere. To use a non-installed version, setTRITON_WHEEL_DIRin the environment.
- download pre-built: run
-
Build extensions:
make build
Optionally set
LLVM_INSTALL_DIRandTRITON_WHEEL_DIRto custom locations; by default triton-ext will helpfully search for them in the project directory.
A sample build might look like:
python -m venv --prompt triton-ext .venv
source .venv/bin/activate
pip install -r requirements.txt
ci/download_triton_wheel.py
pip install triton-*.whl
ci/download_llvm.py
make buildRun the test suite to verify the extensions are working correctly:
make testExtensions are loaded by Triton by their __init__.py file (see
libtriton.extend_with(...)):
pip install <extension>.whl
python your_script.pyAnd in your script:
import triton
import triton-<extension>
...