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

Fabian Mora llvmlistbot at llvm.org
Mon Jul 15 16:03:17 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 {}
----------------
fabianmcg wrote:

So this API is for very specific cases, that's why I discourage its use in the docs.

The fact that the method is called every time on every `IsolatedFromAvobe` is intentional, the idea is that only the specific op can determine which dialects to load.

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


More information about the Mlir-commits mailing list