[mlir][vector] Add patterns to cast away leading 1-dim
authorLei Zhang <antiagainst@google.com>
Fri, 5 Feb 2021 13:55:32 +0000 (08:55 -0500)
committerLei Zhang <antiagainst@google.com>
Fri, 5 Feb 2021 14:02:15 +0000 (09:02 -0500)
commit874ce9b80f87ba6eb880aff38ba2a359e3cf12b2
tree0279f43ec37f80b9201ebaf45441ae530bb7cded
parent2fbbb18c1dbeb124dfc3c2aebae97d4780ff9bd6
[mlir][vector] Add patterns to cast away leading 1-dim

This patch adds patterns to use vector.shape_cast to cast
away leading 1-dimensions from a few vector operations.
It allows exposing more canonical forms of vector.transfer_read,
vector.transfer_write, vector_extract_strided_slice, and
vector.insert_strided_slice. With this, we can have more
opportunity to cancelling extract/insert ops or forwarding
write/read ops.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D95873
mlir/include/mlir/Dialect/Vector/VectorOps.h
mlir/lib/Dialect/Vector/VectorTransforms.cpp
mlir/test/Dialect/Vector/vector-transforms.mlir
mlir/test/lib/Transforms/TestVectorTransforms.cpp