MLIR diffing

Hey everyone,

When working on transformations (understanding or changing them), I commonly look at IR diffs. So far, I’ve been using wdiff for this, but it’s not a great experience, because diffs tend to be quite noisy.

Here’s my wish list:

  • Diff MLIR at the graph level, ignoring names and ordering. Should detect moved nodes and inserted or deleted intermediate nodes as well. Output can be textual. Maybe bonus points for Graphviz output - this might be useful for visualizing moves.
  • Diff diffs: does this pass that previously did something now do something else? This doesn’t necessarily need to be a core functionality of the tool, but the output should support this use case.
  • Analyze pipelines. Again, not necessarily a core functionality of the tool. Supporting this could mean providing a simple web UI.

Applications of this that I’m interested in are learning, debugging and benchmarking (e.g. only run benchmarks that are really affected or flag likely noisy results).

Are there any existing solutions for this?

Thanks,
Johannes

1 Like

Unfortunately nothing fancy here (e.g., folks using custom regex rules to avoid frivolous matches), and I agree this would be very useful for many folks. We have an open project that would have been useful here (llvm-canon kind of tools for MLIR) to reduce some of that. The tree-sitter grammar I added was as I was trying some semantic diffing tools that use such grammar, but unfortunately the results weren’t as good as hoped (which could also have been due to how the grammar was defined though …). Would make for a great contribution (and potentially multiple projects possible here).

– Jacques