[Mlir-commits] [mlir] [mlir][bufferization][NFC] Buffer deallocation: Add comment to `handleInterface` (PR #76956)

Matthias Springer llvmlistbot at llvm.org
Thu Jan 4 06:02:42 PST 2024


https://github.com/matthias-springer created https://github.com/llvm/llvm-project/pull/76956

This is a follow-up for #68648.

>From 51ee9173b0a663f7e4b871a3370659540d4f7917 Mon Sep 17 00:00:00 2001
From: Matthias Springer <springerm at google.com>
Date: Thu, 4 Jan 2024 23:01:32 +0900
Subject: [PATCH] [mlir][bufferization][NFC] Buffer deallocation: Add comment
 to `handleInterface`

This is a follow-up for #68648.
---
 .../Transforms/OwnershipBasedBufferDeallocation.cpp         | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp b/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
index 9459cc43547faf..529d5a808c012a 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
@@ -861,6 +861,12 @@ BufferDeallocation::handleInterface(MemoryEffectOpInterface op) {
 
   for (auto operand : llvm::make_filter_range(op->getOperands(), isMemref)) {
     if (op.getEffectOnValue<MemoryEffects::Free>(operand).has_value()) {
+      // The bufferization.manual_deallocation attribute can be attached to ops
+      // with an allocation and/or deallocation side effect. It indicates that
+      // the op is under a "manual deallocation" scheme. Deallocation ops are
+      // usually forbidden in the input IR (not supported by the buffer
+      // deallocation pass). However, if they are under manual deallocation,
+      // they can be safely ignored by the buffer deallocation pass.
       if (!op->hasAttr(BufferizationDialect::kManualDeallocation))
         return op->emitError(
             "memory free side-effect on MemRef value not supported!");



More information about the Mlir-commits mailing list