TileLang Wiki
Use this skill when the user needs grounded help with TileLang concepts, kernel
authoring, optimization, debugging, operator selection, or compiler/runtime
internals.
Treat the bundled local files as the source of truth:
references/README.md: main TileLang reference entry point
examples/README.md: example catalogue and operator inventory
FAQs.md: common failure modes, debugging shortcuts, and issue-driven fixes
Do not rely on external TileLang docs unless the user explicitly asks for
outside information.
When To Invoke
Invoke this skill when the user asks:
- how to install TileLang or choose a target/backend
- how to write or understand a TileLang kernel
- what a TileLang construct means, such as
@tilelang.jit, T.Kernel, T.copy, T.gemm, T.Pipelined, or memory scopes
- for a quick API lookup, such as which allocation, loop, math, profiling, or debugging primitive to use
- whether a Python pattern is supported inside TileLang kernels
- how to tune, profile, or debug a TileLang kernel
- which local example best matches an operator, datatype, hardware target, or optimization goal
- how TileLang compiler or runtime internals behave
Do not invoke this skill for unrelated CUDA, Triton, or generic TVM questions
unless the user is clearly working through TileLang material.
Primary Sources
Start with:
references/README.md for the compact language overview, quick API reference, kernel templates, and routing to deeper guides
examples/README.md for the example catalogue and operator-family lookup
Open references/README.md, references/language_basics.md, and
references/jit_autotune.md early in development. They are the short path for
the current guide structure, basic kernel syntax, and compile/tuning workflow.
Use references/tilelang/README.md for top-level tilelang.* APIs and
references/tilelang_language/README.md for exact tilelang.language as T
APIs. Use references/python_compat.md for supported Python syntax, shapes,
tensors, dtypes, and casts.
Open FAQs.md early when the user reports a concrete compiler error, profiler
surprise, autotuning failure, or an example that compiles but does not validate
or perform as expected.
Also open FAQs.md early when the user says they changed kernel source but a
profile or autotune rerun did not appear to recompile. Cache behavior and cache
keys can be the real issue even when the kernel body changed.
Then open deeper files only as needed.
Language Basics
Always keep this mental model available when answering:
- Define a kernel with
@tilelang.jit or a nested @T.prim_func.
- Declare shapes with
T.const(...) or T.dynamic(...).
- Annotate buffers with
T.Tensor(...) and outputs with T.empty(...).
- Launch work with
T.Kernel(...).
- Allocate storage with
T.alloc_shared(...), T.alloc_fragment(...), T.alloc_local(...), or T.alloc_var(...).
- Move tiles with
T.copy(...).
- Compute with
T.gemm(...), reductions, or elementwise loops.
- Optimize with
T.Pipelined(...), swizzle, autotuning, or target-specific primitives.
- Validate against a reference and inspect generated code or profiling output if needed.
Important distinctions to explain clearly:
T.const(...) is for dimensions inferred from concrete input tensors
T.dynamic(...) keeps dimensions symbolic in the compiled kernel
T.Parallel(...) is the usual high-level elementwise loop
T.Pipelined(...) is the usual staged copy/compute loop
T.if_then_else(...) is for value-producing conditionals
T.copy(...) is the default movement primitive; T.async_copy(...) is for deliberately managed overlap
If the user is new to TileLang, start from references/README.md and the local
examples/quickstart.py pattern.
Working Style
Route by user intent, not by file tree.
- Identify the goal:
- setup
- first kernel
- DSL semantics
- operator/example selection
- optimization
- debugging
- internals
- Open
references/README.md first for the compact overview, quick API table, and template shape.
- Open
references/language_basics.md next for fast DSL basics, then route to references/tilelang_language/README.md for exact T.* APIs.
- Open
examples/README.md when the user needs a matching runnable example.
- Open
FAQs.md when the task sounds like a known failure mode or a practical
"why did this happen?" question.
- Use deeper pages under
references/ only for exact semantics, caveats, or internals.
- Prefer the simplest correct example before advanced architecture-specific variants.
Answering Rules
- Prefer practical guidance over file dumps.
- Use
references/README.md for conceptual explanation and examples/README.md for locating the right example family.
- Use
references/README.md for fast routing between the cheatsheets and the tilelang/ or tilelang_language/ API detail pages.
- If docs and examples overlap, use docs for semantics and examples for implementation patterns.
- Surface target assumptions early, especially CUDA vs HIP/AMD and Hopper/Blackwell-specific behavior.
- Separate semantic correctness from performance tuning.
- For debugging, use a stepwise workflow: reproduce, inspect generated artifacts, compare against a reference, then minimize.
- For autotune or profiler surprises, explicitly consider cache reuse before
assuming the source edit was ignored.
- When recommending an example, explain why it matches the user's operator, datatype, and hardware.
Important Caveats
- The current guide defaults are
references/README.md, references/language_basics.md, references/jit_autotune.md, references/python_compat.md, references/tilelang/README.md, and references/tilelang_language/README.md.
- Older narrative guides, setup pages, compiler-internal notes, and
runtime-internal notes live under
references/old_programming_guiles/; use
them as archived background only after checking the newer cheatsheets and API
references.
- The local example tree is broad and evolves faster than prose docs, so prefer
examples/README.md to choose an operator family and then open the specific example directory or README.
FAQs.md is intentionally issue-driven and may mention pitfalls not yet
surfaced in the higher-level guides; use it for surgical debugging advice.
- Autotune and JIT cache behavior can explain why a rerun does not visibly
recompile after a source edit. Do not assume the kernel body change alone
invalidated the active cache key; check the cache rules in the docs and FAQs.
1---2name: "tilelang-wiki"3description: "A local, code-grounded TileLang reference skill for DSL semantics, kernel authoring, API lookup, tuning, debugging, examples, and compiler/runtime behavior. Use whenever you need to write, modify, explain, optimize, validate, or troubleshoot TileLang programming work."4metadata:5 source: https://skillmd.com/skills/wenyi-li/tilelang-wiki6---78# TileLang Wiki910Use this skill when the user needs grounded help with TileLang concepts, kernel11authoring, optimization, debugging, operator selection, or compiler/runtime12internals.1314Treat the bundled local files as the source of truth:1516- `references/README.md`: main TileLang reference entry point17- `examples/README.md`: example catalogue and operator inventory18- `FAQs.md`: common failure modes, debugging shortcuts, and issue-driven fixes1920Do not rely on external TileLang docs unless the user explicitly asks for21outside information.2223## When To Invoke2425Invoke this skill when the user asks:2627- how to install TileLang or choose a target/backend28- how to write or understand a TileLang kernel29- what a TileLang construct means, such as `@tilelang.jit`, `T.Kernel`, `T.copy`, `T.gemm`, `T.Pipelined`, or memory scopes30- for a quick API lookup, such as which allocation, loop, math, profiling, or debugging primitive to use31- whether a Python pattern is supported inside TileLang kernels32- how to tune, profile, or debug a TileLang kernel33- which local example best matches an operator, datatype, hardware target, or optimization goal34- how TileLang compiler or runtime internals behave3536Do not invoke this skill for unrelated CUDA, Triton, or generic TVM questions37unless the user is clearly working through TileLang material.3839## Primary Sources4041Start with:4243- `references/README.md` for the compact language overview, quick API reference, kernel templates, and routing to deeper guides44- `examples/README.md` for the example catalogue and operator-family lookup4546Open `references/README.md`, `references/language_basics.md`, and47`references/jit_autotune.md` early in development. They are the short path for48the current guide structure, basic kernel syntax, and compile/tuning workflow.49Use `references/tilelang/README.md` for top-level `tilelang.*` APIs and50`references/tilelang_language/README.md` for exact `tilelang.language as T`51APIs. Use `references/python_compat.md` for supported Python syntax, shapes,52tensors, dtypes, and casts.5354Open `FAQs.md` early when the user reports a concrete compiler error, profiler55surprise, autotuning failure, or an example that compiles but does not validate56or perform as expected.5758Also open `FAQs.md` early when the user says they changed kernel source but a59profile or autotune rerun did not appear to recompile. Cache behavior and cache60keys can be the real issue even when the kernel body changed.6162Then open deeper files only as needed.6364## Language Basics6566Always keep this mental model available when answering:67681. Define a kernel with `@tilelang.jit` or a nested `@T.prim_func`.692. Declare shapes with `T.const(...)` or `T.dynamic(...)`.703. Annotate buffers with `T.Tensor(...)` and outputs with `T.empty(...)`.714. Launch work with `T.Kernel(...)`.725. Allocate storage with `T.alloc_shared(...)`, `T.alloc_fragment(...)`, `T.alloc_local(...)`, or `T.alloc_var(...)`.736. Move tiles with `T.copy(...)`.747. Compute with `T.gemm(...)`, reductions, or elementwise loops.758. Optimize with `T.Pipelined(...)`, swizzle, autotuning, or target-specific primitives.769. Validate against a reference and inspect generated code or profiling output if needed.7778Important distinctions to explain clearly:7980- `T.const(...)` is for dimensions inferred from concrete input tensors81- `T.dynamic(...)` keeps dimensions symbolic in the compiled kernel82- `T.Parallel(...)` is the usual high-level elementwise loop83- `T.Pipelined(...)` is the usual staged copy/compute loop84- `T.if_then_else(...)` is for value-producing conditionals85- `T.copy(...)` is the default movement primitive; `T.async_copy(...)` is for deliberately managed overlap8687If the user is new to TileLang, start from `references/README.md` and the local88`examples/quickstart.py` pattern.8990## Working Style9192Route by user intent, not by file tree.93941. Identify the goal:95 - setup96 - first kernel97 - DSL semantics98 - operator/example selection99 - optimization100 - debugging101 - internals1022. Open `references/README.md` first for the compact overview, quick API table, and template shape.1033. Open `references/language_basics.md` next for fast DSL basics, then route to `references/tilelang_language/README.md` for exact `T.*` APIs.1044. Open `examples/README.md` when the user needs a matching runnable example.1055. Open `FAQs.md` when the task sounds like a known failure mode or a practical106 "why did this happen?" question.1076. Use deeper pages under `references/` only for exact semantics, caveats, or internals.1087. Prefer the simplest correct example before advanced architecture-specific variants.109110## Answering Rules111112- Prefer practical guidance over file dumps.113- Use `references/README.md` for conceptual explanation and `examples/README.md` for locating the right example family.114- Use `references/README.md` for fast routing between the cheatsheets and the `tilelang/` or `tilelang_language/` API detail pages.115- If docs and examples overlap, use docs for semantics and examples for implementation patterns.116- Surface target assumptions early, especially CUDA vs HIP/AMD and Hopper/Blackwell-specific behavior.117- Separate semantic correctness from performance tuning.118- For debugging, use a stepwise workflow: reproduce, inspect generated artifacts, compare against a reference, then minimize.119- For autotune or profiler surprises, explicitly consider cache reuse before120 assuming the source edit was ignored.121- When recommending an example, explain why it matches the user's operator, datatype, and hardware.122123## Important Caveats124125- The current guide defaults are `references/README.md`, `references/language_basics.md`, `references/jit_autotune.md`, `references/python_compat.md`, `references/tilelang/README.md`, and `references/tilelang_language/README.md`.126- Older narrative guides, setup pages, compiler-internal notes, and127 runtime-internal notes live under `references/old_programming_guiles/`; use128 them as archived background only after checking the newer cheatsheets and API129 references.130- The local example tree is broad and evolves faster than prose docs, so prefer `examples/README.md` to choose an operator family and then open the specific example directory or README.131- `FAQs.md` is intentionally issue-driven and may mention pitfalls not yet132 surfaced in the higher-level guides; use it for surgical debugging advice.133- Autotune and JIT cache behavior can explain why a rerun does not visibly134 recompile after a source edit. Do not assume the kernel body change alone135 invalidated the active cache key; check the cache rules in the docs and FAQs.