MLIR MIT

triton-ascend

Triton language and compiler for Ascend NPU

T

triton-lang

Dernière activité 29 sept. 2026
triton-lang/triton-ascend

177

étoiles

244

forks

331

issues ouvertes

Ce README est souvent en anglais.

Triton-Ascend

Ask AI on DeepWiki

English | 中文

| Official Documentation | Operator Development User Journey | Community Meetings | About Ascend |


🔥 Latest News

  • [2026.07.31] Triton-Ascend 3.2.2 official release is now available
  • [2026.04.30] Triton-Ascend 3.2.1 official release is now available
  • [2026.01.20] Triton-Ascend 3.2.0 official release is now available
More latest news
  • [2025.11.14] Triton-Ascend 3.2.0rc4 pre-release is now available:
    - Extended the tt.fp_to_fp interface to add FP8 type conversion support
    - Added the scatter_ub_to_out interface to support efficient data scatter operations from UB to GM
  • [2025.09.30] Improved Scan/Sort Triton Python APIs, supporting non-contiguous memory access, and completed adaptation of key Triton operators in vLLM and sglang open-source repositories
  • [2025.09.19] Supported Triton-Ascend nightly package extraction
  • [2025.08.15] Improved Atomic-class Triton Python API support, completed adaptation of key Triton operators in the Flaggems open-source repository, and provided reference examples for high-performance implementations of simple operators such as Matmul
  • [2025.06.30] Supported 85% of Triton Python APIs, supporting contiguous memory access, covering basic usage scenarios
  • [2025.05.20] Triton-Ascend is open-sourced, Gitcode repository is alive!

📖 Quick Installation

Environment Preparation

Hardware Requirements

Supported operating systems: linux (aarch64/x86_64)

Supported Ascend products: Atlas A2 products\Atlas A3 products\Ascend 950PR&950DT products

Minimum hardware configuration: single card with 32GB memory (recommended)

Software Dependencies

Determine and install the Python, CANN, and TorchNPU software versions. This step must be completed before both package installation and source code compilation installation.

  • Python version selection: py3.9-py3.13 are all supported.

  • CANN version selection: You can visit the Ascend community website and follow the community software installation guide to complete the CANN installation and configuration. It is recommended to download and install version 9.1.0.

  • TorchNPU version selection: The currently bundled TorchNPU version is 2.7.1.post8.

Accessing Ascend NPU

If you need to access Ascend NPU computing resources for development or testing, please visit the HiDevLab - Online Development page on the HiDevLab platform to apply for free access.

Quick Installation

# Taking the installation of triton-ascend 3.2.2 as an example
pip install triton-ascend --extra-index-url=https://mirrors.huaweicloud.com/ascend/repos/pypi

Source Installation

More source installation

Install Dependencies

apt update
# Supported clang versions: clang-15, clang-17, clang-20.1.8
apt install zlib1g-dev clang-15 lld-15
apt install ccache # optional
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 100
pip install ninja cmake wheel pybind11 # build-time dependencies

Build Triton-Ascend

git clone https://github.com/triton-lang/triton-ascend.git && cd triton-ascend
git checkout main
pip install -e .

Custom LLVM Build (Optional)

# If you need to customize the LLVM build process, you can execute this step first before compiling Triton-Ascend
# Check out the specified version of LLVM source code and apply patches
git clone --no-checkout https://github.com/llvm/llvm-project.git
cd llvm-project
git checkout f6ded0be897e2878612dd903f7e8bb85448269e5
wget https://raw.githubusercontent.com/triton-lang/triton-ascend/main/third_party/ascend/patch/llvm_patch_f6ded0b.patch
git apply llvm_patch_f6ded0b.patch

export LLVM_INSTALL_PREFIX=/path/to/llvm-install

# Build a custom LLVM version
cd {PATH_TO}/llvm_project
mkdir build
cd build
cmake ../llvm \
    -G Ninja \
    -DCMAKE_C_COMPILER=/usr/bin/clang-15 \
    -DCMAKE_CXX_COMPILER=/usr/bin/clang++-15 \
    -DCMAKE_LINKER=/usr/bin/lld-15 \
    -DCMAKE_BUILD_TYPE=Release \
    -DLLVM_ENABLE_ASSERTIONS=ON \
    -DLLVM_ENABLE_PROJECTS="mlir;llvm;lld" \
    -DLLVM_TARGETS_TO_BUILD="host;NVPTX;AMDGPU" \
    -DLLVM_ENABLE_LLD=ON \
    -DCMAKE_INSTALL_PREFIX=${LLVM_INSTALL_PREFIX}
ninja install

# Compile Triton-Ascend
git clone https://github.com/triton-lang/triton-ascend.git && cd triton-ascend

LLVM_SYSPATH=${LLVM_INSTALL_PREFIX} \
TRITON_BUILD_WITH_CCACHE=true \
TRITON_BUILD_WITH_CLANG_LLD=true \
TRITON_BUILD_PROTON=OFF \
TRITON_WHEEL_NAME="triton-ascend" \
TRITON_APPEND_CMAKE_ARGS="-DTRITON_BUILD_UT=OFF" \
python3 setup.py install

Docker Image Usage

More Docker image usage
  • We provide a Dockerfile to help you install the Docker environment image. The build process uses the quay.io/ascend/cann pre-built image as the base image, skipping the CANN installation step and significantly speeding up the build.

  • You need to specify the CANN_BASE_IMAGE parameter via --build-arg to select the appropriate CANN base image for your machine. Available CANN base image tags can be found at quay.io/ascend/cann.

  • You can check the NPU model on your system using the npu-smi command.

git clone https://github.com/triton-lang/triton-ascend.git && cd triton-ascend
docker build \
--build-arg CANN_BASE_IMAGE=quay.io/ascend/cann:9.1.0-a3-ubuntu22.04-py3.12 \
-t triton-ascend-image:latest -f ./docker/Dockerfile .
  • To start a container from this image, you can refer to the following command:
docker run -u 0 -dit --shm-size=512g --name=triton-ascend_container --net=host --privileged \
--security-opt seccomp=unconfined \
--device=/dev/davinci0 \
--device=/dev/davinci1 \
--device=/dev/davinci2 \
--device=/dev/davinci3 \
--device=/dev/davinci4 \
--device=/dev/davinci5 \
--device=/dev/davinci6 \
--device=/dev/davinci7 \
--device=/dev/davinci_manager \
--device=/dev/devmm_svm \
--device=/dev/hisi_hdc \
-v /usr/local/dcmi:/usr/local/dcmi \
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
-v /usr/local/sbin/npu-smi:/usr/local/sbin/npu-smi \
-v /usr/local/Ascend/driver:/usr/local/Ascend/driver \
-v /home:/home \
-v /etc/ascend_install.info:/etc/ascend_install.info \
triton-ascend-image:latest \
/bin/bash

# Enter the container
docker exec -u root -it triton-ascend_container /bin/bash

✏️ Documentation Entry

🏘️ Community Activities

  1. Meeting Time, Link, and Minutes

🤝 Community and Contribution

  • Welcome to participate in Triton-Ascend development and code contribution. For details, please refer to the Contribution Guide

  • Please report any bugs you encounter via Issue.

Projets similaires

Development repository for the Triton language and compiler

MLIR
Ttriton-lang
20,3 k étoiles3,2 k

An Extensible Compiler IR Framework

Rustcompilersirmlir
Ppliron-org
496 étoiles55

Tenstorrent MLIR compiler

C++
Ttenstorrent
310 étoiles156