[Mlir-commits] [mlir] Add examples for reinterpret_cast and subview operators to show their behavior in relation to their input memref underlying memory and view (PR #135244)
Matthias Springer
llvmlistbot at llvm.org
Thu Apr 24 11:24:10 PDT 2025
================
@@ -1363,6 +1363,58 @@ def MemRef_ReinterpretCastOp
%dst.sizes = %sizes
%dst.strides = %strides
```
+
+ Example 2:
+
+ Consecutive `reinterpret_cast` operations on memref's with static dimensions.
+
+ We distinguish between *underlying memory* — the sequence of elements as
+ they appear in the contiguous memory of the memref — and the *view*, which refers to
+ the underlying memory interpreted according to specified offsets, sizes, and strides.
+
+ ```mlir
+ %result1 = memref.reinterpret_cast %arg0 to offset: [9], sizes: [4, 4], strides: [16, 2] : memref<8x8xf32, strided<[8, 1], offset: 0>> to memref<4x4xf32, strided<[16, 2], offset: 9>>
----------------
matthias-springer wrote:
Can you reformat these like in the above example?
https://github.com/llvm/llvm-project/pull/135244
More information about the Mlir-commits
mailing list