tilelang
A tile level programming language to generate high performance code.
What it is and what it does
Tilelang is a Python-embedded domain-specific language that lets you write GPU and CPU kernels at a higher level of abstraction than raw CUDA or HIP, while still accessing low-level optimizations. It compiles to efficient machine code via TVM, supporting multiple backends including NVIDIA CUDA, AMD HIP, Apple Metal, and emerging targets like NVIDIA CuTe DSL and Huawei Ascend. The language provides Pythonic syntax for declaring tensor shapes, allocating shared memory, managing data movement, and expressing computation patterns like matrix multiplication, attention mechanisms, and sparse operations.
You write a kernel as a Python function decorated with `@tilelang.jit`, declare tensor shapes and dtypes, allocate buffers, and express the computation using tile-level operations. Tilelang handles the compilation to optimized code for your target hardware. It integrates z3-solver for symbolic reasoning and automatic correctness verification, and recently migrated to apache-tvm-ffi to reduce CPU overhead. The package includes examples for GEMM, dequantization, FlashAttention, and MLA decoding, with tested support for NVIDIA (H100, A100, V100, RTX series), AMD (MI250, MI300X), and Apple Metal devices.
Use it for:
- Implement custom GEMM kernels with layout optimization and L2-cache swizzling without writing raw CUDA
- Build high-performance attention kernels (FlashAttention, MLA) in ~80 lines of Python code
- Compile sparse tensor operations and dequantization kernels targeting multiple GPU architectures
- Prototype and optimize AI workload kernels while maintaining portability across NVIDIA, AMD, and Apple hardware
- Generate WebGPU or CuTe DSL code for emerging deployment targets without rewriting kernel logic
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Tilelang is a domain-specific language for writing high-performance GPU and CPU kernels (GEMM, attention, sparse operations) using Pythonic syntax, compiling to optimized code via TVM.
Yes, if you need to write or optimize GPU kernels and prefer a higher-level language than raw CUDA/HIP. The active maintenance, permissive license, and broad hardware support make it a solid choice for AI workload optimization. However, note the Beta status, recent project age (11 months), and dependency on torch and TVM—verify stability for your specific use case and target hardware before production deployment.
Install
tilelang on PyPI
pip
pip install tilelanguv
uv add tilelangpoetry
poetry add tilelangInstalling tilelang
Before you install
Medium install friction due to 11 runtime dependencies including torch, apache-tvm-ffi, and z3-solver. Active maintenance with recent release (11 days old). Prebuilt wheels available for common platforms (macOS ARM64, Linux x86_64/aarch64, Windows), reducing compilation overhead.
License in practice
MIT license permits commercial and private use with minimal restrictions, making it suitable for production deployment in proprietary projects.
Quickstart
pip install tilelang
import tilelang as T
@T.jit
def matmul(A, B, block_M: int = 64, block_N: int = 64, block_K: int = 64):
M, N, K = T.const('M, N, K')
A: T.Tensor[[M, K], T.float16]
B: T.Tensor[[K, N], T.float16]
C = T.empty([M, N], T.float16)
# kernel implementation follows
Requires Python 3.10 or later; torch and apache-tvm-ffi are mandatory runtime dependencies with their own system requirements (CUDA/HIP toolchain for GPU targets).
Verify before relying
- Actual performance parity claims vs. hand-optimized kernels (benchmarks referenced but not included in fact sheet)
- Stability and API maturity of recent backends (CuTe DSL, AscendC, WebGPU) added in late 2025
- Production readiness given Beta development status and 11-month project age
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 11 — apache-tvm-ffi, torch-c-dlpack-ext, cloudpickle, ml-dtypes, numpy, psutil, torch, setuptools, tqdm, typing-extensions, z3-solver |
| Maintenance | actively maintained — 11 days since the last release |
| First released | |
| Downloads | 2,781,004/month — #2,893 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: tilelang-0.1.13-cp38-abi3-macosx_11_0_arm64.whl; tilelang-0.1.13-cp38-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; tilelang-0.1.13-cp38-abi3-manylinux_2_34_aarch64.whl; tilelang-0.1.13-cp38-abi3-win_amd64.whl
Keywords: BLAS, CUDA, HIP, Code Generation, TVM
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
nvidia-cuda-tileirasProvides a portable intermediate representation…
unclear · top 5,000 on PyPI
cuda-tilecuTile Python is a compiler and programming…
permissive · top 5,000 on PyPI
sgl-deep-gemmsgl-deep-gemm provides optimized GEMM (matrix…
permissive · top 15,000 on PyPI
flashinfer-pythonFlashInfer provides optimized GPU kernels for…
permissive · top 5,000 on PyPI
flydslFlyDSL is a Python DSL and embedded MLIR…
permissive · top 15,000 on PyPI
humming-kernelsHumming is a JIT-compiled GEMM kernel library…
unclear · top 5,000 on PyPI
nvidia-cutlass-dslProvides a Python native interface for writing…
unclear · top 5,000 on PyPI
helionHelion is a Python-embedded domain-specific…
unclear · top 15,000 on PyPI
nvidia-cutlass-dsl-libs-coreProvides a Python interface for writing…
unclear · top 5,000 on PyPI
sglang-kernelsglang-kernel provides optimized CUDA compute…
permissive · top 15,000 on PyPI