triton README

The project's README from github.com/triton-lang/triton. As one markdown file: README.md.

Documentation Nightly Wheels
Documentation Wheels

Triton Conference 2025

Triton Banner

The 3rd Triton Developer Conference took place on October 21, 2025 at the Microsoft Silicon Valley Campus in Mountain View, California.

Conference Materials

Conference recordings and materials are now available online:

For previous conference materials, see:

Triton

This is the development repository of Triton, a language and compiler for writing highly efficient custom Deep-Learning primitives. The aim of Triton is to provide an open-source environment to write fast code at higher productivity than CUDA, but also with higher flexibility than other existing DSLs.

The foundations of this project are described in the following MAPL2019 publication: Triton: An Intermediate Language and Compiler for Tiled Neural Network Computations. Please consider citing this work if you use Triton!

The official documentation contains installation instructions and tutorials. See also these third-party Triton puzzles, which can all be run using the Triton interpreter -- no GPU required.

Quick Installation

You can install the latest stable release of Triton from pip:

pip install triton

Binary wheels are available for CPython 3.10-3.14.

Install from source

git clone https://github.com/triton-lang/triton.git
cd triton

pip install -r python/requirements.txt # build-time dependencies
pip install -e .

Or with a virtualenv:

git clone https://github.com/triton-lang/triton.git
cd triton

python -m venv .venv --prompt triton
source .venv/bin/activate

pip install -r python/requirements.txt # build-time dependencies
pip install -e .

Building with a custom LLVM

Triton uses LLVM to generate code for GPUs and CPUs. Normally, the Triton build downloads a prebuilt LLVM, but you can also build and use LLVM from source.

LLVM does not have a stable API, so the Triton build will not work at an arbitrary LLVM version.

For convenience, use the following command to build LLVM and install Triton with the custom LLVM:

make dev-install-llvm
Alternatively, follow these steps to build LLVM from source manually.
  1. Find the version of LLVM that Triton builds against. Check the llvm_hash field in cmake/llvm-info.json to see the current version. For example, if it says: "llvm_hash": "49af6502c6dcb4a7f7520178bd14df396f78240c" This means that the version of Triton you have builds against LLVM 49af6502.

  2. git checkout LLVM at this revision. Optionally, make additional modifications to LLVM.

  3. Build LLVM. For example, you might run:

    $ cd $HOME/llvm-project  # your clone of LLVM.
    $ mkdir build
    $ cd build
    $ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON ../llvm -DLLVM_ENABLE_PROJECTS="mlir;llvm;lld;clang" -DLLVM_TARGETS_TO_BUILD="host;NVPTX;AMDGPU"
    $ ninja
    
  4. Grab a snack, this will take a while.

  5. Build Triton as above, but set the following environment variables:

    # Modify as appropriate to point to your LLVM build.
    $ export LLVM_BUILD_DIR=$HOME/llvm-project/build
    
    $ cd <triton install>
    $ LLVM_INCLUDE_DIRS=$LLVM_BUILD_DIR/include \
      LLVM_LIBRARY_DIR=$LLVM_BUILD_DIR/lib \
      LLVM_SYSPATH=$LLVM_BUILD_DIR \
      pip install -e .
    

Tips for building

Running tests

There currently isn't a turnkey way to run all the Triton tests, but you can follow the following recipe:

# One-time setup.  Note this will reinstall local Triton because torch
# overwrites it with the public version.
$ make dev-install

# To run all tests (requires a GPU)
$ make test

# Or, to run tests without a gpu
$ make test-nogpu

Tips for hacking

For detailed instructions on how to debug Triton's frontend, please refer to this tutorial. The following includes additional tips for hacking on Triton's backend.

Configuration knobs

See python/triton/knobs.py for the full list of configuration knobs. You can set those knobs directly in python or use environment variables to control them. Below are some of the environment variables you can specify (see knobs.py for the full list):

[!NOTE] Some of these environment variables don't have a knob in knobs.py-- those are only relevant to the C++ layer(s), hence they don't exist in the python layer.

Kernel Override Steps

export TRITON_ALWAYS_COMPILE=1
export TRITON_KERNEL_DUMP=1
export TRITON_DUMP_DIR=<dump_dir>
export TRITON_KERNEL_OVERRIDE=1
export TRITON_OVERRIDE_DIR=<override_dir>
# Step 1: Run the kernel once to dump kernel's IRs and ptx/amdgcn in $TRITON_DUMP_DIR
# Step 2: Copy $TRITON_DUMP_DIR/<kernel_hash> to $TRITON_OVERRIDE_DIR
# Step 3: Delete the stages that you do not want to override and modify the stage you do want to override
# Step 4: Run the kernel again to see the overridden result

Compiler Pipeline Inspection Steps To introspect the pipeline add_stages, before running your kernels, simply set the add_stages_inspection_hook like so:

def inspect_stages(_self, stages, options, language, capability):
    # inspect or modify add_stages here
triton.knobs.runtime.add_stages_inspection_hook = inspect_stages

Examples of how to use this for out of tree plugin passes is here

Changelog

Version 2.0 is out! New features include:

Contributing

Community contributions are more than welcome, whether it be to fix bugs or to add new features at github. For more detailed instructions, please visit our contributor's guide.

Compatibility

Supported Platforms:

Supported Hardware:

Development Container (Dev Container)

Dev Containers for the Triton project are available from the triton-dev-containers repository.

Key Benefits:

How to Use the Dev Container:

For detailed instructions on how to use the dev containers, please see the dev container user guide.

triton (triton-lang/triton)

Searching Database…

20.4K ·GitHub
What is this?Triton is a language and compiler for writing highly efficient custom Deep-Learning GPU kernels, aiming to give higher productivity than CUDA and more flexibility than other existing DSLs.
Is it a programming language, a library, or something else?It is a Python-embedded domain-specific language plus a compiler: you write kernels in Python-like syntax and Triton's MLIR/LLVM-based pipeline lowers them to PTX for NVIDIA or AMDGCN for AMD GPUs.
What hardware and OS does it actually run on?Officially only Linux is supported, and you need an NVIDIA GPU with Compute Capability 8.0+ or an AMD GPU with ROCm 6.2+; CPU execution is still under development.
Why build Triton instead of just writing CUDA?The goal is to let developers write fast GPU kernels with higher productivity than raw CUDA while keeping more flexibility than other fixed DSLs.
Can I try Triton kernels without owning a GPU?Yes, Triton has an interpreter mode (set TRITON_INTERPRET=1) that lets you run and debug kernels on CPU, including the third-party Triton puzzles exercises.
What changed in Triton's version 2.0 release?The backend was rewritten to use MLIR, and support was added for kernels with back-to-back matmuls such as flash attention, alongside many bug fixes and performance improvements.
Size
812.7 MB
Stars
20.4K
Age
12y
Commits · 90 Days