I would like to run certain sequence of passes in a loop. On high level this would look like this:
- Run passes Sequence_A (pass A1, pass A2, …)
- Loop start
- Run passes Sequence_B (pass B1, pass B2, …)
- Perform some analysis, go back to step 2 if not an end of loop
- Run passes Sequence_C (pass C1, pass C2, …)
So for Sequence_B I would like to run it in a loop, each time it will start with the same state of IR, modify it, then there would be some analysis step that would produce some feedback so that on next iteration Sequence_B will be run with different configuration. It could be understood as some loop way of finding optimal solution where on each iteration different settings are applied and loop ends only where certain criteria is met.
So far I’ve managed to achieve this two ways.
- Using dynamic passes - have a pass that inside will have a loop that will initialize
mlir::OpPassManager dynPmas needed for Sequence_B and call
runPipeline(dynPm, funcOp)on it
- Splitting whole compilation into 3 stages, each with different
mlir::PassManager pminitialized and separate call to
pm.run(module). The one for Sequence_B will be called in a loop
Are there any other ways to do it? Maybe more structured way in MLIR framework to represent such flow?