[Mlir-commits] [mlir] [MLIR] Add a utility pass to linearize `memref` (PR #136797)
Alan Li
llvmlistbot at llvm.org
Sun May 4 19:12:16 PDT 2025
lialan wrote:
> But that's a bug because the index into the memref will be larger than the size
>
> Please fix the PR so it that becomes a load from a memref<64xf32> instead
>
> (My sense of the fix is that the getLimearizedDizeAndOffset utility should be doing `max_(d = 0 upto rank) {strides[d] * sizes[d]}` for non-identity layouts
Actually, I am not sure if that is a bug, because the way it is handled, there will be an `reinterpret_cast` to cast `memref<64xf132>` to `memref<16xf32>` before it gets fed into `memref.load`.
I think this is more related to how we interpret "linearize indices", In my opinion this pass should only linearize `memref.load`'s indices but not change its memref size. We should call something like`FoldMemRefAliasOps` instead for folding memrefs.
https://github.com/llvm/llvm-project/pull/136797
More information about the Mlir-commits
mailing list