This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg] Make Linalg vectorizer lower affine.apply (take 2)
ClosedPublic

Authored by awarzynski on Feb 6 2023, 11:47 AM.

Details

Summary

As discussed in [1], it is possible that the input to the Linalg
vectorizer contains affine.apply ops. 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

Co-authored-by: Thomas Raoux <thomasraoux@google.com>

Diff Detail

Event Timeline

awarzynski created this revision.Feb 6 2023, 11:47 AM
Herald added a reviewer: hanchung. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
awarzynski requested review of this revision.Feb 6 2023, 11:47 AM

ATM this is simply https://reviews.llvm.org/D142371 + https://reviews.llvm.org/D143243 with a couple extra affine.apply Ops in the test.

awarzynski updated this revision to Diff 495452.Feb 7 2023, 3:30 AM

Add another small test case

awarzynski retitled this revision from [mlir][linalg][WIP] Make Linalg vectorizer lower affine.apply (take 2) to [mlir][linalg] Make Linalg vectorizer lower affine.apply (take 2).Feb 7 2023, 12:34 PM
dcaballe accepted this revision.Feb 8 2023, 3:56 PM

LGTM! Just a comment about the tests

mlir/test/Dialect/Linalg/vectorization.mlir
305

Perhaps it would make sense to create simpler test so that it's simpler to understand the generated output (talking about myself here :))

This revision is now accepted and ready to land.Feb 8 2023, 3:56 PM