-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[MLIR][NFC] Retire let constructor for Bufferization #129850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MLIR][NFC] Retire let constructor for Bufferization #129850
Conversation
@llvm/pr-subscribers-mlir Author: lorenzo chelini (chelini) Changes
Patch is 30.77 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/129850.diff 13 Files Affected:
diff --git a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
index c5d0853d6ff97..493180cd54e5b 100644
--- a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
@@ -30,25 +30,6 @@ using DeallocHelperMap = llvm::DenseMap<Operation *, func::FuncOp>;
#define GEN_PASS_DECL
#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
-/// Creates an instance of the OwnershipBasedBufferDeallocation pass to free all
-/// allocated buffers.
-std::unique_ptr<Pass> createOwnershipBasedBufferDeallocationPass(
- DeallocationOptions options = DeallocationOptions());
-
-/// Creates a pass that finds all temporary allocations
-/// and attempts to move the deallocation after the last user/dependency
-/// of the allocation, thereby optimizing allocation liveness.
-std::unique_ptr<Pass> createOptimizeAllocationLivenessPass();
-
-/// Creates a pass that optimizes `bufferization.dealloc` operations. For
-/// example, it reduces the number of alias checks needed at runtime using
-/// static alias analysis.
-std::unique_ptr<Pass> createBufferDeallocationSimplificationPass();
-
-/// Creates an instance of the LowerDeallocations pass to lower
-/// `bufferization.dealloc` operations to the `memref` dialect.
-std::unique_ptr<Pass> createLowerDeallocationsPass();
-
/// Adds the conversion pattern of the `bufferization.dealloc` operation to the
/// given pattern set for use in other transformation passes.
void populateBufferizationDeallocLoweringPattern(
@@ -141,14 +122,6 @@ func::FuncOp buildDeallocationLibraryFunction(OpBuilder &builder, Location loc,
LogicalResult deallocateBuffersOwnershipBased(FunctionOpInterface op,
DeallocationOptions options);
-/// Creates a pass that moves allocations upwards to reduce the number of
-/// required copies that are inserted during the BufferDeallocation pass.
-std::unique_ptr<Pass> createBufferHoistingPass();
-
-/// Creates a pass that moves allocations upwards out of loops. This avoids
-/// reallocations inside of loops.
-std::unique_ptr<Pass> createBufferLoopHoistingPass();
-
// Options struct for BufferResultsToOutParams pass.
// Note: defined only here, not in tablegen.
struct BufferResultsToOutParamsOpts {
@@ -192,51 +165,20 @@ struct BufferResultsToOutParamsOpts {
bool hoistStaticAllocs = false;
};
-/// Creates a pass that converts memref function results to out-params.
-std::unique_ptr<Pass> createBufferResultsToOutParamsPass(
- const BufferResultsToOutParamsOpts &options = {});
-
/// Replace buffers that are returned from a function with an out parameter.
/// Also update all call sites.
LogicalResult
promoteBufferResultsToOutParams(ModuleOp module,
const BufferResultsToOutParamsOpts &options);
-/// Creates a pass that drops memref function results that are equivalent to a
-/// function argument.
-std::unique_ptr<Pass> createDropEquivalentBufferResultsPass();
-
-/// Create a pass that rewrites tensor.empty to bufferization.alloc_tensor.
-std::unique_ptr<Pass> createEmptyTensorToAllocTensorPass();
-
/// Drop all memref function results that are equivalent to a function argument.
LogicalResult dropEquivalentBufferResults(ModuleOp module);
-/// Create a pass that bufferizes all ops that implement BufferizableOpInterface
-/// with One-Shot Bufferize.
-std::unique_ptr<Pass> createOneShotBufferizePass();
-
-/// Create a pass that bufferizes all ops that implement BufferizableOpInterface
-/// with One-Shot Bufferize and the specified bufferization options.
-std::unique_ptr<Pass>
-createOneShotBufferizePass(const OneShotBufferizationOptions &options);
-
-/// Creates a pass that promotes heap-based allocations to stack-based ones.
-/// Only buffers smaller than the provided size are promoted.
-/// Dynamic shaped buffers are promoted up to the given rank.
-std::unique_ptr<Pass>
-createPromoteBuffersToStackPass(unsigned maxAllocSizeInBytes = 1024,
- unsigned maxRankOfAllocatedMemRef = 1);
-
/// Creates a pass that promotes heap-based allocations to stack-based ones.
/// Only buffers smaller with `isSmallAlloc(alloc) == true` are promoted.
std::unique_ptr<Pass>
createPromoteBuffersToStackPass(std::function<bool(Value)> isSmallAlloc);
-/// Create a pass that tries to eliminate tensor.empty ops that are anchored on
-/// insert_slice ops.
-std::unique_ptr<Pass> createEmptyTensorEliminationPass();
-
//===----------------------------------------------------------------------===//
// Registration
//===----------------------------------------------------------------------===//
diff --git a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.td b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.td
index f20f177d8443b..9c51935dc3892 100644
--- a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.td
@@ -11,7 +11,7 @@
include "mlir/Pass/PassBase.td"
-def OwnershipBasedBufferDeallocation : Pass<
+def OwnershipBasedBufferDeallocationPass : Pass<
"ownership-based-buffer-deallocation"> {
let summary = "Adds all required dealloc operations for all allocations in "
"the input program";
@@ -144,7 +144,6 @@ def OwnershipBasedBufferDeallocation : Pass<
"dynamically pass ownership of memrefs to callees. This can enable "
"earlier deallocations.">,
];
- let constructor = "mlir::bufferization::createOwnershipBasedBufferDeallocationPass()";
let dependentDialects = [
"mlir::bufferization::BufferizationDialect", "mlir::arith::ArithDialect",
@@ -152,7 +151,7 @@ def OwnershipBasedBufferDeallocation : Pass<
];
}
-def BufferDeallocationSimplification :
+def BufferDeallocationSimplificationPass :
Pass<"buffer-deallocation-simplification"> {
let summary = "Optimizes `bufferization.dealloc` operation for more "
"efficient codegen";
@@ -163,32 +162,28 @@ def BufferDeallocationSimplification :
some memref isn't deallocated twice (double free).
}];
- let constructor =
- "mlir::bufferization::createBufferDeallocationSimplificationPass()";
-
let dependentDialects = [
"mlir::bufferization::BufferizationDialect", "mlir::arith::ArithDialect",
"mlir::memref::MemRefDialect"
];
}
-def OptimizeAllocationLiveness
+def OptimizeAllocationLivenessPass
: Pass<"optimize-allocation-liveness", "func::FuncOp"> {
let summary = "This pass optimizes the liveness of temp allocations in the "
"input function";
- let description =
- [{This pass will find all operations that have a memory allocation effect.
- It will search for the corresponding deallocation and move it right after
- the last user of the allocation.
- This will optimize the liveness of the allocations.
-
- The pass is expected to run after the deallocation pipeline.}];
- let constructor =
- "mlir::bufferization::createOptimizeAllocationLivenessPass()";
+ let description = [{
+ This pass will find all operations that have a memory allocation effect.
+ It will search for the corresponding deallocation and move it right after
+ the last user of the allocation.
+ This will optimize the liveness of the allocations.
+
+ The pass is expected to run after the deallocation pipeline.
+ }];
let dependentDialects = ["mlir::memref::MemRefDialect"];
}
-def LowerDeallocations : Pass<"bufferization-lower-deallocations"> {
+def LowerDeallocationsPass : Pass<"bufferization-lower-deallocations"> {
let summary = "Lowers `bufferization.dealloc` operations to `memref.dealloc`"
"operations";
let description = [{
@@ -202,36 +197,31 @@ def LowerDeallocations : Pass<"bufferization-lower-deallocations"> {
library functions to avoid code-size blow-up.
}];
- let constructor =
- "mlir::bufferization::createLowerDeallocationsPass()";
-
let dependentDialects = [
"arith::ArithDialect", "memref::MemRefDialect", "scf::SCFDialect",
"func::FuncDialect"
];
}
-def BufferHoisting : Pass<"buffer-hoisting", "func::FuncOp"> {
+def BufferHoistingPass : Pass<"buffer-hoisting", "func::FuncOp"> {
let summary = "Optimizes placement of allocation operations by moving them "
"into common dominators and out of nested regions";
let description = [{
This pass implements an approach to aggressively move allocations upwards
into common dominators and out of nested regions.
}];
- let constructor = "mlir::bufferization::createBufferHoistingPass()";
}
-def BufferLoopHoisting : Pass<"buffer-loop-hoisting", "func::FuncOp"> {
+def BufferLoopHoistingPass : Pass<"buffer-loop-hoisting", "func::FuncOp"> {
let summary = "Optimizes placement of allocation operations by moving them "
"out of loop nests";
let description = [{
This pass implements an approach to aggressively move allocations upwards
out of loop nests. It does not move allocations into common dominators.
}];
- let constructor = "mlir::bufferization::createBufferLoopHoistingPass()";
}
-def BufferResultsToOutParams : Pass<"buffer-results-to-out-params", "ModuleOp"> {
+def BufferResultsToOutParamsPass : Pass<"buffer-results-to-out-params", "ModuleOp"> {
let summary = "Converts memref-typed function results to out-params";
let description = [{
Some calling conventions prefer to pass output memrefs as "out params". The
@@ -266,11 +256,10 @@ def BufferResultsToOutParams : Pass<"buffer-results-to-out-params", "ModuleOp">
"bool", /*default=*/"false",
"Hoist static allocations to call sites.">,
];
- let constructor = "mlir::bufferization::createBufferResultsToOutParamsPass()";
let dependentDialects = ["memref::MemRefDialect"];
}
-def DropEquivalentBufferResults : Pass<"drop-equivalent-buffer-results", "ModuleOp"> {
+def DropEquivalentBufferResultsPass : Pass<"drop-equivalent-buffer-results", "ModuleOp"> {
let summary = "Remove MemRef return values that are equivalent to a bbArg";
let description = [{
This pass removes MemRef return values from functions if they are equivalent
@@ -280,22 +269,20 @@ def DropEquivalentBufferResults : Pass<"drop-equivalent-buffer-results", "Module
Note: If a bbArg buffer is not returned directly but casted to beforehand,
the buffer is still considered equivalent.
}];
- let constructor = "mlir::bufferization::createDropEquivalentBufferResultsPass()";
let dependentDialects = ["memref::MemRefDialect"];
}
-def EmptyTensorToAllocTensor : Pass<"empty-tensor-to-alloc-tensor"> {
+def EmptyTensorToAllocTensorPass : Pass<"empty-tensor-to-alloc-tensor"> {
let summary = "Replace all empty ops by alloc_tensor ops.";
let description = [{
tensor.empty ops return a tensor of unspecified contents who's only purpose
is to carry the tensor shape. This pass converts such ops to
bufferization.alloc_tensor ops, which bufferize to buffer allocations.
}];
- let constructor = "mlir::bufferization::createEmptyTensorToAllocTensorPass()";
let dependentDialects = ["tensor::TensorDialect"];
}
-def OneShotBufferize : Pass<"one-shot-bufferize", "ModuleOp"> {
+def OneShotBufferizePass : Pass<"one-shot-bufferize", "ModuleOp"> {
let summary = "One-Shot Bufferize";
let description = [{
This pass bufferizes all ops that implement `BufferizableOpInterface`. It
@@ -455,7 +442,6 @@ def OneShotBufferize : Pass<"one-shot-bufferize", "ModuleOp"> {
Option<"bufferAlignment", "buffer-alignment", "uint64_t", /*default=*/"64",
"Sets the alignment of newly allocated buffers.">,
];
- let constructor = "mlir::bufferization::createOneShotBufferizePass()";
let statistics = [
Statistic<"numBufferAlloc", "num-buffer-alloc",
@@ -467,7 +453,7 @@ def OneShotBufferize : Pass<"one-shot-bufferize", "ModuleOp"> {
];
}
-def PromoteBuffersToStack : Pass<"promote-buffers-to-stack", "func::FuncOp"> {
+def PromoteBuffersToStackPass : Pass<"promote-buffers-to-stack", "func::FuncOp"> {
let summary = "Promotes heap-based allocations to automatically managed "
"stack-based allocations";
let description = [{
@@ -477,7 +463,6 @@ def PromoteBuffersToStack : Pass<"promote-buffers-to-stack", "func::FuncOp"> {
shaped buffers that are limited by the rank of the tensor can be
converted. They are only transformed if they are considered to be small.
}];
- let constructor = "mlir::bufferization::createPromoteBuffersToStackPass()";
let options = [
Option<"maxAllocSizeInBytes", "max-alloc-size-in-bytes", "unsigned",
/*default=*/"1024",
@@ -488,7 +473,7 @@ def PromoteBuffersToStack : Pass<"promote-buffers-to-stack", "func::FuncOp"> {
];
}
-def EmptyTensorElimination : Pass<"eliminate-empty-tensors"> {
+def EmptyTensorEliminationPass : Pass<"eliminate-empty-tensors"> {
let summary = "Try to eliminate all tensor.empty ops.";
let description = [{
Try to eliminate "tensor.empty" ops inside `op`. This transformation looks
@@ -508,7 +493,6 @@ def EmptyTensorElimination : Pass<"eliminate-empty-tensors"> {
"tensor.empty" op. The "tensor.empty" op is replaced with a
"tensor.extract_slice" op.
}];
- let constructor = "mlir::bufferization::createEmptyTensorEliminationPass()";
}
#endif // MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_PASSES
diff --git a/mlir/lib/Dialect/Bufferization/Pipelines/BufferizationPipelines.cpp b/mlir/lib/Dialect/Bufferization/Pipelines/BufferizationPipelines.cpp
index 7124eab882b08..b184265f464d1 100644
--- a/mlir/lib/Dialect/Bufferization/Pipelines/BufferizationPipelines.cpp
+++ b/mlir/lib/Dialect/Bufferization/Pipelines/BufferizationPipelines.cpp
@@ -22,7 +22,10 @@ void mlir::bufferization::buildBufferDeallocationPipeline(
OpPassManager &pm, const BufferDeallocationPipelineOptions &options) {
pm.addPass(memref::createExpandReallocPass(/*emitDeallocs=*/false));
pm.addPass(createCanonicalizerPass());
- pm.addPass(createOwnershipBasedBufferDeallocationPass(options));
+
+ OwnershipBasedBufferDeallocationPassOptions deallocationOptions{
+ options.privateFunctionDynamicOwnership};
+ pm.addPass(createOwnershipBasedBufferDeallocationPass(deallocationOptions));
pm.addPass(createCanonicalizerPass());
pm.addPass(createBufferDeallocationSimplificationPass());
pm.addPass(createLowerDeallocationsPass());
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp
index de3ae82f87086..35f86a62ae592 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp
@@ -22,7 +22,7 @@
namespace mlir {
namespace bufferization {
-#define GEN_PASS_DEF_BUFFERDEALLOCATIONSIMPLIFICATION
+#define GEN_PASS_DEF_BUFFERDEALLOCATIONSIMPLIFICATIONPASS
#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
} // namespace bufferization
} // namespace mlir
@@ -453,7 +453,7 @@ namespace {
/// into the right positions. Furthermore, it inserts additional clones if
/// necessary. It uses the algorithm described at the top of the file.
struct BufferDeallocationSimplificationPass
- : public bufferization::impl::BufferDeallocationSimplificationBase<
+ : public bufferization::impl::BufferDeallocationSimplificationPassBase<
BufferDeallocationSimplificationPass> {
void runOnOperation() override {
BufferOriginAnalysis analysis(getOperation());
@@ -477,8 +477,3 @@ struct BufferDeallocationSimplificationPass
};
} // namespace
-
-std::unique_ptr<Pass>
-mlir::bufferization::createBufferDeallocationSimplificationPass() {
- return std::make_unique<BufferDeallocationSimplificationPass>();
-}
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
index 93c1f9a4f2b55..ebd0d827526d7 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
@@ -24,9 +24,9 @@
namespace mlir {
namespace bufferization {
-#define GEN_PASS_DEF_BUFFERHOISTING
-#define GEN_PASS_DEF_BUFFERLOOPHOISTING
-#define GEN_PASS_DEF_PROMOTEBUFFERSTOSTACK
+#define GEN_PASS_DEF_BUFFERHOISTINGPASS
+#define GEN_PASS_DEF_BUFFERLOOPHOISTINGPASS
+#define GEN_PASS_DEF_PROMOTEBUFFERSTOSTACKPASS
#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
} // namespace bufferization
} // namespace mlir
@@ -416,7 +416,7 @@ class BufferPlacementPromotion : BufferPlacementTransformationBase {
/// The buffer hoisting pass that hoists allocation nodes into dominating
/// blocks.
struct BufferHoistingPass
- : public bufferization::impl::BufferHoistingBase<BufferHoistingPass> {
+ : public bufferization::impl::BufferHoistingPassBase<BufferHoistingPass> {
void runOnOperation() override {
// Hoist all allocations into dominator blocks.
@@ -428,7 +428,7 @@ struct BufferHoistingPass
/// The buffer loop hoisting pass that hoists allocation nodes out of loops.
struct BufferLoopHoistingPass
- : public bufferization::impl::BufferLoopHoistingBase<
+ : public bufferization::impl::BufferLoopHoistingPassBase<
BufferLoopHoistingPass> {
void runOnOperation() override {
@@ -440,15 +440,11 @@ struct BufferLoopHoistingPass
/// The promote buffer to stack pass that tries to convert alloc nodes into
/// alloca nodes.
class PromoteBuffersToStackPass
- : public bufferization::impl::PromoteBuffersToStackBase<
+ : public bufferization::impl::PromoteBuffersToStackPassBase<
PromoteBuffersToStackPass> {
-public:
- PromoteBuffersToStackPass(unsigned maxAllocSizeInBytes,
- unsigned maxRankOfAllocatedMemRef) {
- this->maxAllocSizeInBytes = maxAllocSizeInBytes;
- this->maxRankOfAllocatedMemRef = maxRankOfAllocatedMemRef;
- }
+ using Base::Base;
+public:
explicit PromoteBuffersToStackPass(std::function<bool(Value)> isSmallAlloc)
: isSmallAlloc(std::move(isSmallAlloc)) {}
@@ -479,20 +475,6 @@ void mlir::bufferization::hoistBuffersFromLoops(Operation *op) {
optimizer.hoist();
}
-std::unique_ptr<Pass> mlir::bufferization::createBufferHoistingPass() {
- return std::make_unique<BufferHoistingPass>();
-}
-
-std::unique_ptr<Pass> mlir::bufferization::createBufferLoopHoistingPass() {
- return std::make_unique<BufferLoopHoistingPass>();
-}
-
-std::unique_ptr<Pass> mlir::bufferization::createPromoteBuffersToStackPass(
- unsigned maxAllocSizeInBytes, unsigned maxRankOfAllocatedMemRef) {
- return std::make_unique<PromoteBuffersToStackPass>(maxAllocSizeInBytes,
- maxRankOfAllocatedMemRef);
-}
-
std::unique_ptr<Pass> mlir::bufferization::createPromoteBuffersToStackPass(
std::function<bool(Value)> isSmallAlloc) {
return std::make_unique<PromoteBuffersToStackPass>(std::move(isSmallAlloc));
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp
index ce0f112dc2dd2..1c95ab77b9f33 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp
@@ -16,7 +16,7 @@
namespace mlir {
namespace bufferization {
-#define GEN_PASS_DEF_BUFFERRESULTSTOOUTPARAMS
+#define GEN_PASS_DEF_BUFFERRESULTSTOOUTPARAMSPASS
#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
} // namespace bufferization
} // namespace mlir
@@ -233,11 +233,9 @@ LogicalResult mlir::bufferization::promoteBufferResultsToOutParams(
namespace {
struct BufferResultsToOutParamsPass
- : bufferization::impl::BufferResultsToOutParamsBase<
+ : bufferization::impl::BufferResultsToOutParamsPassBase<
BufferResultsToOutParamsPass> {
- explicit BufferResultsToOutParamsPass(
- const bufferization::BufferResultsToOutParamsOpts &options)
- : options(options) {}
+ using Base::Base;
void runOnOperation() override {
// Convert from pass options i...
[truncated]
|
@llvm/pr-subscribers-mlir-bufferization Author: lorenzo chelini (chelini) Changes
Patch is 30.77 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/129850.diff 13 Files Affected:
diff --git a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
index c5d0853d6ff97..493180cd54e5b 100644
--- a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
@@ -30,25 +30,6 @@ using DeallocHelperMap = llvm::DenseMap<Operation *, func::FuncOp>;
#define GEN_PASS_DECL
#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
-/// Creates an instance of the OwnershipBasedBufferDeallocation pass to free all
-/// allocated buffers.
-std::unique_ptr<Pass> createOwnershipBasedBufferDeallocationPass(
- DeallocationOptions options = DeallocationOptions());
-
-/// Creates a pass that finds all temporary allocations
-/// and attempts to move the deallocation after the last user/dependency
-/// of the allocation, thereby optimizing allocation liveness.
-std::unique_ptr<Pass> createOptimizeAllocationLivenessPass();
-
-/// Creates a pass that optimizes `bufferization.dealloc` operations. For
-/// example, it reduces the number of alias checks needed at runtime using
-/// static alias analysis.
-std::unique_ptr<Pass> createBufferDeallocationSimplificationPass();
-
-/// Creates an instance of the LowerDeallocations pass to lower
-/// `bufferization.dealloc` operations to the `memref` dialect.
-std::unique_ptr<Pass> createLowerDeallocationsPass();
-
/// Adds the conversion pattern of the `bufferization.dealloc` operation to the
/// given pattern set for use in other transformation passes.
void populateBufferizationDeallocLoweringPattern(
@@ -141,14 +122,6 @@ func::FuncOp buildDeallocationLibraryFunction(OpBuilder &builder, Location loc,
LogicalResult deallocateBuffersOwnershipBased(FunctionOpInterface op,
DeallocationOptions options);
-/// Creates a pass that moves allocations upwards to reduce the number of
-/// required copies that are inserted during the BufferDeallocation pass.
-std::unique_ptr<Pass> createBufferHoistingPass();
-
-/// Creates a pass that moves allocations upwards out of loops. This avoids
-/// reallocations inside of loops.
-std::unique_ptr<Pass> createBufferLoopHoistingPass();
-
// Options struct for BufferResultsToOutParams pass.
// Note: defined only here, not in tablegen.
struct BufferResultsToOutParamsOpts {
@@ -192,51 +165,20 @@ struct BufferResultsToOutParamsOpts {
bool hoistStaticAllocs = false;
};
-/// Creates a pass that converts memref function results to out-params.
-std::unique_ptr<Pass> createBufferResultsToOutParamsPass(
- const BufferResultsToOutParamsOpts &options = {});
-
/// Replace buffers that are returned from a function with an out parameter.
/// Also update all call sites.
LogicalResult
promoteBufferResultsToOutParams(ModuleOp module,
const BufferResultsToOutParamsOpts &options);
-/// Creates a pass that drops memref function results that are equivalent to a
-/// function argument.
-std::unique_ptr<Pass> createDropEquivalentBufferResultsPass();
-
-/// Create a pass that rewrites tensor.empty to bufferization.alloc_tensor.
-std::unique_ptr<Pass> createEmptyTensorToAllocTensorPass();
-
/// Drop all memref function results that are equivalent to a function argument.
LogicalResult dropEquivalentBufferResults(ModuleOp module);
-/// Create a pass that bufferizes all ops that implement BufferizableOpInterface
-/// with One-Shot Bufferize.
-std::unique_ptr<Pass> createOneShotBufferizePass();
-
-/// Create a pass that bufferizes all ops that implement BufferizableOpInterface
-/// with One-Shot Bufferize and the specified bufferization options.
-std::unique_ptr<Pass>
-createOneShotBufferizePass(const OneShotBufferizationOptions &options);
-
-/// Creates a pass that promotes heap-based allocations to stack-based ones.
-/// Only buffers smaller than the provided size are promoted.
-/// Dynamic shaped buffers are promoted up to the given rank.
-std::unique_ptr<Pass>
-createPromoteBuffersToStackPass(unsigned maxAllocSizeInBytes = 1024,
- unsigned maxRankOfAllocatedMemRef = 1);
-
/// Creates a pass that promotes heap-based allocations to stack-based ones.
/// Only buffers smaller with `isSmallAlloc(alloc) == true` are promoted.
std::unique_ptr<Pass>
createPromoteBuffersToStackPass(std::function<bool(Value)> isSmallAlloc);
-/// Create a pass that tries to eliminate tensor.empty ops that are anchored on
-/// insert_slice ops.
-std::unique_ptr<Pass> createEmptyTensorEliminationPass();
-
//===----------------------------------------------------------------------===//
// Registration
//===----------------------------------------------------------------------===//
diff --git a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.td b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.td
index f20f177d8443b..9c51935dc3892 100644
--- a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.td
@@ -11,7 +11,7 @@
include "mlir/Pass/PassBase.td"
-def OwnershipBasedBufferDeallocation : Pass<
+def OwnershipBasedBufferDeallocationPass : Pass<
"ownership-based-buffer-deallocation"> {
let summary = "Adds all required dealloc operations for all allocations in "
"the input program";
@@ -144,7 +144,6 @@ def OwnershipBasedBufferDeallocation : Pass<
"dynamically pass ownership of memrefs to callees. This can enable "
"earlier deallocations.">,
];
- let constructor = "mlir::bufferization::createOwnershipBasedBufferDeallocationPass()";
let dependentDialects = [
"mlir::bufferization::BufferizationDialect", "mlir::arith::ArithDialect",
@@ -152,7 +151,7 @@ def OwnershipBasedBufferDeallocation : Pass<
];
}
-def BufferDeallocationSimplification :
+def BufferDeallocationSimplificationPass :
Pass<"buffer-deallocation-simplification"> {
let summary = "Optimizes `bufferization.dealloc` operation for more "
"efficient codegen";
@@ -163,32 +162,28 @@ def BufferDeallocationSimplification :
some memref isn't deallocated twice (double free).
}];
- let constructor =
- "mlir::bufferization::createBufferDeallocationSimplificationPass()";
-
let dependentDialects = [
"mlir::bufferization::BufferizationDialect", "mlir::arith::ArithDialect",
"mlir::memref::MemRefDialect"
];
}
-def OptimizeAllocationLiveness
+def OptimizeAllocationLivenessPass
: Pass<"optimize-allocation-liveness", "func::FuncOp"> {
let summary = "This pass optimizes the liveness of temp allocations in the "
"input function";
- let description =
- [{This pass will find all operations that have a memory allocation effect.
- It will search for the corresponding deallocation and move it right after
- the last user of the allocation.
- This will optimize the liveness of the allocations.
-
- The pass is expected to run after the deallocation pipeline.}];
- let constructor =
- "mlir::bufferization::createOptimizeAllocationLivenessPass()";
+ let description = [{
+ This pass will find all operations that have a memory allocation effect.
+ It will search for the corresponding deallocation and move it right after
+ the last user of the allocation.
+ This will optimize the liveness of the allocations.
+
+ The pass is expected to run after the deallocation pipeline.
+ }];
let dependentDialects = ["mlir::memref::MemRefDialect"];
}
-def LowerDeallocations : Pass<"bufferization-lower-deallocations"> {
+def LowerDeallocationsPass : Pass<"bufferization-lower-deallocations"> {
let summary = "Lowers `bufferization.dealloc` operations to `memref.dealloc`"
"operations";
let description = [{
@@ -202,36 +197,31 @@ def LowerDeallocations : Pass<"bufferization-lower-deallocations"> {
library functions to avoid code-size blow-up.
}];
- let constructor =
- "mlir::bufferization::createLowerDeallocationsPass()";
-
let dependentDialects = [
"arith::ArithDialect", "memref::MemRefDialect", "scf::SCFDialect",
"func::FuncDialect"
];
}
-def BufferHoisting : Pass<"buffer-hoisting", "func::FuncOp"> {
+def BufferHoistingPass : Pass<"buffer-hoisting", "func::FuncOp"> {
let summary = "Optimizes placement of allocation operations by moving them "
"into common dominators and out of nested regions";
let description = [{
This pass implements an approach to aggressively move allocations upwards
into common dominators and out of nested regions.
}];
- let constructor = "mlir::bufferization::createBufferHoistingPass()";
}
-def BufferLoopHoisting : Pass<"buffer-loop-hoisting", "func::FuncOp"> {
+def BufferLoopHoistingPass : Pass<"buffer-loop-hoisting", "func::FuncOp"> {
let summary = "Optimizes placement of allocation operations by moving them "
"out of loop nests";
let description = [{
This pass implements an approach to aggressively move allocations upwards
out of loop nests. It does not move allocations into common dominators.
}];
- let constructor = "mlir::bufferization::createBufferLoopHoistingPass()";
}
-def BufferResultsToOutParams : Pass<"buffer-results-to-out-params", "ModuleOp"> {
+def BufferResultsToOutParamsPass : Pass<"buffer-results-to-out-params", "ModuleOp"> {
let summary = "Converts memref-typed function results to out-params";
let description = [{
Some calling conventions prefer to pass output memrefs as "out params". The
@@ -266,11 +256,10 @@ def BufferResultsToOutParams : Pass<"buffer-results-to-out-params", "ModuleOp">
"bool", /*default=*/"false",
"Hoist static allocations to call sites.">,
];
- let constructor = "mlir::bufferization::createBufferResultsToOutParamsPass()";
let dependentDialects = ["memref::MemRefDialect"];
}
-def DropEquivalentBufferResults : Pass<"drop-equivalent-buffer-results", "ModuleOp"> {
+def DropEquivalentBufferResultsPass : Pass<"drop-equivalent-buffer-results", "ModuleOp"> {
let summary = "Remove MemRef return values that are equivalent to a bbArg";
let description = [{
This pass removes MemRef return values from functions if they are equivalent
@@ -280,22 +269,20 @@ def DropEquivalentBufferResults : Pass<"drop-equivalent-buffer-results", "Module
Note: If a bbArg buffer is not returned directly but casted to beforehand,
the buffer is still considered equivalent.
}];
- let constructor = "mlir::bufferization::createDropEquivalentBufferResultsPass()";
let dependentDialects = ["memref::MemRefDialect"];
}
-def EmptyTensorToAllocTensor : Pass<"empty-tensor-to-alloc-tensor"> {
+def EmptyTensorToAllocTensorPass : Pass<"empty-tensor-to-alloc-tensor"> {
let summary = "Replace all empty ops by alloc_tensor ops.";
let description = [{
tensor.empty ops return a tensor of unspecified contents who's only purpose
is to carry the tensor shape. This pass converts such ops to
bufferization.alloc_tensor ops, which bufferize to buffer allocations.
}];
- let constructor = "mlir::bufferization::createEmptyTensorToAllocTensorPass()";
let dependentDialects = ["tensor::TensorDialect"];
}
-def OneShotBufferize : Pass<"one-shot-bufferize", "ModuleOp"> {
+def OneShotBufferizePass : Pass<"one-shot-bufferize", "ModuleOp"> {
let summary = "One-Shot Bufferize";
let description = [{
This pass bufferizes all ops that implement `BufferizableOpInterface`. It
@@ -455,7 +442,6 @@ def OneShotBufferize : Pass<"one-shot-bufferize", "ModuleOp"> {
Option<"bufferAlignment", "buffer-alignment", "uint64_t", /*default=*/"64",
"Sets the alignment of newly allocated buffers.">,
];
- let constructor = "mlir::bufferization::createOneShotBufferizePass()";
let statistics = [
Statistic<"numBufferAlloc", "num-buffer-alloc",
@@ -467,7 +453,7 @@ def OneShotBufferize : Pass<"one-shot-bufferize", "ModuleOp"> {
];
}
-def PromoteBuffersToStack : Pass<"promote-buffers-to-stack", "func::FuncOp"> {
+def PromoteBuffersToStackPass : Pass<"promote-buffers-to-stack", "func::FuncOp"> {
let summary = "Promotes heap-based allocations to automatically managed "
"stack-based allocations";
let description = [{
@@ -477,7 +463,6 @@ def PromoteBuffersToStack : Pass<"promote-buffers-to-stack", "func::FuncOp"> {
shaped buffers that are limited by the rank of the tensor can be
converted. They are only transformed if they are considered to be small.
}];
- let constructor = "mlir::bufferization::createPromoteBuffersToStackPass()";
let options = [
Option<"maxAllocSizeInBytes", "max-alloc-size-in-bytes", "unsigned",
/*default=*/"1024",
@@ -488,7 +473,7 @@ def PromoteBuffersToStack : Pass<"promote-buffers-to-stack", "func::FuncOp"> {
];
}
-def EmptyTensorElimination : Pass<"eliminate-empty-tensors"> {
+def EmptyTensorEliminationPass : Pass<"eliminate-empty-tensors"> {
let summary = "Try to eliminate all tensor.empty ops.";
let description = [{
Try to eliminate "tensor.empty" ops inside `op`. This transformation looks
@@ -508,7 +493,6 @@ def EmptyTensorElimination : Pass<"eliminate-empty-tensors"> {
"tensor.empty" op. The "tensor.empty" op is replaced with a
"tensor.extract_slice" op.
}];
- let constructor = "mlir::bufferization::createEmptyTensorEliminationPass()";
}
#endif // MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_PASSES
diff --git a/mlir/lib/Dialect/Bufferization/Pipelines/BufferizationPipelines.cpp b/mlir/lib/Dialect/Bufferization/Pipelines/BufferizationPipelines.cpp
index 7124eab882b08..b184265f464d1 100644
--- a/mlir/lib/Dialect/Bufferization/Pipelines/BufferizationPipelines.cpp
+++ b/mlir/lib/Dialect/Bufferization/Pipelines/BufferizationPipelines.cpp
@@ -22,7 +22,10 @@ void mlir::bufferization::buildBufferDeallocationPipeline(
OpPassManager &pm, const BufferDeallocationPipelineOptions &options) {
pm.addPass(memref::createExpandReallocPass(/*emitDeallocs=*/false));
pm.addPass(createCanonicalizerPass());
- pm.addPass(createOwnershipBasedBufferDeallocationPass(options));
+
+ OwnershipBasedBufferDeallocationPassOptions deallocationOptions{
+ options.privateFunctionDynamicOwnership};
+ pm.addPass(createOwnershipBasedBufferDeallocationPass(deallocationOptions));
pm.addPass(createCanonicalizerPass());
pm.addPass(createBufferDeallocationSimplificationPass());
pm.addPass(createLowerDeallocationsPass());
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp
index de3ae82f87086..35f86a62ae592 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp
@@ -22,7 +22,7 @@
namespace mlir {
namespace bufferization {
-#define GEN_PASS_DEF_BUFFERDEALLOCATIONSIMPLIFICATION
+#define GEN_PASS_DEF_BUFFERDEALLOCATIONSIMPLIFICATIONPASS
#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
} // namespace bufferization
} // namespace mlir
@@ -453,7 +453,7 @@ namespace {
/// into the right positions. Furthermore, it inserts additional clones if
/// necessary. It uses the algorithm described at the top of the file.
struct BufferDeallocationSimplificationPass
- : public bufferization::impl::BufferDeallocationSimplificationBase<
+ : public bufferization::impl::BufferDeallocationSimplificationPassBase<
BufferDeallocationSimplificationPass> {
void runOnOperation() override {
BufferOriginAnalysis analysis(getOperation());
@@ -477,8 +477,3 @@ struct BufferDeallocationSimplificationPass
};
} // namespace
-
-std::unique_ptr<Pass>
-mlir::bufferization::createBufferDeallocationSimplificationPass() {
- return std::make_unique<BufferDeallocationSimplificationPass>();
-}
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
index 93c1f9a4f2b55..ebd0d827526d7 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
@@ -24,9 +24,9 @@
namespace mlir {
namespace bufferization {
-#define GEN_PASS_DEF_BUFFERHOISTING
-#define GEN_PASS_DEF_BUFFERLOOPHOISTING
-#define GEN_PASS_DEF_PROMOTEBUFFERSTOSTACK
+#define GEN_PASS_DEF_BUFFERHOISTINGPASS
+#define GEN_PASS_DEF_BUFFERLOOPHOISTINGPASS
+#define GEN_PASS_DEF_PROMOTEBUFFERSTOSTACKPASS
#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
} // namespace bufferization
} // namespace mlir
@@ -416,7 +416,7 @@ class BufferPlacementPromotion : BufferPlacementTransformationBase {
/// The buffer hoisting pass that hoists allocation nodes into dominating
/// blocks.
struct BufferHoistingPass
- : public bufferization::impl::BufferHoistingBase<BufferHoistingPass> {
+ : public bufferization::impl::BufferHoistingPassBase<BufferHoistingPass> {
void runOnOperation() override {
// Hoist all allocations into dominator blocks.
@@ -428,7 +428,7 @@ struct BufferHoistingPass
/// The buffer loop hoisting pass that hoists allocation nodes out of loops.
struct BufferLoopHoistingPass
- : public bufferization::impl::BufferLoopHoistingBase<
+ : public bufferization::impl::BufferLoopHoistingPassBase<
BufferLoopHoistingPass> {
void runOnOperation() override {
@@ -440,15 +440,11 @@ struct BufferLoopHoistingPass
/// The promote buffer to stack pass that tries to convert alloc nodes into
/// alloca nodes.
class PromoteBuffersToStackPass
- : public bufferization::impl::PromoteBuffersToStackBase<
+ : public bufferization::impl::PromoteBuffersToStackPassBase<
PromoteBuffersToStackPass> {
-public:
- PromoteBuffersToStackPass(unsigned maxAllocSizeInBytes,
- unsigned maxRankOfAllocatedMemRef) {
- this->maxAllocSizeInBytes = maxAllocSizeInBytes;
- this->maxRankOfAllocatedMemRef = maxRankOfAllocatedMemRef;
- }
+ using Base::Base;
+public:
explicit PromoteBuffersToStackPass(std::function<bool(Value)> isSmallAlloc)
: isSmallAlloc(std::move(isSmallAlloc)) {}
@@ -479,20 +475,6 @@ void mlir::bufferization::hoistBuffersFromLoops(Operation *op) {
optimizer.hoist();
}
-std::unique_ptr<Pass> mlir::bufferization::createBufferHoistingPass() {
- return std::make_unique<BufferHoistingPass>();
-}
-
-std::unique_ptr<Pass> mlir::bufferization::createBufferLoopHoistingPass() {
- return std::make_unique<BufferLoopHoistingPass>();
-}
-
-std::unique_ptr<Pass> mlir::bufferization::createPromoteBuffersToStackPass(
- unsigned maxAllocSizeInBytes, unsigned maxRankOfAllocatedMemRef) {
- return std::make_unique<PromoteBuffersToStackPass>(maxAllocSizeInBytes,
- maxRankOfAllocatedMemRef);
-}
-
std::unique_ptr<Pass> mlir::bufferization::createPromoteBuffersToStackPass(
std::function<bool(Value)> isSmallAlloc) {
return std::make_unique<PromoteBuffersToStackPass>(std::move(isSmallAlloc));
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp
index ce0f112dc2dd2..1c95ab77b9f33 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp
@@ -16,7 +16,7 @@
namespace mlir {
namespace bufferization {
-#define GEN_PASS_DEF_BUFFERRESULTSTOOUTPARAMS
+#define GEN_PASS_DEF_BUFFERRESULTSTOOUTPARAMSPASS
#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
} // namespace bufferization
} // namespace mlir
@@ -233,11 +233,9 @@ LogicalResult mlir::bufferization::promoteBufferResultsToOutParams(
namespace {
struct BufferResultsToOutParamsPass
- : bufferization::impl::BufferResultsToOutParamsBase<
+ : bufferization::impl::BufferResultsToOutParamsPassBase<
BufferResultsToOutParamsPass> {
- explicit BufferResultsToOutParamsPass(
- const bufferization::BufferResultsToOutParamsOpts &options)
- : options(options) {}
+ using Base::Base;
void runOnOperation() override {
// Convert from pass options i...
[truncated]
|
877d893
to
d9afdb4
Compare
: public bufferization::impl::OneShotBufferizeBase<OneShotBufferizePass> { | ||
OneShotBufferizePass() = default; | ||
|
||
explicit OneShotBufferizePass(const OneShotBufferizationOptions &options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems now there is no way anymore to pass OneShotBufferizationOptions to OneShotBufferizePass?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I guess OneShotBufferizePassOptions allow to set the same set of options?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I see those options would be carried over to the OnShotBufferizationOptions in line 77. So answering my question, it looks like we can just use OneShotBufferizePassOptions and pass them to createOneShotBufferizePass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to use OneShotBufferizePassOptions instead of OneShotBufferizationOptions. Are there any options missing in OneShotBufferizePassOptions that you need?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, seems to be fine, I was just confused and didnt know how I need to update our code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I understand that what I suggest requires extra effort, I have to say that maintaining a local modification has its own cost too. Maintaining a patch in a downstream fork may sound like a universal solution, but it may quickly become prohibitively expensive when later commits change surrounding lines of code causing merge problems or change/remove the dependencies of the locally modified code.
I don't know how far @akuegel and other folks involved in this particular migration are from finishing it, and whether reintroducing the retired API upstream would be valuable to us, but I wanted to articulate that the way this change was made caused a significant pain to a number of teams at Google (maybe to maintainers of other downstream codebases as well). And the suggested approach (maintaining a local patch) is not a universal (or sometimes even acceptable) solution.
A more careful approach to executing breaking API changes would definitely be welcome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
, but it may quickly become prohibitively expensive when later commits change surrounding lines of code causing merge problems or change/remove the dependencies of the locally modified code.
Right: but you're trading off the cost of your own migration and maintenance with cost of the upstream maintenance by doing so.
Not saying it's not possible to deprecate things upstream, we often do it, but it's not straightforward in general and definitely not free. Especially for cleanups like this (which are overdue by O(years) by the way), adding more maintenance cost on upstream is taking a toll on the few people who are actually doing cleanup/maintenance/tech debt pay up. So if I have to choose, I definitely will pass the cost onto you maintaining this patch and paying the price of possible merge conflicts downstream (these merge conflicts are actually a good reminder of paying the tech debt, and provide a motivation for folks to finish their migration downstream, or decide for themselves if the cost of the on-going debt is worth it to delay the migration).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right: but you're trading off the cost of your own migration and maintenance ...
Exactly. With a caveat of our codebase possibly being not the only one broken this way by MLIR changes. So there is an unknown to me, but likely greater than one, factor on the "downstream dependencies" side of this tradeoff.
In LLVM, Clang and libc++ projects this factor is usually being accounted for. Those are different in many regards, probably have more contributors and are dependent on significantly more widely. But hopefully, there is a way the few MLIR maintainers could still consider possible downstream impact when planning breaking changes.
Luckily, this particular migration seems to have been addressed on our side, so my appeal is about the general approach and future changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I likely would have handled this kind of changes the same way in LLVM and/or Clang in the past FYI. This is a recurring topic though, I'm not sure we should change the status quo (for the reasons I mentioned above: upstream maintenance is not rewarding and relying on good will, making it harder is going counter to the general health of the project).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you want to pass functionBoundaryTypeConversion, with the tablegen options it is just a string. With mlir::bufferization::OneShotBufferizationOptions it is an enum.
I feel like I am missing something: you can have enum options with TableGen as far as I know.
I have just created #132121 to turn this option into an enum.
|
||
/// Create a pass that bufferizes all ops that implement BufferizableOpInterface | ||
/// with One-Shot Bufferize and the specified bufferization options. | ||
std::unique_ptr<Pass> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was it intentional that this was removed as well?
It doesn't look like this is generated with tablegen? Only a method that allows to pass OneShotBufferizePassOptions.
Those are different than OneShotBufferizationOptions:
https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h
bump to llvm@[967ab7e08e62a35cc65f34e21fbeb00abf3eb83f](iree-org/llvm-project@967ab7e) create one revert commit@[c190c8d](iree-org/llvm-project@c190c8d) to this PR llvm/llvm-project#129850. add the commit [@d80a859](iree-org/llvm-project@d80a859) to fix bazel test error. PR #129850 attempted to use TableGen to define OneShotBufferizePassOption for controlling the bufferization of all operations. However, it appears that the TableGen implementation does not yet fully support all the options available in the manually defined OneShotBufferizationOptions struct. For the usage of all the vector transformation options, follow Jakub's suggestion below to pick up the default values instead of setting them manually. ```c++ VectorTransformsOptions defaultOptions; ... vector::populateVectorTransposeLoweringPatterns( patterns, defaultOptions.vectorTransposeLowering); ``` --------- Signed-off-by: Bangtian Liu <[email protected]>
bump to llvm/llvm-project@cdf10d7 cherry-pick revert commit@[add3564](iree-org/llvm-project@add3564) to this PR llvm/llvm-project#129850. add revert commit [f8fe920](llvm/llvm-project@f8fe920) to this insert/extract_slice verifier PR: llvm/llvm-project#130487. --------- Signed-off-by: Bangtian Liu <[email protected]>
bump to llvm/llvm-project@e45090e cherry-pick revert commit iree-org/llvm-project@d5d87f9 to llvm/llvm-project#129850 cherry-pick revert commit iree-org/llvm-project@3e15932 to llvm/llvm-project#130487 add commit iree-org/llvm-project@a1fc066 to fix msvc debug build. --------- Signed-off-by: Bangtian Liu <[email protected]>
bump to llvm/llvm-project@e45090e cherry-pick revert commit iree-org/llvm-project@d5d87f9 to llvm/llvm-project#129850 cherry-pick revert commit iree-org/llvm-project@3e15932 to llvm/llvm-project#130487 add commit iree-org/llvm-project@a1fc066 to fix msvc debug build. --------- Signed-off-by: Bangtian Liu <[email protected]>
`let constructor` is legacy (do not use in tree!) since the table gen backend emits most of the glue logic to build a pass.
bump to llvm/llvm-project@e45090e cherry-pick revert commit iree-org/llvm-project@d5d87f9 to llvm/llvm-project#129850 cherry-pick revert commit iree-org/llvm-project@3e15932 to llvm/llvm-project#130487 add commit iree-org/llvm-project@a1fc066 to fix msvc debug build. --------- Signed-off-by: Bangtian Liu <[email protected]> Signed-off-by: Elias Joseph <[email protected]>
let constructor
is legacy (do not use in tree!) since the table genbackend emits most of the glue logic to build a pass.