[mlir][VectorToSCF] Bug in TransferRead lowering fixed
authorJakub Lichman <limo@google.com>
Wed, 19 Aug 2020 15:13:19 +0000 (15:13 +0000)
committerJakub Lichman <limo@google.com>
Wed, 19 Aug 2020 15:34:34 +0000 (15:34 +0000)
commit8dace28f92056a04e02d913684d3f448ee1f295a
tree2e475487397a14ccc0183f3a58e440945d2abbdb
parent6e1b11087f080b1cb9a023f9f920d29d5465633e
[mlir][VectorToSCF] Bug in TransferRead lowering fixed

If Memref has rank > 1 this pass emits N-1 loops around
TransferRead op and transforms the op itself to 1D read. Since vectors
must have static shape while memrefs don't the pass emits if condition
to prevent out of bounds accesses in case some memref dimension is smaller
than the corresponding dimension of targeted vector. This logic is fine
but authors forgot to apply `permutation_map` on loops upper bounds and
thus if condition compares induction variable to incorrect loop upper bound
(dimension of the memref) in case `permutation_map` is not identity map.
This commit aims to fix that.
mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir