[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 08:55:17 PDT 2023


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

>From ba1bfff62228b746d5d667d093656ccff872c352 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      | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
index fec07af349b3a8d..62ff0426098e332 100644
--- a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
+++ b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
@@ -523,6 +523,13 @@ 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 that
+    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