Apropos of this discussion and this subsequently filed bug, this patch invalidates operations below the root after PassManager run on a root operation.
Suggestions on a better factorization are appreciated.
Paths
| Differential D155543
[MLIR][python bindings] invalidate ops after PassManager run AcceptedPublic Authored by makslevental on Jul 17 2023, 10:03 PM.
Details
Summary Apropos of this discussion and this subsequently filed bug, this patch invalidates operations below the root after PassManager run on a root operation. Suggestions on a better factorization are appreciated.
Diff Detail
Event Timeline
makslevental marked 3 inline comments as done. Comment Actionsquick comment incorporation
stellaraccident added inline comments.
This revision is now accepted and ready to land.Jul 20 2023, 10:33 PM Comment Actions
yea i'm gonna add that before landing. Comment Actions The other thing we could do: define the invalidation to be very course, invalidating every op except for the op the pass is run on (and possibly its parents). This would only require iterating over the live set we already have and flipping the invalid but on everything, then un-invalidating the target op. That would scale with the number of live references vs the size of the IR.
Revision Contents
Diff 542229 mlir/include/mlir-c/IR.h
mlir/lib/Bindings/Python/IRCore.cpp
mlir/lib/Bindings/Python/IRModule.h
mlir/lib/Bindings/Python/Pass.cpp
mlir/lib/CAPI/IR/IR.cpp
mlir/test/python/pass_manager.py
|
Thinking about this some more, this is missing the options to stop/skip through WalkResult, and the reverse iteration order option. We could maybe add extra functions for some of those later, but we also don't want to end up with too many variants...
Maybe open a separate revision for just the new C api? I think it probably deserves its own dedicated tests anyways.