tilelang.utils.pass_diff¶

IR pass diff tool — compare TIR before/after each pass in a chain.

Usage¶

from tilelang.utils.pass_diff import pass_diff

# Single pass, terminal colored diff
pass_diff(func, tilelang.transform.ThreadSync("shared"))

# Pass chain with named steps
pass_diff(func, [
    ("AnnotateDeviceRegions", tvm.tirx.transform.AnnotateDeviceRegions()),
    ("SplitHostDevice",       tvm.tirx.transform.SplitHostDevice()),
    ("ThreadSync",            tilelang.transform.ThreadSync("shared")),
])

# Generate HTML report
pass_diff(func, passes, mode="html")

# Both terminal + HTML
pass_diff(func, passes, mode="both")

Functions¶

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

Compare IR before and after each pass in a chain.

Module Contents¶

tilelang.utils.pass_diff.pass_diff(func_or_mod, passes, *, mode='terminal', context=3, html_path='pass_diff_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. If passes are not named, a default name is derived from the pass object.

  • mode ({"terminal", "html", "both"}) – Output mode. "terminal" prints colored diff to stdout. "html" generates an HTML file. "both" does both.

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

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

Returns:

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

Return type:

list[dict]