[mlir][linalg] Make Linalg vectorizer lower affine.apply
authorAndrzej Warzynski <andrzej.warzynski@arm.com>
Mon, 23 Jan 2023 19:01:04 +0000 (19:01 +0000)
committerAndrzej Warzynski <andrzej.warzynski@gmail.com>
Fri, 27 Jan 2023 08:30:50 +0000 (08:30 +0000)
commitc7b1176e9afbfcc3da9482abbf7c1eb8793ff254
tree36f6c6665d15e7137f8165905a42c40c360643b2
parentf2f8c25540753a8be375fc90ad703d4101562342
[mlir][linalg] Make Linalg vectorizer lower affine.apply

It is possible that the input to the Linalg vectorizer contains
`affine.apply` ops (see the example in [1]). Such operations are not
vectarizable at the moment, but this can be fixed by simply converting
them to arithmetic operations. This is basically what this patch
introduces.

The IR change enabled in this patch could be part of a larger set of
"linalgOp pre-processing" transformations that happens right before
vectorization starts but after we know we can vectorize the op. I am
leaving this as a TODO.

[1] https://github.com/iree-org/iree/issues/10876.

Differential Revision: https://reviews.llvm.org/D142371
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
mlir/lib/Dialect/Linalg/Utils/Utils.cpp
mlir/test/Dialect/Linalg/vectorization.mlir