[mlir][Linalg] Add a first vectorization pattern for conv1d in NWCxWCF format.
authorNicolas Vasilache <nicolas.vasilache@gmail.com>
Wed, 20 Oct 2021 13:53:56 +0000 (13:53 +0000)
committerNicolas Vasilache <nicolas.vasilache@gmail.com>
Wed, 20 Oct 2021 13:54:18 +0000 (13:54 +0000)
commit6bb7d2474fe4d3a68e2d1efefaa0bc8a244737bb
treefdafea3d13c50a05f7fda1dc32911dd98240b615
parent9e7b7303f1d3556756d7c4db8fa02969c8f11c58
[mlir][Linalg] Add a first vectorization pattern for conv1d in NWCxWCF format.

This revision uses the newly refactored StructuredGenerator to create a simple vectorization for conv1d_nwc_wcf.

Note that the pattern is not specific to the op and is technically not even specific to the ConvolutionOpInterface (modulo minor details related to dilations and strides).

The overall design follows the same ideas as the lowering of vector::ContractionOp -> vector::OuterProduct: it seeks to be minimally complex, composable and extensible while avoiding inference analysis. Instead, we metaprogram the maps/indexings we expect and we match against them.

This is just a first stab and still needs to be evaluated for performance.
Other tradeoffs are possible that should be explored.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D111894
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
mlir/include/mlir/Dialect/Utils/StructuredOpsUtils.h
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
mlir/lib/Dialect/Vector/VectorTransforms.cpp
mlir/test/Dialect/Linalg/vectorize-convolution.mlir [new file with mode: 0644]
mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp