[Mlir-commits] [mlir] [MemRef] Added trait NoMemoryEffect to assume_alignment operation (PR #139450)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun May 11 06:51:10 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Shay Kleiman (shay-kl)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/139450.diff


1 Files Affected:

- (modified) mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td (+1-1) 


``````````diff
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 = [{

``````````

</details>


https://github.com/llvm/llvm-project/pull/139450


More information about the Mlir-commits mailing list