Skip to content

Commit 48fcfaf

Browse files
authored
[NFC][mlir][bufferization] Add paragraph about runtime and space cost to bufferization.dealloc op documentation (#65612)
1 parent 370880c commit 48fcfaf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,13 @@ def Bufferization_DeallocOp : Bufferization_Op<"dealloc", [
523523
`%r0`, `%r1`, or `%r2` are aliases of `%a0`. `%a1` will be deallocated when
524524
`%cond1` is set to 'true' and none of `%r0`, %r1`, `%r2`, and `%a0` are
525525
aliases.
526+
527+
Note that this can be an expensive operation if there are many operands that
528+
cannot be optimized away. The runtime cost of this operation (assuming that
529+
nothing is optimized away) is `O(|memrefs|^2+|memrefs|*|retained|)`. The
530+
cost in terms of memory space is `O(|memrefs|+|retained|)`. As a result, it
531+
is recommended to place it carefully in the IR such that most operands can
532+
be optimized away by running the `buffer-deallocation-simplification` pass.
526533
}];
527534

528535
let arguments = (ins Variadic<AnyRankedOrUnrankedMemRef>:$memrefs,

0 commit comments

Comments
 (0)