Implement a new kind of Pass: dynamic pass pipeline
authorMehdi Amini <joker.eph@gmail.com>
Tue, 22 Sep 2020 00:51:27 +0000 (00:51 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Tue, 22 Sep 2020 18:51:54 +0000 (18:51 +0000)
commitfb1de7ed921c3c1531c0cb28b9603af22ecd0529
tree8b69f18f9b12fb31fa02d155aaf5ddba3dcb3792
parentb289dc530632613edb3eb067895c1981cb77ccd0
Implement a new kind of Pass: dynamic pass pipeline

Instead of performing a transformation, such pass yields a new pass pipeline
to run on the currently visited operation.
This feature can be used for example to implement a sub-pipeline that
would run only on an operation with specific attributes. Another example
would be to compute a cost model and dynamic schedule a pipeline based
on the result of this analysis.

Discussion: https://llvm.discourse.group/t/rfc-dynamic-pass-pipeline/1637

Recommit after fixing an ASAN issue: the callback lambda needs to be
allocated to a temporary to have its lifetime extended to the end of the
current block instead of just the current call expression.

Reviewed By: silvas

Differential Revision: https://reviews.llvm.org/D86392
mlir/include/mlir/Pass/Pass.h
mlir/include/mlir/Pass/PassManager.h
mlir/lib/Pass/Pass.cpp
mlir/test/Pass/dynamic-pipeline-fail-on-parent.mlir [new file with mode: 0644]
mlir/test/Pass/dynamic-pipeline-nested.mlir [new file with mode: 0644]
mlir/test/Pass/dynamic-pipeline.mlir [new file with mode: 0644]
mlir/test/lib/Transforms/CMakeLists.txt
mlir/test/lib/Transforms/TestDynamicPipeline.cpp [new file with mode: 0644]
mlir/tools/mlir-opt/mlir-opt.cpp