Skip to content

Commit

Permalink
Revert "[mlir][bufferization] Define a pipeline for buffer deallocation"
Browse files Browse the repository at this point in the history
This reverts commit f0c4663.

This caused problems in downstream projects. We are reverting to give
them more time for integration.
  • Loading branch information
maerhart committed Sep 13, 2023
1 parent 99cd1e7 commit 7995a47
Show file tree
Hide file tree
Showing 15 changed files with 3 additions and 153 deletions.
50 changes: 0 additions & 50 deletions mlir/include/mlir/Dialect/Bufferization/Pipelines/Passes.h

This file was deleted.

3 changes: 1 addition & 2 deletions mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions mlir/include/mlir/InitAllPasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -82,7 +81,6 @@ inline void registerAllPasses() {
arm_sme::registerArmSMEPasses();

// Dialect pipelines
bufferization::registerBufferizationPipelines();
sparse_tensor::registerSparseTensorPipelines();
}

Expand Down
1 change: 0 additions & 1 deletion mlir/lib/Dialect/Bufferization/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
add_subdirectory(IR)
add_subdirectory(Pipelines)
add_subdirectory(TransformOps)
add_subdirectory(Transforms)

This file was deleted.

13 changes: 0 additions & 13 deletions mlir/lib/Dialect/Bufferization/Pipelines/CMakeLists.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
// / \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>>
Expand Down
16 changes: 0 additions & 16 deletions utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8248,7 +8248,6 @@ cc_library(
":AsyncToLLVM",
":AsyncTransforms",
":BufferizationDialect",
":BufferizationPipelines",
":BufferizationTransformOps",
":BufferizationTransforms",
":CastInterfaces",
Expand Down Expand Up @@ -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 = [
Expand Down

0 comments on commit 7995a47

Please sign in to comment.