[Mlir-commits] [mlir] [mlir] Add `MLIRContext::executeCriticalSection` and `Pass::getOpDependentDialects` methods. (PR #98953)

Mehdi Amini llvmlistbot at llvm.org
Mon Jul 15 14:48:21 PDT 2024


================
@@ -70,6 +70,15 @@ class Pass {
   /// register the Affine dialect but does not need to register Linalg.
   virtual void getDependentDialects(DialectRegistry &registry) const {}
 
+  /// Register dependent dialects for the current pass and operation being
+  /// transformed. This function is similar to `getDependentDialects` except
+  /// that it also receives the operation being transformed. When possible, use
+  /// `getDependentDialects` as this method incurs in extra synchronization
+  /// overhead. No transformations to `op` should be performed during this
+  /// method.
+  virtual void getOpDependentDialects(Operation *op,
+                                      DialectRegistry &registry) const {}
----------------
joker-eph wrote:

I don't understand how this works.
For example what would we do if we execute a function pass on a module containing many functions?

Also right now we should be able to set this up once on a pass manager even if it runs multiple times on different piece of IR, which wouldn't be the case with the new API.

https://github.com/llvm/llvm-project/pull/98953


More information about the Mlir-commits mailing list