[Mlir-commits] [mlir] [MemRef] Added trait NoMemoryEffect to assume_alignment operation (PR #139450)
Shay Kleiman
llvmlistbot at llvm.org
Sun May 11 06:50:27 PDT 2025
https://github.com/shay-kl created https://github.com/llvm/llvm-project/pull/139450
Assume_alignment has no trait which specifies how it interacts with memory, this causes an issue in OwnershipBasedBufferDeallocation, which require all operations which operate on buffers to have explicit traits defining how the operation interacts with memory.
To prevent this error, I changed assume_alignment to include the trait NoMemoryEffect. This is valid because assume_alignment is an assertion for optimization purposes only; it does not allocate, free, read, or write memory, nor does it change program semantics or memory state.
>From c4ad9b447581c56367dfffb04ec09b0e1931a108 Mon Sep 17 00:00:00 2001
From: Shay Kleiman <shayk at epgd045.me-corp.lan>
Date: Sun, 11 May 2025 16:22:44 +0300
Subject: [PATCH] Added trait NoMemoryEffect to assume_alignment
Assume_alignment has no trait which specifies how it interacts with
memory, this causes an issue in OwnershipBasedBufferDeallocation,
which require all operations which operate on buffers to have explicit
traits defining how the operation interacts with memory.
To prevent this error, I changed assume_alignment to include the trait
NoMemoryEffect. This is valid because assume_alignment is an assertion
for optimization purposes only; it does not allocate, free, read, or
write memory, nor does it change program semantics or memory state.
---
mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
index d6d8161d3117b..6ea6b80cf261f 100644
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
+++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
@@ -142,7 +142,7 @@ class AllocLikeOp<string mnemonic,
// AssumeAlignmentOp
//===----------------------------------------------------------------------===//
-def AssumeAlignmentOp : MemRef_Op<"assume_alignment"> {
+def AssumeAlignmentOp : MemRef_Op<"assume_alignment", [NoMemoryEffect]> {
let summary =
"assertion that gives alignment information to the input memref";
let description = [{
More information about the Mlir-commits
mailing list