[Mlir-commits] [mlir] acae85b - [mlir][memref] Add details on the semantic of reinterpret_cast

Quentin Colombet llvmlistbot at llvm.org
Fri Jan 13 02:18:51 PST 2023


Author: Quentin Colombet
Date: 2023-01-13T10:14:38Z
New Revision: acae85bd4e1ec19b0e2ed055e7d8a7717474e4c8

URL: https://github.com/llvm/llvm-project/commit/acae85bd4e1ec19b0e2ed055e7d8a7717474e4c8
DIFF: https://github.com/llvm/llvm-project/commit/acae85bd4e1ec19b0e2ed055e7d8a7717474e4c8.diff

LOG: [mlir][memref] Add details on the semantic of reinterpret_cast

Make it clearer what the semantic of reinterpret_cast is.

In particular, call out that this instruction is not a no-op.

NFC

Related to https://github.com/llvm/llvm-project/issues/59896

Differential Revision: https://reviews.llvm.org/D141662

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
index 121deb7839942..c2c0d0afe4f1b 100644
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
+++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
@@ -1246,6 +1246,24 @@ def MemRef_ReinterpretCastOp
       strides: [%stride0, %stride1]
     : memref<*xf32> to memref<?x?xf32, strided<[?, ?], offset: ?>>
     ```
+
+    This operation creates a new memref descriptor using the base of the
+    source and applying the input arguments to the other metadata.
+    In other words:
+    ```mlir
+    %dst = memref.reinterpret_cast %src to
+      offset: [%offset],
+      sizes: [%sizes],
+      strides: [%strides]
+    ```
+    means that `%dst`'s descriptor will be:
+    ```mlir
+    %dst.base = %src.base
+    %dst.aligned = %src.aligned
+    %dst.offset = %offset
+    %dst.sizes = %sizes
+    %dst.strides = %strides
+    ```
   }];
 
   let arguments = (ins Arg<AnyRankedOrUnrankedMemRef, "", []>:$source,


        


More information about the Mlir-commits mailing list