[mlir][Vector] Add pattern to reorder elementwise and broadcast ops
authorAndrzej Warzynski <andrzej.warzynski@arm.com>
Fri, 2 Jun 2023 14:32:12 +0000 (15:32 +0100)
committerAndrzej Warzynski <andrzej.warzynski@gmail.com>
Thu, 15 Jun 2023 09:13:41 +0000 (10:13 +0100)
commit4d339ec91e81ae33b0f3ea0f8a3596d99645a0e9
tree6a15cfcd9c6004aa34f27ac65a3e7904d3226547
parente9d77cd9b267cb43bf7a968053517ca499959f2f
[mlir][Vector] Add pattern to reorder elementwise and broadcast ops

The new pattern will replace elementwise(broadcast) with
broadcast(elementwise) when safe.

This change affects tests for vectorising nD-extract. In one case
("vectorize_nd_tensor_extract_with_tensor_extract") I just trimmed the
test and only preserved the key parts (scalar and contiguous load from
the original Op). We could do the same with some other tests if that
helps maintainability.

Differential Revision: https://reviews.llvm.org/D152812
mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h
mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
mlir/test/Dialect/Linalg/vectorize-tensor-extract.mlir
mlir/test/Dialect/Vector/sink-vector-broadcast.mlir [new file with mode: 0644]
mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp