diff options
author | Andrzej WarzyĆski <andrzej.warzynski@arm.com> | 2024-07-12 09:32:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-12 09:32:01 +0100 |
commit | 6479a5a438a9545dd8f449be96d4024d0a08beba (patch) | |
tree | f23525711eef4e6b780a808597d1f965d4470d9c /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | fe9767105af65f0a7345afb6bb2f14e5d4404a15 (diff) | |
download | llvm-6479a5a438a9545dd8f449be96d4024d0a08beba.zip llvm-6479a5a438a9545dd8f449be96d4024d0a08beba.tar.gz llvm-6479a5a438a9545dd8f449be96d4024d0a08beba.tar.bz2 |
[mlir][vector] Restrict DropInnerMostUnitDimsTransfer{Read|Write} (#96218)
Restrict `DropInnerMostUnitDimsTransfer{Read|Write}` so that it fails
when one of the indices to be dropped could be != 0 and "out of bounds":
```mlir
func.func @negative_example(%arg0: memref<16x1xf32>, %arg1: vector<8x1xf32>, %idx_1: index, %idx_2: index) {
vector.transfer_write %arg1, %arg0[%idx_1, %idx_2] {in_bounds = [true, false]} : vector<8x1xf32>, memref<16x1xf32>
return
}
```
This is an edge case that could represent an out-of-bounds access,
though that will depend on the actual value of %i. Importantly, without
this change it would be transformed as follows:
```mlir
func.func @negative_example(%arg0: memref<16x1xf32>, %arg1: vector<8x1xf32>, %arg2: index, %arg3: index) {
%subview = memref.subview %arg0[0, 0] [16, 1] [1, 1] : memref<16x1xf32> to memref<16xf32, strided<[1]>>
%0 = vector.shape_cast %arg1 : vector<8x1xf32> to vector<8xf32>
vector.transfer_write %0, %subview[%arg2] {in_bounds = [true]} : vector<8xf32>, memref<16xf32, strided<[1]>>
return
}
```
This is incorrect - `%idx_2` is ignored and the "out of bounds" flags is
not propagated. Hence the extra restriction to avoid such cases.
NOTE: This is a follow-up for: #94904
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
0 files changed, 0 insertions, 0 deletions