Skip to content

BufferReuse #287

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions mlir/include/mlir/Transforms/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ std::unique_ptr<Pass>
createPromoteBuffersToStackPass(unsigned maxAllocSizeInBytes = 1024,
unsigned bitwidthOfIndexType = 64);

/// Creates a pass that reuses buffers which are already allocated.
std::unique_ptr<Pass> createBufferReusePass();

/// Creates a pass that converts memref function results to out-params.
std::unique_ptr<Pass> createBufferResultsToOutParamsPass();

Expand Down
12 changes: 12 additions & 0 deletions mlir/include/mlir/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,18 @@ def PromoteBuffersToStack : FunctionPass<"promote-buffers-to-stack"> {
];
}

def BufferReuse : FunctionPass<"buffer-reuse"> {
let summary = "Reuses already allocated buffers to save allocation "
"operations if all criteria are met";
let description = [{
This pass tries to reuse already allocated buffers if they have the same
size, are in the right appearance order, have no interference among
themselves and have a short distance between those buffers (this prevents
unnecessary allocated memory for long distances).
}];
let constructor = "mlir::createBufferReusePass()";
}

def BufferResultsToOutParams : Pass<"buffer-results-to-out-params", "ModuleOp"> {
let summary = "Converts memref-typed function results to out-params";
let description = [{
Expand Down
Loading