Skip to content

[mlir][bufferize] Fix broken implementation of denyDialect #85881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

mfrancio
Copy link
Contributor

The current implementation is not functional and does not compile. The
patch allows to correctly mark a dialect as denied for the purpose of
bufferization.

The current implementation is not functional and does not compile. The
patch allows to correctly mark a dialect as denied for the purpose of
bufferization.
@llvmbot llvmbot added mlir mlir:bufferization Bufferization infrastructure labels Mar 20, 2024
@llvmbot
Copy link
Member

llvmbot commented Mar 20, 2024

@llvm/pr-subscribers-mlir-bufferization

@llvm/pr-subscribers-mlir

Author: Matteo Franciolini (mfrancio)

Changes

The current implementation is not functional and does not compile. The
patch allows to correctly mark a dialect as denied for the purpose of
bufferization.


Full diff: https://github.com/llvm/llvm-project/pull/85881.diff

1 Files Affected:

  • (modified) mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h (+10)
diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
index 94d5c08dfe4575..3a61a4b34765e2 100644
--- a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
+++ b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
@@ -147,6 +147,16 @@ class OpFilter {
     entries.push_back(Entry{filterFn, Entry::FilterType::ALLOW});
   }
 
+  /// Deny the given dialect.
+  ///
+  /// This function adds a DENY entry.
+  void denyDialect(StringRef dialectNamespace) {
+    Entry::FilterFn filterFn = [=](Operation *op) {
+      return op->getDialect()->getNamespace() == dialectNamespace;
+    };
+    entries.push_back(Entry{filterFn, Entry::FilterType::DENY});
+  }
+
   /// Allow the given ops.
   ///
   /// This function adds one or multiple ALLOW entries.

@mfrancio mfrancio requested a review from joker-eph March 20, 2024 00:30
@mfrancio mfrancio merged commit d538c56 into llvm:main Mar 20, 2024
chencha3 pushed a commit to chencha3/llvm-project that referenced this pull request Mar 23, 2024
The current implementation is not functional and does not compile. The
patch allows to correctly mark a dialect as denied for the purpose of
bufferization.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlir:bufferization Bufferization infrastructure mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants