[Mlir-commits] [mlir] [NFC][mlir][bufferization] Add paragraph about runtime and space cost to bufferization.dealloc op documentation (PR #65612)

Martin Erhart llvmlistbot at llvm.org
Thu Sep 7 07:48:32 PDT 2023


https://github.com/maerhart created https://github.com/llvm/llvm-project/pull/65612:

None

>From 08eca6fc3d11c3e06306ff2d513f182359790e59 Mon Sep 17 00:00:00 2001
From: Martin Erhart <merhart at google.com>
Date: Thu, 7 Sep 2023 14:44:59 +0000
Subject: [PATCH] [NFC][mlir][bufferization] Add paragraph about runtime and
 space cost to bufferization.dealloc op documentation

---
 .../mlir/Dialect/Bufferization/IR/BufferizationOps.td     | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
index fec07af349b3a8d..640d8100bbc126c 100644
--- a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
+++ b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
@@ -523,6 +523,14 @@ def Bufferization_DeallocOp : Bufferization_Op<"dealloc", [
     `%r0`, `%r1`, or `%r2` are aliases of `%a0`. `%a1` will be deallocated when
     `%cond1` is set to 'true' and none of `%r0`, %r1`, `%r2`, and `%a0` are
     aliases.
+
+    Note that this can be an expensive operation if there are many operands and
+    they cannot be optimized away. The runtime cost of this operation (assuming
+    that nothing is optimized away) is `O(|memrefs|^2+|memrefs|*|retained|)`.
+    The cost in terms of memory space is `O(|memrefs|+|retained|)`. As a result,
+    it is recommended to place it carefully in the IR such that most operands
+    can be optimized away by running the `buffer-deallocation-simplification`
+    pass.
   }];
 
   let arguments = (ins Variadic<AnyRankedOrUnrankedMemRef>:$memrefs,



More information about the Mlir-commits mailing list