This is an archive of the discontinued LLVM Phabricator instance.

[mlir][vector] Generalize vector.transpose lowering to n-D vectors
ClosedPublic

Authored by hanchung on May 4 2023, 2:37 PM.

Details

Summary

The existing vector.transpose lowering patterns only triggers if the
input vector is 2D. The revision extends the pattern to handle n-D
vectors which are effectively 2-D vectors (e.g., vector<1x4x1x8x1).

It refactors a common check about 2-D vectors from X86Vector
lowering to VectorUtils.h so it can be reused by both sides.

Diff Detail

Event Timeline

hanchung created this revision.May 4 2023, 2:37 PM
Herald added a project: Restricted Project. · View Herald Transcript
hanchung requested review of this revision.May 4 2023, 2:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2023, 2:37 PM
hanchung edited the summary of this revision. (Show Details)May 4 2023, 2:38 PM

Thanks for working on this! High level question: Is this patch re-implementing https://reviews.llvm.org/D119505 or refactoring it out of the AVX2 patterns to the generic ones? Or something in between?

Thanks for working on this! High level question: Is this patch re-implementing https://reviews.llvm.org/D119505 or refactoring it out of the AVX2 patterns to the generic ones? Or something in between?

It is something in between. It does not refactor 4x4, 8x8 AVX patterns to generic ones. It moves the logic about detecting 2D vector to VectorUtils, and use it for both sides. The VectorLowerTranspose did not handle n-D vectors, and the revision add the support for it. My goal is to support 16x16 shuffle on n-D vector types like vector<1x16x16xf32>.

hanchung updated this revision to Diff 519933.May 5 2023, 11:40 AM

fix bazel deps

dcaballe accepted this revision.May 8 2023, 10:02 AM

LGTM, thanks!

This revision is now accepted and ready to land.May 8 2023, 10:02 AM

FYI, this fails the slibs build: https://lab.llvm.org/buildbot/#/builders/181/builds/17755
Could you please fix it?