[MLIR] PassManager filters modules

Hey all,

In our project we need to produce several outputs from single mlir input.
At the beginning of the flow there are few mutual passes.
From some point need to run different passes and translators for each required output.
Just before that split point we are considering to clone modules for each required output and structure modules in some way.

I have two questions:

  1. Is there any interesting alternative to the above approach?
  2. Is there a built in support to tell PassManager to run specific passes on some modules and not on others?

Thank you


For 1 I’m not totally sure, but for 2 yes and no…
In general I would think you would explicitly invoke a pass manager on the module you’re interested, but if you really need to there is also a way to do filtering using dynamic pass pipeline.

@mehdi_amini Thank you!!! Really helped!