[mlir][Vector] Revisit VectorToSCF.
authorNicolas Vasilache <ntv@google.com>
Fri, 4 Sep 2020 15:43:00 +0000 (11:43 -0400)
committerNicolas Vasilache <ntv@google.com>
Mon, 7 Sep 2020 09:19:43 +0000 (05:19 -0400)
commit8d64df9f139038b48344dd9f1f20a38b22aba8c9
tree4040672d3b1e5ccb88933547c18f1b249aa776ad
parent7634c64b6121ba61a6c72c6b45e3561ad8cf345e
[mlir][Vector] Revisit VectorToSCF.

Vector to SCF conversion still had issues due to the interaction with the natural alignment derived by the LLVM data layout. One traditional workaround is to allocate aligned. However, this does not always work for vector sizes that are non-powers of 2.

This revision implements a more portable mechanism where the intermediate allocation is always a memref of elemental vector type. AllocOp is extended to use the natural LLVM DataLayout alignment for non-scalar types, when the alignment is not specified in the first place.

An integration test is added that exercises the transfer to scf.for + scalar lowering with a 5x5 transposition.

Differential Revision: https://reviews.llvm.org/D87150
mlir/include/mlir/Dialect/Vector/EDSC/Intrinsics.h
mlir/include/mlir/Dialect/Vector/VectorOps.td
mlir/integration_test/Dialect/Vector/CPU/test-transfer-to-loops.mlir [new file with mode: 0644]
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
mlir/lib/Dialect/Vector/VectorOps.cpp
mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir
mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir
mlir/test/EDSC/builder-api-test.cpp