This is an archive of the discontinued LLVM Phabricator instance.

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

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



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

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.


Co-authored-by: Thomas Raoux <>

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 + 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


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