[Mlir-commits] [mlir] 9a14cb5 - [mlir][bufferize] Rename BufferAssignment* to Bufferize*

Sean Silva llvmlistbot at llvm.org
Wed Oct 14 12:41:36 PDT 2020


Author: Sean Silva
Date: 2020-10-14T12:39:16-07:00
New Revision: 9a14cb53cb4cd92b2c261a040a8750973b991b9f

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

LOG: [mlir][bufferize] Rename BufferAssignment* to Bufferize*

Part of the refactor discussed in:
https://llvm.discourse.group/t/what-is-the-strategy-for-tensor-memref-conversion-bufferization/1938/17

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

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
    mlir/include/mlir/Dialect/Shape/Transforms/Passes.h
    mlir/include/mlir/Transforms/Bufferize.h
    mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
    mlir/lib/Dialect/Shape/Transforms/Bufferize.cpp
    mlir/lib/Transforms/Bufferize.cpp
    mlir/test/Transforms/buffer-placement-preparation.mlir
    mlir/test/lib/Transforms/TestBufferPlacement.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
index 781a5284e754..a3e369438c8a 100644
--- a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
@@ -18,7 +18,7 @@
 
 namespace mlir {
 
-class BufferAssignmentTypeConverter;
+class BufferizeTypeConverter;
 
 namespace linalg {
 
@@ -51,7 +51,7 @@ void populateConvVectorizationPatterns(
 
 /// Populates the given list with patterns to bufferize linalg ops.
 void populateLinalgBufferizePatterns(MLIRContext *context,
-                                     BufferAssignmentTypeConverter &converter,
+                                     BufferizeTypeConverter &converter,
                                      OwningRewritePatternList &patterns);
 
 /// Performs standalone tiling of a single LinalgOp by `tileSizes`.
@@ -801,14 +801,13 @@ void populateLinalgToStandardConversionPatterns(
 // Buffer allocation patterns.
 //===----------------------------------------------------------------------===//
 
-/// Generic BufferAssignmentConversionPattern that matches any Operation* and
+/// Generic BufferizeConversionPattern that matches any Operation* and
 /// dispatches internally. This avoids template instantiating one pattern for
 /// each LinalgOp op.
-class LinalgOpConverter : public BufferAssignmentConversionPattern {
+class LinalgOpConverter : public BufferizeConversionPattern {
 public:
-  LinalgOpConverter(MLIRContext *context,
-                    BufferAssignmentTypeConverter &converter)
-      : BufferAssignmentConversionPattern(context, converter) {}
+  LinalgOpConverter(MLIRContext *context, BufferizeTypeConverter &converter)
+      : BufferizeConversionPattern(context, converter) {}
 
   LogicalResult
   matchAndRewrite(Operation *op, ArrayRef<Value> operands,
@@ -819,10 +818,9 @@ class LinalgOpConverter : public BufferAssignmentConversionPattern {
 /// stored in memory. A linalg.reshape is introduced to convert to the desired
 /// n-D buffer form.
 class TensorConstantOpConverter
-    : public BufferAssignmentOpConversionPattern<ConstantOp> {
+    : public BufferizeOpConversionPattern<ConstantOp> {
 public:
-  using BufferAssignmentOpConversionPattern<
-      ConstantOp>::BufferAssignmentOpConversionPattern;
+  using BufferizeOpConversionPattern<ConstantOp>::BufferizeOpConversionPattern;
 
   LogicalResult
   matchAndRewrite(ConstantOp op, ArrayRef<Value> operands,
@@ -831,10 +829,10 @@ class TensorConstantOpConverter
 
 /// TensorCastOp converts 1-1 to MemRefCastOp.
 class TensorCastOpConverter
-    : public BufferAssignmentOpConversionPattern<TensorCastOp> {
+    : public BufferizeOpConversionPattern<TensorCastOp> {
 public:
-  using BufferAssignmentOpConversionPattern<
-      TensorCastOp>::BufferAssignmentOpConversionPattern;
+  using BufferizeOpConversionPattern<
+      TensorCastOp>::BufferizeOpConversionPattern;
 
   LogicalResult
   matchAndRewrite(TensorCastOp op, ArrayRef<Value> operands,

diff  --git a/mlir/include/mlir/Dialect/Shape/Transforms/Passes.h b/mlir/include/mlir/Dialect/Shape/Transforms/Passes.h
index 0d1635fd90c6..f8976e9c75eb 100644
--- a/mlir/include/mlir/Dialect/Shape/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/Shape/Transforms/Passes.h
@@ -17,7 +17,7 @@
 #include "mlir/Pass/Pass.h"
 
 namespace mlir {
-class BufferAssignmentTypeConverter;
+class BufferizeTypeConverter;
 } // namespace mlir
 
 namespace mlir {
@@ -40,9 +40,9 @@ void populateRemoveShapeConstraintsPatterns(OwningRewritePatternList &patterns,
                                             MLIRContext *ctx);
 std::unique_ptr<FunctionPass> createRemoveShapeConstraintsPass();
 
-void populateShapeTypeConversionPatterns(
-    MLIRContext *ctx, BufferAssignmentTypeConverter &converter,
-    OwningRewritePatternList &patterns);
+void populateShapeTypeConversionPatterns(MLIRContext *ctx,
+                                         BufferizeTypeConverter &converter,
+                                         OwningRewritePatternList &patterns);
 // Bufferizes shape dialect ops.
 //
 // Note that most shape dialect ops must be converted to std before

diff  --git a/mlir/include/mlir/Transforms/Bufferize.h b/mlir/include/mlir/Transforms/Bufferize.h
index 34a3709216c9..128d4e7ebb07 100644
--- a/mlir/include/mlir/Transforms/Bufferize.h
+++ b/mlir/include/mlir/Transforms/Bufferize.h
@@ -29,7 +29,7 @@ namespace mlir {
 /// A helper type converter class for using inside Buffer Assignment operation
 /// conversion patterns. The default constructor keeps all the types intact
 /// except for the ranked-tensor types which is converted to memref types.
-class BufferAssignmentTypeConverter : public TypeConverter {
+class BufferizeTypeConverter : public TypeConverter {
 public:
   /// This enum is for showing how buffer placement operation converters should
   /// conduct with certain result type after type conversion. This value can be
@@ -37,7 +37,7 @@ class BufferAssignmentTypeConverter : public TypeConverter {
   /// getResultConversionKind.
   enum ResultConversionKind { AppendToArgumentsList, KeepAsFunctionResult };
 
-  BufferAssignmentTypeConverter();
+  BufferizeTypeConverter();
 
   /// This method tries to decompose a value of a certain type using provided
   /// decompose callback functions. If it is unable to do so, the original value
@@ -131,46 +131,43 @@ class BufferAssignmentTypeConverter : public TypeConverter {
   SmallVector<DecomposeTypeConversionCallFn, 2> decomposeTypeConversions;
 };
 
-/// Helper conversion pattern that encapsulates a BufferAssignmentTypeConverter
+/// Helper conversion pattern that encapsulates a BufferizeTypeConverter
 /// instance.
 template <typename SourceOp>
-class BufferAssignmentOpConversionPattern
-    : public OpConversionPattern<SourceOp> {
+class BufferizeOpConversionPattern : public OpConversionPattern<SourceOp> {
 public:
-  explicit BufferAssignmentOpConversionPattern(
-      MLIRContext *context, BufferAssignmentTypeConverter &converter,
-      PatternBenefit benefit = 1)
+  explicit BufferizeOpConversionPattern(MLIRContext *context,
+                                        BufferizeTypeConverter &converter,
+                                        PatternBenefit benefit = 1)
       : OpConversionPattern<SourceOp>(context, benefit), converter(converter) {}
 
 protected:
-  BufferAssignmentTypeConverter &converter;
+  BufferizeTypeConverter &converter;
 };
 
-/// Helper conversion pattern that encapsulates a BufferAssignmentTypeConverter
+/// Helper conversion pattern that encapsulates a BufferizeTypeConverter
 /// instance and that operates on Operation* to be compatible with OpInterfaces.
 /// This allows avoiding to instantiate N patterns for ops that can be subsumed
 /// by a single op interface (e.g. Linalg named ops).
-class BufferAssignmentConversionPattern : public ConversionPattern {
+class BufferizeConversionPattern : public ConversionPattern {
 public:
-  explicit BufferAssignmentConversionPattern(
-      MLIRContext *context, BufferAssignmentTypeConverter &converter,
-      PatternBenefit benefit = 1)
+  explicit BufferizeConversionPattern(MLIRContext *context,
+                                      BufferizeTypeConverter &converter,
+                                      PatternBenefit benefit = 1)
       : ConversionPattern(benefit, converter, MatchAnyOpTypeTag()),
         converter(converter) {}
 
 protected:
-  BufferAssignmentTypeConverter &converter;
+  BufferizeTypeConverter &converter;
 };
 
-/// Converts the signature of the function using BufferAssignmentTypeConverter.
+/// Converts the signature of the function using BufferizeTypeConverter.
 /// Each result type of the function is kept as a function result or appended to
 /// the function arguments list based on ResultConversionKind for the converted
 /// result type.
-class BufferAssignmentFuncOpConverter
-    : public BufferAssignmentOpConversionPattern<FuncOp> {
+class BufferizeFuncOpConverter : public BufferizeOpConversionPattern<FuncOp> {
 public:
-  using BufferAssignmentOpConversionPattern<
-      FuncOp>::BufferAssignmentOpConversionPattern;
+  using BufferizeOpConversionPattern<FuncOp>::BufferizeOpConversionPattern;
 
   /// Performs the actual signature rewriting step.
   LogicalResult matchAndRewrite(mlir::FuncOp, ArrayRef<Value>,
@@ -183,11 +180,11 @@ class BufferAssignmentFuncOpConverter
 /// operation from the operand to the target function argument is inserted.
 template <typename ReturnOpSourceTy, typename ReturnOpTargetTy,
           typename CopyOpTy>
-class BufferAssignmentReturnOpConverter
-    : public BufferAssignmentOpConversionPattern<ReturnOpSourceTy> {
+class BufferizeReturnOpConverter
+    : public BufferizeOpConversionPattern<ReturnOpSourceTy> {
 public:
-  using BufferAssignmentOpConversionPattern<
-      ReturnOpSourceTy>::BufferAssignmentOpConversionPattern;
+  using BufferizeOpConversionPattern<
+      ReturnOpSourceTy>::BufferizeOpConversionPattern;
 
   /// Performs the actual return-op conversion step.
   LogicalResult
@@ -212,10 +209,10 @@ class BufferAssignmentReturnOpConverter
         Type origin = originTypes[value.index()];
         Type converted = value.value().getType();
         auto kind = this->converter.getResultConversionKind(origin, converted);
-        if (kind == BufferAssignmentTypeConverter::KeepAsFunctionResult)
+        if (kind == BufferizeTypeConverter::KeepAsFunctionResult)
           newOperands.push_back(value.value());
         else
-          // kind = BufferAssignmentTypeConverter::AppendToArgumentsList
+          // kind = BufferizeTypeConverter::AppendToArgumentsList
           needCopyOperands.push_back(value.value());
       }
     }
@@ -242,12 +239,10 @@ class BufferAssignmentReturnOpConverter
 
 /// Rewrites the `CallOp` to match its operands and results with the signature
 /// of the callee after rewriting the callee with
-/// BufferAssignmentFuncOpConverter.
-class BufferAssignmentCallOpConverter
-    : public BufferAssignmentOpConversionPattern<CallOp> {
+/// BufferizeFuncOpConverter.
+class BufferizeCallOpConverter : public BufferizeOpConversionPattern<CallOp> {
 public:
-  using BufferAssignmentOpConversionPattern<
-      CallOp>::BufferAssignmentOpConversionPattern;
+  using BufferizeOpConversionPattern<CallOp>::BufferizeOpConversionPattern;
 
   /// Performs the actual rewriting step.
   LogicalResult matchAndRewrite(CallOp, ArrayRef<Value>,
@@ -258,14 +253,15 @@ class BufferAssignmentCallOpConverter
 /// assignment.
 template <typename ReturnOpSourceTy, typename ReturnOpTargetTy,
           typename CopyOpTy>
-static void populateWithBufferAssignmentOpConversionPatterns(
-    MLIRContext *context, BufferAssignmentTypeConverter &converter,
-    OwningRewritePatternList &patterns) {
+static void
+populateWithBufferizeOpConversionPatterns(MLIRContext *context,
+                                          BufferizeTypeConverter &converter,
+                                          OwningRewritePatternList &patterns) {
   // clang-format off
   patterns.insert<
-    BufferAssignmentCallOpConverter,
-    BufferAssignmentFuncOpConverter,
-    BufferAssignmentReturnOpConverter
+    BufferizeCallOpConverter,
+    BufferizeFuncOpConverter,
+    BufferizeReturnOpConverter
       <ReturnOpSourceTy, ReturnOpTargetTy, CopyOpTy>
   >(context, converter);
   // clang-format on

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
index 6ddd4e26d3e1..7b679755e2a7 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
@@ -122,8 +122,7 @@ allocateBuffersForResults(Location loc, LinalgOp linalgOp,
 
 // Specialization for `linalg::GenericOp`.
 /// A pattern to convert Generic Linalg operations which work on tensors to
-/// use buffers. A buffer is allocated using BufferAssignmentPlacer for
-/// each operation result. BufferPlacement pass should be later used to move
+/// use buffers. BufferPlacement pass should be later used to move
 /// Alloc operations to the correct positions and insert the missing Dealloc
 /// operations in the correct places.
 static void finalizeBufferAllocation(ConversionPatternRewriter &rewriter,
@@ -294,7 +293,7 @@ struct LinalgBufferizePass : public LinalgBufferizeBase<LinalgBufferizePass> {
   void runOnOperation() override {
     MLIRContext &context = getContext();
     ConversionTarget target(context);
-    BufferAssignmentTypeConverter converter;
+    BufferizeTypeConverter converter;
 
     // Mark all Standard operations legal.
     target.addLegalDialect<StandardOpsDialect, vector::VectorDialect>();
@@ -344,13 +343,13 @@ struct LinalgBufferizePass : public LinalgBufferizeBase<LinalgBufferizePass> {
     });
 
     converter.setResultConversionKind<RankedTensorType, MemRefType>(
-        BufferAssignmentTypeConverter::AppendToArgumentsList);
+        BufferizeTypeConverter::AppendToArgumentsList);
 
     OwningRewritePatternList patterns;
     populateLinalgBufferizePatterns(&context, converter, patterns);
-    populateWithBufferAssignmentOpConversionPatterns<
-        mlir::ReturnOp, mlir::ReturnOp, linalg::CopyOp>(&context, converter,
-                                                        patterns);
+    populateWithBufferizeOpConversionPatterns<mlir::ReturnOp, mlir::ReturnOp,
+                                              linalg::CopyOp>(
+        &context, converter, patterns);
     if (failed(applyFullConversion(this->getOperation(), target, patterns)))
       this->signalPassFailure();
   }
@@ -361,7 +360,7 @@ std::unique_ptr<OperationPass<ModuleOp>> mlir::createLinalgBufferizePass() {
   return std::make_unique<LinalgBufferizePass>();
 }
 void mlir::linalg::populateLinalgBufferizePatterns(
-    MLIRContext *context, BufferAssignmentTypeConverter &converter,
+    MLIRContext *context, BufferizeTypeConverter &converter,
     OwningRewritePatternList &patterns) {
   patterns.insert<
       // clang-format off

diff  --git a/mlir/lib/Dialect/Shape/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Shape/Transforms/Bufferize.cpp
index 4eb29f7002a0..bdebfa9a32d7 100644
--- a/mlir/lib/Dialect/Shape/Transforms/Bufferize.cpp
+++ b/mlir/lib/Dialect/Shape/Transforms/Bufferize.cpp
@@ -21,10 +21,10 @@ using namespace mlir::shape;
 namespace {
 // Propagate tensor to memref conversions through shape.assuming ops.
 class TypeConversionAssumingOpConverter
-    : public BufferAssignmentOpConversionPattern<shape::AssumingOp> {
+    : public BufferizeOpConversionPattern<shape::AssumingOp> {
 public:
-  using BufferAssignmentOpConversionPattern<
-      shape::AssumingOp>::BufferAssignmentOpConversionPattern;
+  using BufferizeOpConversionPattern<
+      shape::AssumingOp>::BufferizeOpConversionPattern;
 
   LogicalResult
   matchAndRewrite(shape::AssumingOp assumingOp, ArrayRef<Value> operands,
@@ -53,7 +53,7 @@ struct ShapeBufferizePass : public ShapeBufferizeBase<ShapeBufferizePass> {
     MLIRContext &ctx = getContext();
 
     OwningRewritePatternList patterns;
-    BufferAssignmentTypeConverter converter;
+    BufferizeTypeConverter converter;
     populateShapeTypeConversionPatterns(&ctx, converter, patterns);
 
     ConversionTarget target(getContext());
@@ -75,7 +75,7 @@ struct ShapeBufferizePass : public ShapeBufferizeBase<ShapeBufferizePass> {
 //
 // TODO: Change this to work generally with any type conversions.
 void mlir::populateShapeTypeConversionPatterns(
-    MLIRContext *context, BufferAssignmentTypeConverter &converter,
+    MLIRContext *context, BufferizeTypeConverter &converter,
     OwningRewritePatternList &patterns) {
   patterns.insert<TypeConversionAssumingOpConverter>(context, converter);
 }

diff  --git a/mlir/lib/Transforms/Bufferize.cpp b/mlir/lib/Transforms/Bufferize.cpp
index 1509c6bebcaf..dbe3b2b263b0 100644
--- a/mlir/lib/Transforms/Bufferize.cpp
+++ b/mlir/lib/Transforms/Bufferize.cpp
@@ -12,11 +12,11 @@
 using namespace mlir;
 
 //===----------------------------------------------------------------------===//
-// BufferAssignmentTypeConverter
+// BufferizeTypeConverter
 //===----------------------------------------------------------------------===//
 
-/// Registers conversions into BufferAssignmentTypeConverter
-BufferAssignmentTypeConverter::BufferAssignmentTypeConverter() {
+/// Registers conversions into BufferizeTypeConverter
+BufferizeTypeConverter::BufferizeTypeConverter() {
   // Keep all types unchanged.
   addConversion([](Type type) { return type; });
   // Convert RankedTensorType to MemRefType.
@@ -32,7 +32,7 @@ BufferAssignmentTypeConverter::BufferAssignmentTypeConverter() {
 /// This method tries to decompose a value of a certain type using provided
 /// decompose callback functions. If it is unable to do so, the original value
 /// is returned.
-void BufferAssignmentTypeConverter::tryDecomposeValue(
+void BufferizeTypeConverter::tryDecomposeValue(
     OpBuilder &builder, Location loc, Type type, Value value,
     SmallVectorImpl<Value> &results) {
   for (auto conversion : decomposeValueConversions)
@@ -43,8 +43,8 @@ void BufferAssignmentTypeConverter::tryDecomposeValue(
 
 /// This method tries to decompose a type using provided decompose callback
 /// functions. If it is unable to do so, the original type is returned.
-void BufferAssignmentTypeConverter::tryDecomposeType(
-    Type type, SmallVectorImpl<Type> &types) {
+void BufferizeTypeConverter::tryDecomposeType(Type type,
+                                              SmallVectorImpl<Type> &types) {
   for (auto conversion : decomposeTypeConversions)
     if (conversion(type, types) != llvm::None)
       return;
@@ -52,9 +52,8 @@ void BufferAssignmentTypeConverter::tryDecomposeType(
 }
 
 /// This method returns ResultConversionKind for the input type.
-BufferAssignmentTypeConverter::ResultConversionKind
-BufferAssignmentTypeConverter::getResultConversionKind(Type origin,
-                                                       Type converted) {
+BufferizeTypeConverter::ResultConversionKind
+BufferizeTypeConverter::getResultConversionKind(Type origin, Type converted) {
   for (auto conversion : resultTypeConversions) {
     auto res = conversion(origin, converted);
     if (res != llvm::None)
@@ -64,11 +63,11 @@ BufferAssignmentTypeConverter::getResultConversionKind(Type origin,
 }
 
 //===----------------------------------------------------------------------===//
-// BufferAssignmentFuncOpConverter
+// BufferizeFuncOpConverter
 //===----------------------------------------------------------------------===//
 
 /// Performs the actual function signature rewriting step.
-LogicalResult BufferAssignmentFuncOpConverter::matchAndRewrite(
+LogicalResult BufferizeFuncOpConverter::matchAndRewrite(
     mlir::FuncOp funcOp, ArrayRef<Value> operands,
     ConversionPatternRewriter &rewriter) const {
   auto funcType = funcOp.getType();
@@ -91,10 +90,10 @@ LogicalResult BufferAssignmentFuncOpConverter::matchAndRewrite(
     for (auto origin : originTypes) {
       Type converted = converter.convertType(origin);
       auto kind = converter.getResultConversionKind(origin, converted);
-      if (kind == BufferAssignmentTypeConverter::AppendToArgumentsList)
+      if (kind == BufferizeTypeConverter::AppendToArgumentsList)
         conversion.addInputs(converted);
       else
-        // kind = BufferAssignmentTypeConverter::KeepAsFunctionResult
+        // kind = BufferizeTypeConverter::KeepAsFunctionResult
         newResultTypes.push_back(converted);
     }
   }
@@ -112,7 +111,7 @@ LogicalResult BufferAssignmentFuncOpConverter::matchAndRewrite(
 }
 
 //===----------------------------------------------------------------------===//
-// BufferAssignmentCallOpConverter
+// BufferizeCallOpConverter
 //===----------------------------------------------------------------------===//
 
 namespace {
@@ -171,7 +170,7 @@ class CallOpResultMapping {
 } // namespace
 
 /// Performs the actual rewriting step.
-LogicalResult BufferAssignmentCallOpConverter::matchAndRewrite(
+LogicalResult BufferizeCallOpConverter::matchAndRewrite(
     CallOp callOp, ArrayRef<Value> operands,
     ConversionPatternRewriter &rewriter) const {
 
@@ -205,13 +204,13 @@ LogicalResult BufferAssignmentCallOpConverter::matchAndRewrite(
     for (Type origin : originTypes) {
       Type converted = converter.convertType(origin);
       auto kind = converter.getResultConversionKind(origin, converted);
-      if (kind == BufferAssignmentTypeConverter::KeepAsFunctionResult) {
+      if (kind == BufferizeTypeConverter::KeepAsFunctionResult) {
         newResultTypes.push_back(converted);
         // The result value is not yet available. Its index is kept and it is
         // replaced with the actual value of the new `CallOp` later.
         resultMapping.addMapping(newResultTypes.size() - 1);
       } else {
-        // kind = BufferAssignmentTypeConverter::AppendToArgumentsList
+        // kind = BufferizeTypeConverter::AppendToArgumentsList
         MemRefType memref = converted.dyn_cast<MemRefType>();
         if (!memref)
           return callOp.emitError("Cannot allocate for a non-Memref type");

diff  --git a/mlir/test/Transforms/buffer-placement-preparation.mlir b/mlir/test/Transforms/buffer-placement-preparation.mlir
index 4fcd225abc7e..772cb3b8efd1 100644
--- a/mlir/test/Transforms/buffer-placement-preparation.mlir
+++ b/mlir/test/Transforms/buffer-placement-preparation.mlir
@@ -92,7 +92,7 @@ func @func_and_block_signature_conversion(%arg0 : tensor<2xf32>, %cond : i1, %ar
 
 // -----
 
-// Test Case: Simple case for checking if BufferAssignmentPlacer creates AllocOps right before GenericOps.
+// Test Case: Simple case for checking if BufferizePlacer creates AllocOps right before GenericOps.
 
 #map0 = affine_map<(d0) -> (d0)>
 
@@ -120,7 +120,7 @@ func @compute_allocs_position_simple(%cond: i1, %arg0: tensor<2xf32>) -> tensor<
 
 // -----
 
-// Test Case: if-else case for checking if BufferAssignmentPlacer creates AllocOps right before GenericOps.
+// Test Case: if-else case for checking if BufferizePlacer creates AllocOps right before GenericOps.
 
 #map0 = affine_map<(d0) -> (d0)>
 
@@ -209,8 +209,8 @@ func @compute_allocs_position(%cond: i1, %arg0: tensor<2xf32>) -> tensor<2xf32>{
 
 // -----
 
-// Test case: Checking BufferAssignmentCallOpConverter and
-// BufferAssignmentFuncOpConverter and BufferAssignmentReturnOpConverter all
+// Test case: Checking BufferizeCallOpConverter and
+// BufferizeFuncOpConverter and BufferizeReturnOpConverter all
 // together. The signature of `callee` after signature conversion would be:
 
 // func @callee(%arg0: memref<5xf32>,%arg1: memref<5xf32>) -> ()
@@ -252,8 +252,8 @@ func @caller(%arg0: tensor<5xf32>) -> tensor<5xf32> {
 
 // -----
 
-// Test case: Checking BufferAssignmentCallOpConverter and
-// BufferAssignmentFuncOpConverter and BufferAssignmentReturnOpConverter all
+// Test case: Checking BufferizeCallOpConverter and
+// BufferizeFuncOpConverter and BufferizeReturnOpConverter all
 // together on functions that also have memref typed results. The signature of
 // `callee` after signature conversion would be:
 

diff  --git a/mlir/test/lib/Transforms/TestBufferPlacement.cpp b/mlir/test/lib/Transforms/TestBufferPlacement.cpp
index ead4c5d6fb38..f4931822c65b 100644
--- a/mlir/test/lib/Transforms/TestBufferPlacement.cpp
+++ b/mlir/test/lib/Transforms/TestBufferPlacement.cpp
@@ -23,7 +23,7 @@
 using namespace mlir;
 
 namespace {
-/// This pass tests the computeAllocPosition helper method and buffer assignment
+/// This pass tests the computeAllocPosition helper method and bufferize
 /// operation converters. Furthermore, this pass converts linalg operations on
 /// tensors to linalg operations on buffers to prepare them for the
 /// BufferPlacement pass that can be applied afterwards.
@@ -38,17 +38,17 @@ struct TestBufferPlacementPreparationPass
           OperationPass<ModuleOp>> {
 
   /// Converts tensor-type generic linalg operations to memref ones using
-  /// buffer assignment.
+  /// bufferize.
   /// TODO: Avoid the copy-pasta by exposing the pattern from BufferPlacement.h
   /// This is limited by not wanting BufferPlacement to depend on Linalg. Fixing
   /// this probably requires an OpConversionPattern over generic Operation*. For
   /// now only RewritePattern but not ConversionPattern allow this.
 
   class GenericOpConverter
-      : public BufferAssignmentOpConversionPattern<linalg::GenericOp> {
+      : public BufferizeOpConversionPattern<linalg::GenericOp> {
   public:
-    using BufferAssignmentOpConversionPattern<
-        linalg::GenericOp>::BufferAssignmentOpConversionPattern;
+    using BufferizeOpConversionPattern<
+        linalg::GenericOp>::BufferizeOpConversionPattern;
 
     LogicalResult
     matchAndRewrite(linalg::GenericOp op, ArrayRef<Value> operands,
@@ -147,11 +147,11 @@ struct TestBufferPlacementPreparationPass
   };
 
   void populateTensorLinalgToBufferLinalgConversionPattern(
-      MLIRContext *context, BufferAssignmentTypeConverter &converter,
+      MLIRContext *context, BufferizeTypeConverter &converter,
       OwningRewritePatternList &patterns) {
-    populateWithBufferAssignmentOpConversionPatterns<
-        mlir::ReturnOp, mlir::ReturnOp, linalg::CopyOp>(context, converter,
-                                                        patterns);
+    populateWithBufferizeOpConversionPatterns<mlir::ReturnOp, mlir::ReturnOp,
+                                              linalg::CopyOp>(
+        context, converter, patterns);
     patterns.insert<GenericOpConverter>(context, converter);
   }
 
@@ -163,7 +163,7 @@ struct TestBufferPlacementPreparationPass
   void runOnOperation() override {
     MLIRContext &context = this->getContext();
     ConversionTarget target(context);
-    BufferAssignmentTypeConverter converter;
+    BufferizeTypeConverter converter;
 
     // Mark all Standard operations legal.
     target.addLegalDialect<StandardOpsDialect>();
@@ -194,8 +194,8 @@ struct TestBufferPlacementPreparationPass
     });
 
     auto kind = allowMemrefFunctionResults
-                    ? BufferAssignmentTypeConverter::KeepAsFunctionResult
-                    : BufferAssignmentTypeConverter::AppendToArgumentsList;
+                    ? BufferizeTypeConverter::KeepAsFunctionResult
+                    : BufferizeTypeConverter::AppendToArgumentsList;
     converter.setResultConversionKind<RankedTensorType, MemRefType>(kind);
     converter.setResultConversionKind<UnrankedTensorType, UnrankedMemRefType>(
         kind);


        


More information about the Mlir-commits mailing list