[Mlir-commits] [mlir] [mlir] remove folder on MemRef::ExtractStridedMetadataOp (PR #88043)

Quentin Colombet llvmlistbot at llvm.org
Tue Apr 16 01:56:00 PDT 2024


qcolombet wrote:

I had a closer look at the thread and I think this issue is just the tip of the iceberg.

Although I sympathize with what you are trying to do, I think this is just one of the many issues that you will face because you are technically changing the type of the memref. In other words, you will need to either prevent all transformation based on the memref type or recover the information after the fact.

Indeed when you go from:
```
%1 = memref.alloc(%d1) : memref<?xf32>
```

To:
```
%1 = memref.subview %alloc[%d0] [%d1] [1] : memref<?xf32> to memref<?xf32, strided=<[1], offset = ?>>
```

You changed the memref from `memref<?xf32>` to `memref<?xf32, strided=<[1], offset = ?>>` and I think you are in for a wild ride at this point. Essentially, all the uses of `getStridesAndOffset` in the MLIR code base may do something adverse to what you want to achieve and I don't believe you can reasonably disable all of that.

All in all, I don't think that what you are trying to achieve is correct as in you are changing a type without proper casting.
Instead, I think you should use dynamic offsets in all your memrefs from the get go when you lower from tensors.

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


More information about the Mlir-commits mailing list