[Mlir-commits] [mlir] e359a1e - [mlir][linalg][bufferize][NFC] Map only tensors in BufferizationState

Matthias Springer llvmlistbot at llvm.org
Fri Dec 3 06:07:23 PST 2021


Author: Matthias Springer
Date: 2021-12-03T23:07:09+09:00
New Revision: e359a1e5486bd1e800ad699ad7957bf324539590

URL: https://github.com/llvm/llvm-project/commit/e359a1e5486bd1e800ad699ad7957bf324539590
DIFF: https://github.com/llvm/llvm-project/commit/e359a1e5486bd1e800ad699ad7957bf324539590.diff

LOG: [mlir][linalg][bufferize][NFC] Map only tensors in BufferizationState

BufferizationState had map/lookup overloads for non-tensor values. This was necessary for IREE. There is now a better way to do this, so these overloads can be removed.

Differential Revision: https://reviews.llvm.org/D114929

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.h
    mlir/lib/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.h b/mlir/include/mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.h
index 3b342e30dc89..ca7711dd032f 100644
--- a/mlir/include/mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.h
+++ b/mlir/include/mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.h
@@ -311,9 +311,6 @@ struct BufferizationState {
   /// Map tensor values to memref buffers.
   void mapBuffer(ValueRange tensors, ValueRange buffers);
 
-  /// Map a value to another value.
-  void mapValue(Value from, Value to);
-
   /// Map a tensor value to a memref buffer.
   void mapBuffer(Value tensor, Value buffer);
 
@@ -321,10 +318,6 @@ struct BufferizationState {
   /// Asserts if no buffer is associated.
   Value lookupBuffer(Value tensor);
 
-  /// Lookup the value that is associated to the given value. Asserts if no
-  /// value is associated.
-  Value lookupValue(Value value) const;
-
   /// Return `true` if the given value is mapped.
   bool isMapped(Value value) const;
 
@@ -345,8 +338,7 @@ struct BufferizationState {
   /// `aliasInfo` keeps track of aliasing and equivalent values.
   BufferizationAliasInfo aliasInfo;
 
-  /// The mapping of tensors to buffers. May also contain mappings of non-tensor
-  /// values.
+  /// The mapping of tensors to buffers.
   BlockAndValueMapping mapping;
 
   /// Obsolete ops that should be deleted after bufferization.

diff  --git a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.cpp b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.cpp
index 6a75398cd5e9..4ed9ec9fee10 100644
--- a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.cpp
+++ b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.cpp
@@ -652,12 +652,6 @@ void mlir::linalg::comprehensive_bufferize::BufferizationState::mapBuffer(
   return mapping.map(tensor, buffer);
 }
 
-void mlir::linalg::comprehensive_bufferize::BufferizationState::mapValue(
-    Value from, Value to) {
-  assert(from && "unexpected empty value");
-  return mapping.map(from, to);
-}
-
 /// Wrapper for better debugging.
 Value mlir::linalg::comprehensive_bufferize::BufferizationState::lookupBuffer(
     Value tensor) {
@@ -692,16 +686,6 @@ Value mlir::linalg::comprehensive_bufferize::BufferizationState::lookupBuffer(
   return buffer;
 }
 
-Value mlir::linalg::comprehensive_bufferize::BufferizationState::lookupValue(
-    Value value) const {
-  Value v = mapping.lookupOrNull(value);
-  if (!v) {
-    llvm_unreachable("tensor is not mapped");
-    return Value();
-  }
-  return v;
-}
-
 bool mlir::linalg::comprehensive_bufferize::BufferizationState::isMapped(
     Value value) const {
   return mapping.contains(value);


        


More information about the Mlir-commits mailing list