GraphRewrite #
Graph rewrite / diff viewer.
TorchLean’s IR is designed to support compilation and optimization passes. When working on those passes, the most useful debugging UI is "before/after":
- render both graphs,
- show which nodes changed (op kind / parents / shapes),
- and make it obvious when a pass accidentally changes shapes or dependencies.
Main command:
#graph_rewrite_view before, after
Main definitions #
diffRows: align nodes by id for before/after comparison.graphRewriteHtml: side-by-side graph panels plus id-wise diff table.#graph_rewrite_view: command entry point.
Implementation notes #
- We compare by node id intentionally; for compiler/debug workflows this is usually the first question ("what changed at node i?").
- We surface op/parents/out-shape signatures because those capture most semantic rewrite mistakes.
- Keeping full "before" and "after" graph panels next to the diff table makes quick visual checks easier than reading only textual diffs.
References #
Tags #
graph-rewrite, ir, compiler, diff, proofwidgets
Render a side-by-side graph diff panel plus a per-node "changed/same" table.