[mlir][Vector] Update the lowering of `vector.transfer_write` to SCF
authorAndrzej Warzynski <andrzej.warzynski@arm.com>
Fri, 30 Jun 2023 15:04:28 +0000 (16:04 +0100)
committerAndrzej Warzynski <andrzej.warzynski@gmail.com>
Fri, 30 Jun 2023 19:14:47 +0000 (20:14 +0100)
commit5cebffc276e6fc34f754151bd0511bd59ca6f562
tree886185413341dd140d34a687fb83717d8dffc61b
parent7a3ebba9cb5e8465c91dfce99203f0f8795c7050
[mlir][Vector] Update the lowering of `vector.transfer_write` to SCF

This change updates the lowering of `vector.transfer_write` to SCF when
scalable vectors are used. Specifically, when lowering
`vector.transfer_write` to a loop of `vector.extractelement` ops, make
sure that the upper bound of the generated loop is scaled by
`vector.vscale`:
```
    %10 = vector.vscale
    %11 = arith.muli %10, %c16 : index
    scf.for %arg2 = %c0 to %11 step %c1
```

For reference, this is the current version (i.e. before this change):
```
    scf.for %arg2 = %c0 to %c16 step %c1
```
Note that this only valid for fixed-width vectors.

Differential Revision: https://reviews.llvm.org/D154226
mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
mlir/test/Conversion/VectorToSCF/vector-to-scf.mlir