tilelang.tools.pass_visualizer.viewer ===================================== .. py:module:: tilelang.tools.pass_visualizer.viewer .. autoapi-nested-parse:: Interactive pass browser: render the SBlock structure tree after every CUDA lowering pass as a single self-contained HTML file. Left pane is the ordered pass list (click to select). Right pane shows the structure tree for the selected pass, with lines added by that pass highlighted green and lines it removed shown ghosted red — so switching between passes makes "what this pass changed" obvious. Reuses the tree-rendering logic from core.py verbatim; this file only adds per-pass capture, line-level diffing (difflib), and HTML emission. Run with:: python -m tilelang.tools.pass_visualizer.viewer \ tilelang/tools/pass_visualizer/examples/gemm_relu.py \ --set M=1024 --set N=1024 --set K=1024 \ --set block_M=128 --set block_N=128 --set block_K=32 \ --out gemm_relu_passes.html Attributes ---------- .. autoapisummary:: tilelang.tools.pass_visualizer.viewer.HTML_TEMPLATE Functions --------- .. autoapisummary:: tilelang.tools.pass_visualizer.viewer.build_pass_data tilelang.tools.pass_visualizer.viewer.emit_html tilelang.tools.pass_visualizer.viewer.emit_txt tilelang.tools.pass_visualizer.viewer.main Module Contents --------------- .. py:function:: build_pass_data(path, factory, target, kwargs, source) Run the pipeline pass-by-pass, capturing a tree + diff for each stage. Returns (kernel_name, stages) where each stage is: {name, flag, rows} 'flag' is changed/no-op; 'rows' is the diff vs the previous stage's tree. Stage 0 is the TileLang source; stage 1 the pipeline input ("(input)"). .. py:data:: HTML_TEMPLATE :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ Pass browser — __TITLE__

Passes

""" .. raw:: html
.. py:function:: emit_html(title, stages) .. py:function:: emit_txt(title, stages) Plain-text rendering: each stage's tree, one stage after another. Uses the raw row text (`s`), with a +/- marker for diff rows so the same information shown in the HTML is greppable / diffable as text. .. py:function:: main()