[Mlir-commits] [mlir] 7995a47 - Revert "[mlir][bufferization] Define a pipeline for buffer deallocation"
Martin Erhart
llvmlistbot at llvm.org
Wed Sep 13 06:54:10 PDT 2023
Author: Martin Erhart
Date: 2023-09-13T13:53:47Z
New Revision: 7995a4701d5183f94b3a2d7a6fb998b4a1cc27a4
URL: https://github.com/llvm/llvm-project/commit/7995a4701d5183f94b3a2d7a6fb998b4a1cc27a4
DIFF: https://github.com/llvm/llvm-project/commit/7995a4701d5183f94b3a2d7a6fb998b4a1cc27a4.diff
LOG: Revert "[mlir][bufferization] Define a pipeline for buffer deallocation"
This reverts commit f0c46639429768e46e1882036be7c2ddb712a985.
This caused problems in downstream projects. We are reverting to give
them more time for integration.
Added:
Modified:
mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
mlir/include/mlir/InitAllPasses.h
mlir/lib/Dialect/Bufferization/CMakeLists.txt
mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp
mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-branchop-interface.mlir
mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-callop-interface.mlir
mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-existing-deallocs.mlir
mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-function-boundaries.mlir
mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-memoryeffect-interface.mlir
mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-region-branchop-interface.mlir
mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-subviews.mlir
utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
Removed:
mlir/include/mlir/Dialect/Bufferization/Pipelines/Passes.h
mlir/lib/Dialect/Bufferization/Pipelines/BufferizationPipelines.cpp
mlir/lib/Dialect/Bufferization/Pipelines/CMakeLists.txt
################################################################################
diff --git a/mlir/include/mlir/Dialect/Bufferization/Pipelines/Passes.h b/mlir/include/mlir/Dialect/Bufferization/Pipelines/Passes.h
deleted file mode 100644
index 7acacb763cd2c18..000000000000000
--- a/mlir/include/mlir/Dialect/Bufferization/Pipelines/Passes.h
+++ /dev/null
@@ -1,50 +0,0 @@
-//===- Passes.h - Bufferization pipeline entry points -----------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This header file defines prototypes of all bufferization pipelines.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef MLIR_DIALECT_BUFFERIZATION_PIPELINES_PASSES_H
-#define MLIR_DIALECT_BUFFERIZATION_PIPELINES_PASSES_H
-
-#include "mlir/Pass/PassOptions.h"
-
-namespace mlir {
-namespace bufferization {
-
-/// Options for the buffer deallocation pipeline.
-struct BufferDeallocationPipelineOptions
- : public PassPipelineOptions<BufferDeallocationPipelineOptions> {
- PassOptions::Option<bool> privateFunctionDynamicOwnership{
- *this, "private-function-dynamic-ownership",
- llvm::cl::desc(
- "Allows to add additional arguments to private functions to "
- "dynamically pass ownership of memrefs to callees. This can enable "
- "earlier deallocations."),
- llvm::cl::init(false)};
-};
-
-//===----------------------------------------------------------------------===//
-// Building and Registering.
-//===----------------------------------------------------------------------===//
-
-/// Adds the buffer deallocation pipeline to the `OpPassManager`. This
-/// is the standard pipeline for deallocating the MemRefs introduced by the
-/// One-Shot bufferization pass.
-void buildBufferDeallocationPipeline(
- OpPassManager &pm, const BufferDeallocationPipelineOptions &options);
-
-/// Registers all pipelines for the `bufferization` dialect. Currently,
-/// this includes only the "buffer-deallocation-pipeline".
-void registerBufferizationPipelines();
-
-} // namespace bufferization
-} // namespace mlir
-
-#endif // MLIR_DIALECT_BUFFERIZATION_PIPELINES_PASSES_H
diff --git a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
index 643adc3d82acce0..7a1c51aa12b1b75 100644
--- a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
@@ -26,8 +26,7 @@ struct OneShotBufferizationOptions;
/// Creates an instance of the BufferDeallocation pass to free all allocated
/// buffers.
-std::unique_ptr<Pass>
-createBufferDeallocationPass(bool privateFuncDynamicOwnership = false);
+std::unique_ptr<Pass> createBufferDeallocationPass();
/// Creates a pass that optimizes `bufferization.dealloc` operations. For
/// example, it reduces the number of alias checks needed at runtime using
diff --git a/mlir/include/mlir/InitAllPasses.h b/mlir/include/mlir/InitAllPasses.h
index 8a45da7d1b982f1..f7271737c66d1cb 100644
--- a/mlir/include/mlir/InitAllPasses.h
+++ b/mlir/include/mlir/InitAllPasses.h
@@ -20,7 +20,6 @@
#include "mlir/Dialect/Arith/Transforms/Passes.h"
#include "mlir/Dialect/ArmSME/Transforms/Passes.h"
#include "mlir/Dialect/Async/Passes.h"
-#include "mlir/Dialect/Bufferization/Pipelines/Passes.h"
#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
#include "mlir/Dialect/Func/Transforms/Passes.h"
#include "mlir/Dialect/GPU/Transforms/Passes.h"
@@ -82,7 +81,6 @@ inline void registerAllPasses() {
arm_sme::registerArmSMEPasses();
// Dialect pipelines
- bufferization::registerBufferizationPipelines();
sparse_tensor::registerSparseTensorPipelines();
}
diff --git a/mlir/lib/Dialect/Bufferization/CMakeLists.txt b/mlir/lib/Dialect/Bufferization/CMakeLists.txt
index 215ec562c9818c8..660deb21479d297 100644
--- a/mlir/lib/Dialect/Bufferization/CMakeLists.txt
+++ b/mlir/lib/Dialect/Bufferization/CMakeLists.txt
@@ -1,4 +1,3 @@
add_subdirectory(IR)
-add_subdirectory(Pipelines)
add_subdirectory(TransformOps)
add_subdirectory(Transforms)
diff --git a/mlir/lib/Dialect/Bufferization/Pipelines/BufferizationPipelines.cpp b/mlir/lib/Dialect/Bufferization/Pipelines/BufferizationPipelines.cpp
deleted file mode 100644
index f017bccecba5129..000000000000000
--- a/mlir/lib/Dialect/Bufferization/Pipelines/BufferizationPipelines.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-//===- BufferizationPipelines.cpp - Pipelines for bufferization -----------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "mlir/Dialect/Bufferization/Pipelines/Passes.h"
-
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
-#include "mlir/Dialect/MemRef/Transforms/Passes.h"
-#include "mlir/Pass/PassManager.h"
-#include "mlir/Transforms/Passes.h"
-
-//===----------------------------------------------------------------------===//
-// Pipeline implementation.
-//===----------------------------------------------------------------------===//
-
-void mlir::bufferization::buildBufferDeallocationPipeline(
- OpPassManager &pm, const BufferDeallocationPipelineOptions &options) {
- pm.addNestedPass<func::FuncOp>(
- memref::createExpandReallocPass(/*emitDeallocs=*/false));
- pm.addNestedPass<func::FuncOp>(createCanonicalizerPass());
- pm.addNestedPass<func::FuncOp>(createBufferDeallocationPass(
- options.privateFunctionDynamicOwnership.getValue()));
- pm.addNestedPass<func::FuncOp>(createCanonicalizerPass());
- pm.addNestedPass<func::FuncOp>(createBufferDeallocationSimplificationPass());
- pm.addPass(createLowerDeallocationsPass());
- pm.addNestedPass<func::FuncOp>(createCSEPass());
- pm.addNestedPass<func::FuncOp>(createCanonicalizerPass());
-}
-
-//===----------------------------------------------------------------------===//
-// Pipeline registration.
-//===----------------------------------------------------------------------===//
-
-void mlir::bufferization::registerBufferizationPipelines() {
- PassPipelineRegistration<BufferDeallocationPipelineOptions>(
- "buffer-deallocation-pipeline",
- "The default pipeline for automatically inserting deallocation "
- "operations after one-shot bufferization. Deallocation operations "
- "(except `memref.realloc`) may not be present already.",
- buildBufferDeallocationPipeline);
-}
diff --git a/mlir/lib/Dialect/Bufferization/Pipelines/CMakeLists.txt b/mlir/lib/Dialect/Bufferization/Pipelines/CMakeLists.txt
deleted file mode 100644
index 6e8dab64ba6b935..000000000000000
--- a/mlir/lib/Dialect/Bufferization/Pipelines/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-add_mlir_dialect_library(MLIRBufferizationPipelines
- BufferizationPipelines.cpp
-
- ADDITIONAL_HEADER_DIRS
- ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Bufferization
-
- LINK_LIBS PUBLIC
- MLIRBufferizationTransforms
- MLIRMemRefTransforms
- MLIRFuncDialect
- MLIRPass
- MLIRTransforms
-)
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp
index 465fdf3eabb9251..84a7448e23aa980 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp
@@ -994,10 +994,6 @@ namespace {
struct BufferDeallocationPass
: public bufferization::impl::BufferDeallocationBase<
BufferDeallocationPass> {
- BufferDeallocationPass(bool privateFuncDynamicOwnership)
- : bufferization::impl::BufferDeallocationBase<BufferDeallocationPass>() {
- this->privateFuncDynamicOwnership.setValue(privateFuncDynamicOwnership);
- }
void runOnOperation() override {
func::FuncOp func = getOperation();
if (func.isExternal())
@@ -1028,7 +1024,6 @@ bufferization::deallocateBuffers(FunctionOpInterface op,
// BufferDeallocationPass construction
//===----------------------------------------------------------------------===//
-std::unique_ptr<Pass> mlir::bufferization::createBufferDeallocationPass(
- bool privateFuncDynamicOwnership) {
- return std::make_unique<BufferDeallocationPass>(privateFuncDynamicOwnership);
+std::unique_ptr<Pass> mlir::bufferization::createBufferDeallocationPass() {
+ return std::make_unique<BufferDeallocationPass>();
}
diff --git a/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-branchop-interface.mlir b/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-branchop-interface.mlir
index 6713212ad5aee4b..1d1a97b66eb4adb 100644
--- a/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-branchop-interface.mlir
+++ b/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-branchop-interface.mlir
@@ -2,8 +2,6 @@
// RUN: -buffer-deallocation-simplification -split-input-file %s | FileCheck %s
// RUN: mlir-opt -verify-diagnostics -buffer-deallocation=private-function-dynamic-ownership=true -split-input-file %s > /dev/null
-// RUN: mlir-opt %s -buffer-deallocation-pipeline --split-input-file > /dev/null
-
// Test Case:
// bb0
// / \
diff --git a/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-callop-interface.mlir b/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-callop-interface.mlir
index 66aa1fbf8953ebc..ce1d1daa516e7bd 100644
--- a/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-callop-interface.mlir
+++ b/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-callop-interface.mlir
@@ -3,9 +3,6 @@
// RUN: mlir-opt -verify-diagnostics -buffer-deallocation=private-function-dynamic-ownership=true \
// RUN: --buffer-deallocation-simplification -split-input-file %s | FileCheck %s --check-prefix=CHECK-DYNAMIC
-// RUN: mlir-opt %s -buffer-deallocation-pipeline --split-input-file > /dev/null
-// RUN: mlir-opt %s -buffer-deallocation-pipeline=private-function-dynamic-ownership --split-input-file > /dev/null
-
func.func private @f(%arg0: memref<f64>) -> memref<f64> {
return %arg0 : memref<f64>
}
diff --git a/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-existing-deallocs.mlir b/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-existing-deallocs.mlir
index 95bf967847b767f..cad610ca988e7f8 100644
--- a/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-existing-deallocs.mlir
+++ b/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-existing-deallocs.mlir
@@ -1,8 +1,6 @@
// RUN: mlir-opt -verify-diagnostics -expand-realloc=emit-deallocs=false -buffer-deallocation \
// RUN: --buffer-deallocation-simplification -split-input-file %s | FileCheck %s
-// RUN: mlir-opt %s -buffer-deallocation-pipeline --split-input-file > /dev/null
-
func.func @auto_dealloc() {
%c10 = arith.constant 10 : index
%c100 = arith.constant 100 : index
diff --git a/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-function-boundaries.mlir b/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-function-boundaries.mlir
index f0d6c95c4b7ad19..ed1f2c46ebe0866 100644
--- a/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-function-boundaries.mlir
+++ b/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-function-boundaries.mlir
@@ -3,9 +3,6 @@
// RUN: mlir-opt --allow-unregistered-dialect -verify-diagnostics -buffer-deallocation=private-function-dynamic-ownership=true \
// RUN: --buffer-deallocation-simplification -split-input-file %s | FileCheck %s --check-prefix=CHECK-DYNAMIC
-// RUN: mlir-opt %s -buffer-deallocation-pipeline --split-input-file > /dev/null
-// RUN: mlir-opt %s -buffer-deallocation-pipeline=private-function-dynamic-ownership --split-input-file > /dev/null
-
// Test Case: Existing AllocOp with no users.
// BufferDeallocation expected behavior: It should insert a DeallocOp right
// before ReturnOp.
diff --git a/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-memoryeffect-interface.mlir b/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-memoryeffect-interface.mlir
index 85c48bb85e65885..311cae196d9f96a 100644
--- a/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-memoryeffect-interface.mlir
+++ b/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-memoryeffect-interface.mlir
@@ -2,8 +2,6 @@
// RUN: --buffer-deallocation-simplification -split-input-file %s | FileCheck %s
// RUN: mlir-opt -verify-diagnostics -buffer-deallocation=private-function-dynamic-ownership=true -split-input-file %s > /dev/null
-// RUN: mlir-opt %s -buffer-deallocation-pipeline --split-input-file > /dev/null
-
// Test Case: Dead operations in a single block.
// BufferDeallocation expected behavior: It only inserts the two missing
// DeallocOps after the last BufferBasedOp.
diff --git a/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-region-branchop-interface.mlir b/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-region-branchop-interface.mlir
index ac8fb7f636bb1fc..0129d59652756ce 100644
--- a/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-region-branchop-interface.mlir
+++ b/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-region-branchop-interface.mlir
@@ -2,8 +2,6 @@
// RUN: --buffer-deallocation-simplification -split-input-file %s | FileCheck %s
// RUN: mlir-opt -allow-unregistered-dialect -verify-diagnostics -buffer-deallocation=private-function-dynamic-ownership=true -split-input-file %s > /dev/null
-// RUN: mlir-opt %s -buffer-deallocation-pipeline --split-input-file --verify-diagnostics > /dev/null
-
// Test Case: Nested regions - This test defines a BufferBasedOp inside the
// region of a RegionBufferBasedOp.
// BufferDeallocation expected behavior: The AllocOp for the BufferBasedOp
diff --git a/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-subviews.mlir b/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-subviews.mlir
index 2c74c71c07388f9..57ed8ad9299dea2 100644
--- a/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-subviews.mlir
+++ b/mlir/test/Dialect/Bufferization/Transforms/BufferDeallocation/dealloc-subviews.mlir
@@ -2,8 +2,6 @@
// RUN: --buffer-deallocation-simplification -split-input-file %s | FileCheck %s
// RUN: mlir-opt -verify-diagnostics -buffer-deallocation=private-function-dynamic-ownership=true -split-input-file %s > /dev/null
-// RUN: mlir-opt %s -buffer-deallocation-pipeline --split-input-file > /dev/null
-
// CHECK-LABEL: func @subview
func.func @subview(%arg0 : index, %arg1 : index, %arg2 : memref<?x?xf32>) {
%0 = memref.alloc() : memref<64x4xf32, strided<[4, 1], offset: 0>>
diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
index 0b475bcb117b62f..2200d50a3160dc7 100644
--- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
@@ -8248,7 +8248,6 @@ cc_library(
":AsyncToLLVM",
":AsyncTransforms",
":BufferizationDialect",
- ":BufferizationPipelines",
":BufferizationTransformOps",
":BufferizationTransforms",
":CastInterfaces",
@@ -12213,21 +12212,6 @@ cc_library(
],
)
-cc_library(
- name = "BufferizationPipelines",
- srcs = glob(["lib/Dialect/Bufferization/Pipelines/*.cpp"]),
- hdrs = ["include/mlir/Dialect/Bufferization/Pipelines/Passes.h"],
- includes = ["include"],
- deps = [
- ":BufferizationToMemRef",
- ":BufferizationTransforms",
- ":FuncDialect",
- ":MemRefTransforms",
- ":Pass",
- ":Transforms",
- ],
-)
-
td_library(
name = "DLTIDialectTdFiles",
srcs = [
More information about the Mlir-commits
mailing list