Skip to content

triton-lang/triton-ascend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6,593 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Triton-Ascend

Ask AI on DeepWiki

English | δΈ­ζ–‡

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


πŸ”₯ Latest News

  • [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/A3/950 series

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.11 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.0.0.

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

Quick Installation

# Taking the installation of triton-ascend 3.2.1 as an example
pip install triton-ascend==3.2.1 --extra-index-url=https://triton-ascend.osinfra.cn/pypi/simple

Source Installation

More source installation

Install Dependencies

apt update
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 fad3272286528b8a491085183434c5ad4b59ab92
wget https://raw.gitcode.com/Ascend/triton-ascend/blobs/2b0a06eb21438359d6d0576b622e3bb5e0292d17/fad3272.patch
git apply fad3272.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:8.5.0-a3-ubuntu22.04-py3.10 \
-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 Calendar
  2. Meeting Minutes Board

🀝 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.

About

Triton language and compiler for Ascend NPU

Resources

License

Code of conduct

Contributing

Stars

112 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors