This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Vector] Generalize AVX2 transpose lowering to n-D vectors
ClosedPublic

Authored by dcaballe on Feb 10 2022, 5:36 PM.

Details

Summary

The existing AVX2 lowering patterns for the transpose op only triggers if the
input vector is 2-D. This patch extends the patterns to trigger for n-D vectors
which are effectively 2-D vectors (e.g., vector<1x4x1x8x1). The main constraint
for the generalized AVX2 patterns to be applicable to these vectors is that the
dimensions that are greater than one must be transposed. Otherwise, the existing
patterns are not applicable.

Diff Detail

Event Timeline

dcaballe created this revision.Feb 10 2022, 5:36 PM
dcaballe requested review of this revision.Feb 10 2022, 5:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 10 2022, 5:36 PM
dcaballe planned changes to this revision.Feb 10 2022, 6:49 PM
dcaballe retitled this revision from [mlir][Vector] Extend AVX2 transpose lowering to n-D vectors to [mlir][Vector] Generalize AVX2 transpose lowering to n-D vectors.Feb 17 2022, 12:52 PM
dcaballe edited the summary of this revision. (Show Details)
dcaballe updated this revision to Diff 409755.Feb 17 2022, 12:54 PM

Generalize the implementation even more by using shape_cast before and
after the transposition.

nicolasvasilache accepted this revision.Feb 17 2022, 1:05 PM

Nice and simple :) !

This revision is now accepted and ready to land.Feb 17 2022, 1:05 PM
dcaballe updated this revision to Diff 410902.Feb 23 2022, 12:06 PM

An internal test exposed a bug in the implementation. This new patch
fixes the issue (see 'areDimsTransposedIn2DSlice') and improves documentation.
Could you please take a quick look?

Thanks,
Diego

nicolasvasilache accepted this revision.Feb 25 2022, 5:01 AM