tilelang.tools.lower_trace¶

IR Lower Trace — zero-intrusion debug tool for visualizing compilation passes.

Generates a self-contained HTML page and/or terminal diff showing all passes in the compilation pipeline with side-by-side IR diff for each pass.

Usage:

TL_LOWER_TRACE=1 python my_kernel.py        # HTML report
TL_LOWER_TRACE=terminal python my_kernel.py  # terminal diff only
TL_LOWER_TRACE=both python my_kernel.py      # both terminal and HTML

Programmatic API:

from tilelang.tools.lower_trace import lower_trace

lower_trace(func, my_pass, mode="terminal")
lower_trace(func, [pass_a, pass_b], mode="both", html_path="diff.html")

Submodules¶

Functions¶

lower_trace(func_or_mod, passes, *[, mode, context, ...])

Compare IR before and after each pass in a chain.

Package Contents¶

tilelang.tools.lower_trace.lower_trace(func_or_mod, passes, *, mode='terminal', context=3, html_path='lower_trace_report.html')¶

Compare IR before and after each pass in a chain.

Parameters:
  • func_or_mod (PrimFunc or IRModule) – The starting IR.

  • passes (Pass or list[Pass] or list[tuple[str, Pass]]) – A single pass, a list of passes, or a list of (name, pass) pairs.

  • mode ({"terminal", "html", "both"}) – Output mode.

  • context (int) – Number of context lines in the unified diff (default 3).

  • html_path (str) – Output path for HTML report (default lower_trace_report.html).

Returns:

One entry per pass step, each containing: name, before_script, after_script, diff_lines, insertions, deletions, changed.

Return type:

list[dict]