skillfed

tilelang

A tile level programming language to generate high performance code.

tilelang v0.1.13 2.8M downloads/30d#2,893 on PyPI
Permissive license MIT Active released

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 tilelang

uv

uv add tilelang

poetry

poetry add tilelang

Installing 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

Development Status :: 4 - BetaEnvironment :: GPUIntended Audience :: DevelopersIntended Audience :: Science/ResearchOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: C++Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonTopic :: Scientific/Engineering :: Artificial Intelligence

Tags

GPU kernel DSLhigh-performance GEMM compilertensor operation code generationCUDA kernel languageAI workload optimizationTVM-based kernel DSLFlashAttention kernel builder
gpu-kernel-compilerdslperformance-optimization

More Artificial Intelligence packages