This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Vector] Add ExtractOp folding when fed by a TransposeOp
ClosedPublic

Authored by nicolasvasilache on Jul 9 2020, 8:55 AM.

Details

Summary

TransposeOp are often followed by ExtractOp.
In certain cases however, it is unnecessary (and even detrimental) to lower a TransposeOp to either a flat transpose (llvm.matrix intrinsics) or to unrolled scalar insert / extract chains.

Providing foldings of ExtractOp mitigates some of the unnecessary complexity.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald Transcript
aartbik added inline comments.Jul 9 2020, 11:51 AM
mlir/test/Dialect/Vector/canonicalize.mlir
343

is this example right?

%0 is used twice, %2 once further down and %4 never?
I would expect each transpose to be used by the following extract?

nicolasvasilache marked 2 inline comments as done.

Fix test

mlir/test/Dialect/Vector/canonicalize.mlir
343

yes thanks for catching!

ftynse accepted this revision.Jul 10 2020, 7:23 AM
ftynse added inline comments.
mlir/lib/IR/AffineMap.cpp
383

can getSubMap take a range instead of materializing the vector?

This revision is now accepted and ready to land.Jul 10 2020, 7:23 AM
nicolasvasilache marked an inline comment as done.Jul 10 2020, 7:32 AM
nicolasvasilache marked an inline comment as done.Jul 10 2020, 8:09 AM
nicolasvasilache added inline comments.
mlir/lib/IR/AffineMap.cpp
383

not without iterator facading complexity AFAICT ..

This revision was automatically updated to reflect the committed changes.