[mlir][Linalg] Generalize linalg vectorization
authorNicolas Vasilache <nicolas.vasilache@gmail.com>
Wed, 28 Apr 2021 21:52:30 +0000 (21:52 +0000)
committerNicolas Vasilache <nicolas.vasilache@gmail.com>
Thu, 29 Apr 2021 07:44:01 +0000 (07:44 +0000)
commitb6113db955aa7783de9715adeffaf88ba12f2699
treecc6f5185ee45ee59c17dbef99873d407fb63402d
parent837fded984ed36fa462daeb0f671eec58f71ae26
[mlir][Linalg] Generalize linalg vectorization

This revision adds support for vectorizing more general linalg operations with projected permutation maps.

This is achieved by eagerly broadcasting the intermediate vector to the common size
of the iteration domain of the linalg op. This allows a much more natural expression of
generalized vectorization but may introduce additional computations until all the
proper canonicalizations are implemented.

This generalization modifies the vector.transfer_read/write permutation logic and
exposes the fact that the logic employed in vector.contract was too ad-hoc.

As a consequence, changes occur in the permutation / transposition logic for contraction. In turn this prompts supporting more cases in the lowering of contract
to matrix intrinsics, which is required to make the corresponding tests pass.

Differential revision: https://reviews.llvm.org/D101165
mlir/include/mlir/Analysis/SliceAnalysis.h
mlir/include/mlir/Dialect/Vector/VectorOps.td
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
mlir/lib/Dialect/Vector/VectorOps.cpp
mlir/lib/Dialect/Vector/VectorTransforms.cpp
mlir/test/Dialect/Linalg/transform-patterns-matmul-to-vector.mlir
mlir/test/Dialect/Linalg/vectorization.mlir