Skip to content

Feature request: -keep-all, -keep-dir #641

@pscollins

Description

@pscollins

MLIR has a set of compiler command line flags to control printing IR for intermediate passes; a useful combination is (e.g.):

  • -mlir-print-ir-after-all: dumps IR after every pass
  • -mlir-print-ir-tree-dir=out/: writes each pass output into a unique, numbers file, e.g. if the first 3 passes to run are passA, passB, passA, the outputs are out/0_passA.mlir, out/1_passB.mlir, out/2_passA.mlir, etc. Specifying a directory makes it easy to dump outputs for e.g. an existing Makefile rule, without having to change the directory where the compiler binary runs; including the pass index solves the problem of collisions and also makes it easy for someone who is unfamiliar with the compilation pipeline to tell the ordering.

These two flags enable a helpful debugging workflow: dump everything, find an interesting symbol/type/label/etc in one pass, and then grep through all of the per-pass output to see the passes that introduce/remove it

I hacked something in my local branch of MPL to do something similar:

Would it make sense to clean these up and upstream them here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions