Install TileLang on Ascend NPU and NVIDIA CUDA
TileLang has two install routes: NVIDIA GPUs use pip install tilelang, and Ascend NPUs use pip install tilelang-ascend. Line up the prerequisites first — on NVIDIA that means Python 3.10+, glibc 2.28, and CUDA 10.0+ (or the pip-provided cu13 toolchain); on Ascend it means CANN 8.3.RC1+, torch-npu 2.6.0.RC1+, with set_env.sh sourced.
This article covers getting TileLang into an environment and running, in the order prerequisites → routes → verification. Where the package comes from is in Download TileLang, and the day-to-day commands are in TileLang command cheatsheet.
What are the TileLang prerequisites? Ascend vs NVIDIA
TileLang requires different things per route: on NVIDIA, Python 3.10+, glibc 2.28 and a usable CUDA toolchain (10.0+, or the pip-provided cu13 build); on Ascend, CANN 8.3.RC1+, torch-npu 2.6.0.RC1+ and an active ASCEND_HOME_PATH (source, source). Check each item:
- Python version (both routes). Run
python -Vand confirm 3.10 or later. ExpectPython 3.10.xor higher; if it is lower, upgrade the interpreter before any pip step. - C runtime (NVIDIA). Run
ldd --versionto read the glibc version, which the official guide requires to be 2.28 or later (source). Expect 2.28 or higher. - CUDA toolchain (NVIDIA). Confirm CUDA 10.0 or later locally, or switch to the pip-provided CUDA toolchain. Expect
nvcc --versionto report a version compatible with your driver; without a local toolchain, use the official pip cu13 build rather than installing nvcc yourself. - CANN and torch-npu (Ascend). Confirm CANN 8.3.RC1+ and torch-npu 2.6.0.RC1+, then run
source /usr/local/Ascend/ascend-toolkit/set_env.sh. Expectecho $ASCEND_HOME_PATHto print the Ascend toolkit path (source).
Use a dedicated virtual environment. On either route, install TileLang into a venv or conda environment so it does not trade blows with an existing torch version in the system Python.
How do I install TileLang on each route?
NVIDIA is a single command, pip install tilelang; Ascend installs the separate tilelang-ascend package, falling back to the official wheel or a build_wheel_ascend.sh build when offline (source, source).
- NVIDIA, pip install. Run
pip install tilelang. Expect pip to select a matching wheel and finish with no local compilation (source). - NVIDIA, source build.
git clone --recursive https://github.com/tile-ai/tilelang, enter the directory, set build switches such asUSE_CUDA=ONandTVM_ROOTas needed, then compile and install. Expect a build matched exactly to your local toolchain, at the cost of a longer compile and more dependencies. - Ascend, pip install. Source
set_env.shto load CANN, then runpip install tilelang-ascend. Expect pip to pull the package from PyPI (source). - Ascend, offline wheel or self-build. Offline, set
export ASCEND_HOME_PATH=/usr/local/Ascend/ascend-toolkit/latestand runpip install tilelang-*.whl; to build it yourself,git clone --recursive https://github.com/tile-ai/tilelang-ascend, run./build_wheel_ascend.sh [--enable-llvm], then install the artifact underdist/(source).
The Ascend route is currently officially validated on the A2 and A3 NPU families with other models best-effort, and its backend supports both the Ascend C & PTO and AscendNPU IR routes (source).
How do I verify a TileLang install? Import, version and a GEMM example
Verify in two steps: import to see whether the interpreter finds it, then run a real GEMM to prove it compiles a kernel and computes the right result (source).
- Confirm import and version. Run
python -c "import tilelang; print(tilelang.__version__)". Expect a printed version;ModuleNotFoundErrormeans it landed in another interpreter, so alignwhich pythonwithpip -Vand reinstall. - Run the GEMM example. Run
cd examples/gemm && python example_gemm.py. Expect the terminal to printKernel Output Match!, proving TileLang compiles a kernel whose result matches the reference implementation (source). - Confirm the hardware backend is really used. In the example script, set the
tilelang.compiletarget to the matching backend (cuda on NVIDIA, the Ascend target on Ascend) and run it again. Expect compilation not to fall back to CPU or a pure-Python path, with the target backend named in the log.
All three passing is what a finished TileLang install means; stopping at the pip exit code just defers the problem to the first real kernel.
TileLang install notes
- Keep the two routes apart.
tilelangandtilelang-ascendtarget different hardware; install only the one matching the machine, since installing both invites a module-name clash at import time. - Do not skip set_env.sh on Ascend. Without an active
ASCEND_HOME_PATH, pip succeeds but kernel compilation fails — the most common "installed but will not run" case on Ascend. - Do not force an install on missing prerequisites. Environments below Python 3.10 or glibc 2.28 will not compile even after a successful install; fixing prerequisites first saves the later diagnosis.
- Do not jump to nightly for a newer version. The full upgrade, nightly and rollback procedure is in Update TileLang.
Once installed, the compile commands, performance tooling and build-time environment variables are collected in TileLang command cheatsheet; if an install goes wrong and you need to back out, start clean with Uninstall TileLang.
Sources: TileLang Installation Guide, tilelang-ascend · PyPI, tile-ai/tilelang-ascend GitHub repository
FAQ
TileLang needs Python 3.10 or later and glibc 2.28 or later on the NVIDIA side, plus a local CUDA toolchain at 10.0 or above (or the pip-provided cu13 toolchain). On the Ascend side it needs CANN 8.3.RC1 or later and torch-npu 2.6.0.RC1 or later, with set_env.sh sourced so ASCEND_HOME_PATH is active. When prerequisites are missing, pip still installs but kernel compilation fails.
TileLang on NVIDIA is usually a one-liner: pip install tilelang, where pip selects a wheel matching your Python and CUDA versions. You only install from source or a wheel manually when you need to track the main branch, distribute offline, or set build switches such as USE_CUDA — and only then do local CUDA toolchain and TVM_ROOT matter.
TileLang on Ascend NPU installs as the separate tilelang-ascend package. First confirm CANN 8.3.RC1 or later and torch-npu 2.6.0.RC1 or later, then source /usr/local/Ascend/ascend-toolkit/set_env.sh, then run pip install tilelang-ascend; air-gapped hosts use the official wheel or build_wheel_ascend.sh instead. This backend supports both the Ascend C & PTO and AscendNPU IR routes.
The simplest TileLang check is python -c "import tilelang; print(tilelang.__version__)", which prints a version when the interpreter can find it. To prove it compiles and runs a kernel, cd into examples/gemm and run python example_gemm.py, which prints Kernel Output Match! on Ascend.
When TileLang installs badly or import fails, check three things first: whether the interpreter is the one you think (align which python with pip -V), whether Python is below 3.10, and on Ascend whether set_env.sh was sourced. These three account for most failures and each can be ruled out in a single command.
Related Terms
- TileLang
- TileLang is a tile-level domain-specific language built on the TVM compiler stack and started by a Peking University team, generating high-performance GPU and NPU kernels from Python-like syntax. DeepSeek announced its Ascend edition on 2026-09-30.— TileLang Installation Guide
- tilelang-ascend
- tilelang-ascend is the TileLang distribution for Huawei Ascend NPUs. It requires CANN 8.3.RC1 or later and torch-npu 2.6.0.RC1 or later, and its compiler backend supports both Ascend C & PTO and AscendNPU IR.— tilelang-ascend · PyPI
- CANN
- CANN is Huawei's heterogeneous computing architecture for Ascend, providing the runtime and operator libraries above the NPU driver. Installing tilelang-ascend requires CANN 8.3.RC1 or later with its set_env.sh sourced.— tilelang-ascend · PyPI
- ASCEND_HOME_PATH
- ASCEND_HOME_PATH is the environment variable pointing at the Ascend toolkit root, typically /usr/local/Ascend/ascend-toolkit/latest, set by CANN's set_env.sh and used by the compiler to locate Ascend libraries.— tilelang-ascend · PyPI
Sources
- TileLang Installation Guide· TileLang (tile-ai)
- tilelang-ascend · PyPI· PyPI
- tile-ai/tilelang-ascend GitHub repository· GitHub