TileLang explained: write AI kernels at tile granularity
TileLang source-code analysis: where GEMM becomes a compiled call
Use the public example and JIT entry point as an auditable path through the repository
What you will learn
- Inspect the example first
- Inspect Python entry points
- Connect debugging to source
Before you start
- One target operator and device
- A correct framework reference
- A compatible compiler and runtime
Move from a passing README example to evidence for one real model bottleneck
Key takeaways
- Compile-time block sizes affect specialization.
- A JIT decorator has real compilation behavior.
- This is an entry-path review, not a full compiler audit.
Inspect the example first
The GEMM README explains tile choices and variants. Compare the quickstart’s `T.Pipelined` copies, `T.gemm` accumulation and ReLU epilogue with the larger examples before reading compiler internals.
Mark which values are runtime tensors and which are compile-time block sizes. A change to the latter can produce a distinct specialization and should appear in performance notes.
Inspect Python entry points
The package `__init__.py` exposes the public API and the JIT module handles compilation-facing wrappers. Read these before assuming a decorator is only syntactic sugar.
The compiler path reaches a backend after target selection, but this series captured only selected entry files. It does not pretend to be a complete line-by-line audit of TVM passes or generated device code.
Connect debugging to source
The debug guide describes IR inspection and compiler diagnostics. When a kernel fails, save the source, shapes, target and relevant intermediate output before changing several tile parameters at once.
The fixed-source walkthrough is designed to help a learner navigate code. It did not execute a compiler trace or prove that a specific kernel is optimal.
Decision guide
| Criterion | Option A | Option B |
|---|---|---|
| Best when | You need predictable behavior and easy auditing | You need adaptive optimization and have reliable telemetry |
| Main risk | May leave performance on the table | Can become difficult to explain or debug |
Implementation steps
- 1
Read the small README GEMM before larger variants.
- 2
Trace public import, JIT wrapper and target selection.
- 3
Collect source, shape and IR evidence for a failed compile.
Copy-ready example
README matmul_relu -> tilelang public API -> jit wrapper
shape + block sizes + target -> compiled specializationFrequently asked questions
Where should I start reading code?
Start with the README kernel, then `tilelang/__init__.py` and `tilelang/jit/__init__.py`.
Was generated assembly inspected?
No. The review stops at pinned Python and documentation entry points.
Sources
- TileLang / README.mdSource checked 2026-10-04
- TileLang / examples/gemm/README.mdSource checked 2026-10-04
- TileLang / tilelang/jit/__init__.pySource checked 2026-10-04
- TileLang / tilelang/__init__.pySource checked 2026-10-04
- TileLang / docs/tutorials/debug_tools_for_tilelang.mdSource checked 2026-10-04