[Mlir-commits] [mlir] [memref] Support non-scalar copies in `reinterpret_cast` elision (PR #203873)

Andrzej WarzyƄski llvmlistbot at llvm.org
Thu Jul 2 10:19:52 PDT 2026


================

----------------
banach-space wrote:

Note, this comment refers to "copy", but you have no access to `memref.copy` in this method. 

What this is checking is that you never end-up with an RC like this:
```mlir
 %rc = memref.reinterpret_cast %dst
    to offset: [10], sizes: [1, 3, 1], strides: [33, 11, 1]
    : memref<1x3x11xf32>
      to memref<1x3x2xf32, strided<[33, 11, 1], offset: 10>>
```
(Note, with `offset == 10`, there's only `1` element available in the trailing dimension).

I think that you can rephrase the comment and assert as follows:

> Sanity check that the reinterpret_cast doesn't create an out-of-bounds MemRef. Such cases should probably be rejected by Op verifier.

(please take a note of the example)

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


More information about the Mlir-commits mailing list