[Mlir-commits] [mlir] [mlir][vector] Restrict DropInnerMostUnitDimsTransferWrite (PR #96218)
Andrzej Warzyński
llvmlistbot at llvm.org
Thu Jul 11 02:13:48 PDT 2024
banach-space wrote:
> Looking at this there's no mask and both dims are marked as in_bounds. Therefore `%idx_2` _must_ be 0, as the in_bounds attribute "specifies for every vector dimension if the transfer is **guaranteed** to be within the source bounds".
That's a very good point, thanks for taking the time to analyse this.
> So the program is invalid (and I think it invokes UB) if `%idx_2` is not zero (as it breaks that guarantee).
>
> If `%idx_2` was marked as out-of-bounds (mask or no mask), I believe knowing that the dimension is 1 then it means the write can probably be optimized-out. To avoid the out-bounds-write would mean masking out the entire unit dimension, which means the write would be a no-op.
👍🏻 For that I'd like to clarify/formalise the interplay between masks and `in_bounds` first.
> So, I think you just need to check the `in-bounds` attribute is true for the dimensions that you're going to drop.
Agreed, thanks! That's already updated (see the latest commit). I have also added a few tests to make the distinct cases very clear. Also, while `in_bounds` is optional, the code is a bit verbose. But we are making `in_bounds` mandatory:
* https://github.com/llvm/llvm-project/pull/97049
https://github.com/llvm/llvm-project/pull/96218
More information about the Mlir-commits
mailing list