TileLang: A Composable Tiled Programming Model for AI Systems

Lei Wang, Yu Cheng, Yining Shi, Zhengju Tang, Zhiwen Mo, Wenhao Xie, Lingxiao Ma, Yuqing Xia, Jilong Xue, Fan Yang, Zhi YangarXiv 2025 · OpenReview

Abstract

Modern AI workloads rely heavily on optimized computing kernels for both training and inference. These AI kernels follow well-defined data-flow patterns, such as moving tiles between DRAM and SRAM and performing a sequence of computations on those tiles. However, writing high-performance kernels remains complex despite the clarity of these patterns. Achieving peak performance requires careful, hardware-centric optimizations to fully leverage modern accelerators. While domain-specific compilers attempt to reduce the burden of writing high-performance kernels, they often struggle with usability and expressiveness gaps. In this paper, we present TileLang, a generalized tiled programming model for more efficient AI Kernel programming. TileLang decouples scheduling space (thread binding, layout, tensorize and pipeline) from dataflow, and encapsulated them as a set of customization annotations and primitives. This approach allows users to focus on the kernel's data-flow itself, while leaving most other optimizations to compilers. We conduct comprehensive experiments on commonly-used devices, across numerous experiments, our evaluation shows that TileLang can achieve state-of-the-art performance in key kernels, demonstrating that its unified block-and-thread paradigm and transparent scheduling capabilities deliver both the power and flexibility demanded by modern AI system development.

Introduction

The performance of modern AI systems is fundamentally tied to the efficiency of specialized kernels for operations like Matrix Multiplication (GEMM) and Attention. However, developing these kernels is a significant challenge. Developers must navigate complex hardware-specific optimizations, including thread binding, memory layout management to avoid bank conflicts, the use of specialized hardware intrinsics (e.g., Tensor Cores), and software pipelining to overlap data movement with computation.

Current solutions generally fall into two categories: high-level domain-specific languages like Triton, which offer ease of use but can be "black boxes" that limit fine-grained tuning, and low-level frameworks like CUDA or TVM, which provide maximum control at the cost of extreme complexity and maintenance overhead. TileLang is designed to bridge this gap by offering a programming model that combines the productivity of high-level abstractions with the performance potential of low-level control.

The TileLang Programming Model

TileLang introduces a tile-level abstraction where developers work with shaped blocks of data rather than individual threads. This approach simplifies the expression of dataflow while maintaining explicit control over the memory hierarchy.

TileLang's memory hierarchy abstraction and a sample Matrix Multiplication (Matmul) implementation.

As shown in the figure above, TileLang allows users to explicitly declare data locations within the GPU's memory hierarchy, such as on-chip SRAM (T.alloc_shared) or registers (T.alloc_fragment). The core of TileLang's innovation is the decoupling of dataflow from scheduling. Users define the computational logic using composable operators like T.gemm and T.copy, while the compiler's Layout Inference Mechanism automatically handles the complex task of mapping these operations to hardware threads and ensuring bank-conflict-free memory access.

Compiler Architecture

The TileLang compiler transforms Python-based source code into highly optimized machine code through a multi-stage pipeline.

The TileLang compiler pipeline, transforming Python-based programs into optimized hardware-specific code.

The process begins with parsing the Python AST into a TileLang-specific representation. This is then converted into a TVM-based Intermediate Representation (IR). The compiler performs several optimization passes, including layout inference and scheduling transformations (like pipelining), before finally generating code for target backends such as LLVM, CUDA, or HIP. This architecture ensures that the same high-level logic can be ported across different hardware vendors (e.g., NVIDIA and AMD) with minimal effort.

Evaluation and Results

TileLang was evaluated across a variety of workloads and hardware platforms, including NVIDIA H100, A100, and AMD Instinct MI300X.

Performance Benchmarks

  • FlashAttention: On the NVIDIA H100, TileLang achieved speedups ranging from 1.36x to 1.70x over FlashAttention-3 and Triton for specific sequence lengths.
  • Matrix Multiplication: TileLang matched or exceeded the performance of vendor libraries like cuBLAS and rocBLAS, outperforming Triton by up to 1.25x on AMD hardware.
  • Multi-Head Latent Attention (MLA): For the complex MLA kernel, TileLang achieved a 1075.9x speedup over standard PyTorch and significantly outperformed specialized baselines like FlashInfer.
  • Dequantization: In mixed-precision tasks (e.g., INT4 to FP16), TileLang delivered up to a 7.65x speedup over cuBLAS by leveraging custom PTX instructions for efficient numerical conversion.

Productivity

A key highlight of TileLang is its impact on developer productivity. For instance, the implementation of the FlashMLA kernel required only approximately 70 lines of Python code while achieving 98% of the performance of a hand-optimized C++ implementation.

Conclusion and Future Work

TileLang demonstrates that a unified block-and-thread paradigm can provide both the simplicity required for rapid development and the flexibility needed for peak performance. By automating layout inference and decoupling scheduling from dataflow, it empowers developers to create state-of-the-art AI kernels with significantly less effort than traditional methods.

Future work will focus on making TileLang "self-hosting" by removing dependencies on external libraries like CUTLASS. Additionally, the authors plan to implement an auto-tuning cost model to suggest optimal tile sizes and extend the model to support distributed multi-GPU workloads and improved dynamic shape optimizations.

Summary updated

BibTeX
@misc{wang2025tilelang,
  author = {Lei Wang and Yu Cheng and Yining Shi and Zhengju Tang and Zhiwen Mo and Wenhao Xie and Lingxiao Ma and Yuqing Xia and Jilong Xue and Fan Yang and Zhi Yang},
  title = {{TileLang: A Composable Tiled Programming Model for AI Systems}},
  year = {2025},
  eprint = {2504.17577},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.17577},
}
Figure