Skip to content

Commit ec0d7b6

Browse files
Update docs
1 parent 64db56c commit ec0d7b6

File tree

197 files changed

+1063
-14
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+1063
-14
lines changed

_sources/autoapi/tilelang/analysis/index.rst.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Submodules
1717

1818
/autoapi/tilelang/analysis/ast_printer/index
1919
/autoapi/tilelang/analysis/fragment_loop_checker/index
20+
/autoapi/tilelang/analysis/layout_visual/index
2021
/autoapi/tilelang/analysis/nested_loop_checker/index
2122

2223

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
tilelang.analysis.layout_visual
2+
===============================
3+
4+
.. py:module:: tilelang.analysis.layout_visual
5+
6+
7+
Functions
8+
---------
9+
10+
.. autoapisummary::
11+
12+
tilelang.analysis.layout_visual.print_fragment_format
13+
tilelang.analysis.layout_visual.LayoutVisual
14+
15+
16+
Module Contents
17+
---------------
18+
19+
.. py:function:: print_fragment_format(layout)
20+
21+
Format fragment layout information into a human-readable string.
22+
23+
:param layout: The fragment layout to format
24+
:type layout: T.Fragment
25+
26+
:returns: Formatted string showing shape, thread mapping, and index mapping
27+
:rtype: str
28+
29+
30+
.. py:function:: LayoutVisual(formats = '')
31+

_sources/autoapi/tilelang/engine/phase/index.rst.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ Functions
1616
tilelang.engine.phase.allow_global_thread_synchronization
1717
tilelang.engine.phase.should_enable_aggressive_merge
1818
tilelang.engine.phase.should_force_let_inline
19+
tilelang.engine.phase.should_enable_layout_visual
20+
tilelang.engine.phase.get_layout_visual_formats
21+
tilelang.engine.phase.LayoutVisual
1922
tilelang.engine.phase.PreLowerSemanticCheck
2023
tilelang.engine.phase.LowerAndLegalize
2124
tilelang.engine.phase.OptimizeForTarget
@@ -38,6 +41,15 @@ Module Contents
3841
3942
.. py:function:: should_force_let_inline(pass_ctx = None)
4043
44+
.. py:function:: should_enable_layout_visual(pass_ctx = None)
45+
46+
.. py:function:: get_layout_visual_formats(pass_ctx = None)
47+
48+
.. py:function:: LayoutVisual(mod)
49+
50+
Apply layout visualization pass if enabled.
51+
52+
4153
.. py:function:: PreLowerSemanticCheck(mod)
4254
4355
Check whether the module is valid before lowering. If not, raise a user-friendly error

_sources/autoapi/tilelang/tools/plot_layout/index.rst.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Functions
1515
Module Contents
1616
---------------
1717

18-
.. py:function:: plot_layout(layout, save_directory='./tmp', name = 'layout', colormap = 'RdPu', verbose = False)
18+
.. py:function:: plot_layout(layout, save_directory='./tmp', name = 'layout', colormap = 'RdPu', verbose = False, formats = 'png')
1919
2020
Plot the layout of a buffer.
2121

@@ -29,6 +29,8 @@ Module Contents
2929
:type colormap: str, optional
3030
:param verbose: If True, prints additional information about the mapping (default is False).
3131
:type verbose: bool, optional
32+
:param formats: The formats to save the image in (default is "png").
33+
:type formats: str | list[str], optional
3234

3335
:rtype: None
3436

_sources/autoapi/tilelang/transform/pass_config/index.rst.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,23 @@ Module Contents
188188
:type: Force TileLang to inline let bindings during simplification. Default
189189

190190

191+
.. py:attribute:: TL_LAYOUT_VISUALIZATION_ENABLE
192+
:value: 'tl.layout_visualization_enable'
193+
194+
195+
False
196+
197+
:type: Enable layout inference visualization. Default
198+
199+
200+
.. py:attribute:: TL_LAYOUT_VISUALIZATION_FORMATS
201+
:value: 'tl.layout_visualization_formats'
202+
203+
204+
Layout visualization formats.
205+
Acceptable values: "pdf", "png", "svg", "all"
206+
207+
191208
.. py:attribute:: TL_STORAGE_REWRITE_DETECT_INPLACE
192209
:value: 'tl.storage_rewrite_detect_inplace'
193210

_sources/tutorials/debug_tools_for_tilelang.md.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,32 @@ The output messages will include something like:
171171
msg='hello world' BlockIdx=(0, 0, 0), ThreadIdx=(0, 0, 0): 0
172172
```
173173

174+
### Visual Layout Inference For TileLang
175+
The **Visual Layout Inference** tool automatically generates visual diagrams that illustrate the mapping between logical indices, thread IDs, and register file locations.
176+
177+
When TileLang performs layout inference, it determines how fragment buffers are distributed across threads. The visual layout tool captures this information and generates:
178+
1. **Textual output**: A human-readable description of the layout mapping
179+
2. **Visual diagrams**: Color-coded plots showing the thread-to-data mapping
180+
181+
The visual layout inference tool is controlled through the `TL_LAYOUT_VISUALIZATION_ENABLE` and `TL_LAYOUT_VISUALIZATION_FORMATS` pass configuration. By default, `TL_LAYOUT_VISUALIZATION_ENABLE` is **disabled** to avoid performance overhead during compilation.
182+
183+
When enabled, `TL_LAYOUT_VISUALIZATION_FORMATS` accepts string values to control output formats:
184+
- "txt": Text output only (same as default)
185+
- "all": Generates all formats (TXT, PDF, PNG, SVG)
186+
- "png": Generate PNG format only
187+
- "pdf": Generate PDF format only
188+
- "svg": Generate SVG format only
189+
- "txt,svg": Generate multiple formats (comma-separated) in addition to text output
190+
191+
The output messages of "txt" will include something like:
192+
```
193+
C_local inferenced layout:
194+
Shape: [32, 32] -> [8]
195+
Thread: _j // 16 * 64 + _i // 16 * 32 + _i % 8 * 4 + _j % 8 // 2
196+
Index: [_j % 16 // 8 * 4 + _i % 16 // 8 * 2 + _j % 2]
197+
```
198+
199+
174200
## Conclusion
175201

176202
By carefully examining intermediate representations (IR) before final code generation—and by leveraging runtime printing through `T.print`—one can quickly diagnose where index calculations, copy logic, or other kernel operations deviate from the intended behavior. This two-pronged approach (inspecting IR transformations and using runtime prints) is often sufficient for resolving generation and correctness issues in TileLang programs.

autoapi/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@
229229
<li class="toctree-l2 has-children"><a class="reference internal" href="tilelang/analysis/index.html">tilelang.analysis</a><input aria-label="Toggle navigation of tilelang.analysis" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
230230
<li class="toctree-l3"><a class="reference internal" href="tilelang/analysis/ast_printer/index.html">tilelang.analysis.ast_printer</a></li>
231231
<li class="toctree-l3"><a class="reference internal" href="tilelang/analysis/fragment_loop_checker/index.html">tilelang.analysis.fragment_loop_checker</a></li>
232+
<li class="toctree-l3"><a class="reference internal" href="tilelang/analysis/layout_visual/index.html">tilelang.analysis.layout_visual</a></li>
232233
<li class="toctree-l3"><a class="reference internal" href="tilelang/analysis/nested_loop_checker/index.html">tilelang.analysis.nested_loop_checker</a></li>
233234
</ul>
234235
</li>
@@ -517,6 +518,7 @@ <h1>API Reference<a class="headerlink" href="#api-reference" title="Link to this
517518
<li class="toctree-l2"><a class="reference internal" href="tilelang/analysis/index.html">tilelang.analysis</a><ul>
518519
<li class="toctree-l3"><a class="reference internal" href="tilelang/analysis/ast_printer/index.html">tilelang.analysis.ast_printer</a></li>
519520
<li class="toctree-l3"><a class="reference internal" href="tilelang/analysis/fragment_loop_checker/index.html">tilelang.analysis.fragment_loop_checker</a></li>
521+
<li class="toctree-l3"><a class="reference internal" href="tilelang/analysis/layout_visual/index.html">tilelang.analysis.layout_visual</a></li>
520522
<li class="toctree-l3"><a class="reference internal" href="tilelang/analysis/nested_loop_checker/index.html">tilelang.analysis.nested_loop_checker</a></li>
521523
</ul>
522524
</li>

autoapi/tilelang/analysis/ast_printer/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@
229229
<li class="toctree-l2 current has-children"><a class="reference internal" href="../index.html">tilelang.analysis</a><input aria-label="Toggle navigation of tilelang.analysis" checked="" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul class="current">
230230
<li class="toctree-l3 current current-page"><a class="current reference internal" href="#">tilelang.analysis.ast_printer</a></li>
231231
<li class="toctree-l3"><a class="reference internal" href="../fragment_loop_checker/index.html">tilelang.analysis.fragment_loop_checker</a></li>
232+
<li class="toctree-l3"><a class="reference internal" href="../layout_visual/index.html">tilelang.analysis.layout_visual</a></li>
232233
<li class="toctree-l3"><a class="reference internal" href="../nested_loop_checker/index.html">tilelang.analysis.nested_loop_checker</a></li>
233234
</ul>
234235
</li>

autoapi/tilelang/analysis/fragment_loop_checker/index.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head><meta charset="utf-8">
44
<meta name="viewport" content="width=device-width,initial-scale=1">
55
<meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
6-
<link rel="index" title="Index" href="../../../../genindex.html"><link rel="search" title="Search" href="../../../../search.html"><link rel="next" title="tilelang.analysis.nested_loop_checker" href="../nested_loop_checker/index.html"><link rel="prev" title="tilelang.analysis.ast_printer" href="../ast_printer/index.html">
6+
<link rel="index" title="Index" href="../../../../genindex.html"><link rel="search" title="Search" href="../../../../search.html"><link rel="next" title="tilelang.analysis.layout_visual" href="../layout_visual/index.html"><link rel="prev" title="tilelang.analysis.ast_printer" href="../ast_printer/index.html">
77
<link rel="prefetch" href="../../../../_static/img/logo-row.svg" as="image">
88
<link rel="prefetch" href="../../../../_static/img/logo-row.svg" as="image">
99

@@ -229,6 +229,7 @@
229229
<li class="toctree-l2 current has-children"><a class="reference internal" href="../index.html">tilelang.analysis</a><input aria-label="Toggle navigation of tilelang.analysis" checked="" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul class="current">
230230
<li class="toctree-l3"><a class="reference internal" href="../ast_printer/index.html">tilelang.analysis.ast_printer</a></li>
231231
<li class="toctree-l3 current current-page"><a class="current reference internal" href="#">tilelang.analysis.fragment_loop_checker</a></li>
232+
<li class="toctree-l3"><a class="reference internal" href="../layout_visual/index.html">tilelang.analysis.layout_visual</a></li>
232233
<li class="toctree-l3"><a class="reference internal" href="../nested_loop_checker/index.html">tilelang.analysis.nested_loop_checker</a></li>
233234
</ul>
234235
</li>
@@ -567,12 +568,12 @@ <h2>Module Contents<a class="headerlink" href="#module-contents" title="Link to
567568
<footer>
568569

569570
<div class="related-pages">
570-
<a class="next-page" href="../nested_loop_checker/index.html">
571+
<a class="next-page" href="../layout_visual/index.html">
571572
<div class="page-info">
572573
<div class="context">
573574
<span>Next</span>
574575
</div>
575-
<div class="title">tilelang.analysis.nested_loop_checker</div>
576+
<div class="title">tilelang.analysis.layout_visual</div>
576577
</div>
577578
<svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
578579
</a>

autoapi/tilelang/analysis/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@
229229
<li class="toctree-l2 current has-children current-page"><a class="current reference internal" href="#">tilelang.analysis</a><input aria-label="Toggle navigation of tilelang.analysis" checked="" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
230230
<li class="toctree-l3"><a class="reference internal" href="ast_printer/index.html">tilelang.analysis.ast_printer</a></li>
231231
<li class="toctree-l3"><a class="reference internal" href="fragment_loop_checker/index.html">tilelang.analysis.fragment_loop_checker</a></li>
232+
<li class="toctree-l3"><a class="reference internal" href="layout_visual/index.html">tilelang.analysis.layout_visual</a></li>
232233
<li class="toctree-l3"><a class="reference internal" href="nested_loop_checker/index.html">tilelang.analysis.nested_loop_checker</a></li>
233234
</ul>
234235
</li>
@@ -517,6 +518,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Link to this headi
517518
<ul>
518519
<li class="toctree-l1"><a class="reference internal" href="ast_printer/index.html">tilelang.analysis.ast_printer</a></li>
519520
<li class="toctree-l1"><a class="reference internal" href="fragment_loop_checker/index.html">tilelang.analysis.fragment_loop_checker</a></li>
521+
<li class="toctree-l1"><a class="reference internal" href="layout_visual/index.html">tilelang.analysis.layout_visual</a></li>
520522
<li class="toctree-l1"><a class="reference internal" href="nested_loop_checker/index.html">tilelang.analysis.nested_loop_checker</a></li>
521523
</ul>
522524
</div>

0 commit comments

Comments
 (0)