[Mlir-commits] [mlir] [mlir][bufferize] Fix broken implementation of denyDialect (PR #85881)

Matteo Franciolini llvmlistbot at llvm.org
Tue Mar 19 17:29:31 PDT 2024


https://github.com/mfrancio created https://github.com/llvm/llvm-project/pull/85881

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.

>From a2ca8e76360e453374b4dff3418a612725b3ca0e Mon Sep 17 00:00:00 2001
From: Matteo Franciolini <mfranciolini at tesla.com>
Date: Tue, 19 Mar 2024 17:28:01 -0700
Subject: [PATCH] [mlir][bufferize] Fix broken implementation of denyDialect

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.
---
 .../Dialect/Bufferization/IR/BufferizableOpInterface.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

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.



More information about the Mlir-commits mailing list