Skip to content

Repository files navigation

Triton Extensions

build status discord chat

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.

Overview

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.

Structure

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.

Prerequisites

  • 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, see download_triton_wheel.py. Note: Extensions are enabled by default in Triton releases 3.7 and beyond.
  • LLVM compilation artifacts, see download_llvm.py

Build

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:

  1. 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.sh and set LLVM_INSTALL_DIR in the environment.
  2. Build Triton, one of the following ways:

    • download pre-built: run download_triton_wheel.py, optionally with a specific <version>+git<commit> pattern, and pip install triton-*.whl. To list available wheels, run ci/list_triton_wheels.py.
    • build locally: run TRITON_EXT_ENABLED=1 python setup.py bdist_wheel in the Triton source tree, then pip install triton-*.whl here. To use a non-installed version, set TRITON_WHEEL_DIR in the environment.
  3. Build extensions:

    make build

    Optionally set LLVM_INSTALL_DIR and TRITON_WHEEL_DIR to 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 build

Test

Run the test suite to verify the extensions are working correctly:

make test

Use

Extensions are loaded by Triton by their __init__.py file (see libtriton.extend_with(...)):

pip install <extension>.whl
python your_script.py

And in your script:

import triton
import triton-<extension>
...

About

A collection of out-of-tree extensions for the Triton language and compiler

Resources

Contributing

Stars

38 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages