This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][TOSA] Lower tosa.transpose to linalg.generic
ClosedPublic

Authored by rsuderman on Feb 25 2021, 4:00 PM.

Details

Summary

Lowers the transpose operation to a generic linalg op when permutations
is a constant value.

Diff Detail

Event Timeline

rsuderman created this revision.Feb 25 2021, 4:00 PM
rsuderman requested review of this revision.Feb 25 2021, 4:00 PM

This one is probably better rewritten as a linalg.copy with the proper permutations (at least until we have the generic -> named ops inference).

mravishankar requested changes to this revision.Feb 26 2021, 8:53 AM

This one is probably better rewritten as a linalg.copy with the proper permutations (at least until we have the generic -> named ops inference).

This would require making CopyOp work on tensors. @rsuderman do you think you can make that change? Not a requirement though, this would be fine as is....

Few minor comments below.

mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
368

Does TOSA op only support static shapes. If not then you need to have a way to get the dynamic values for the non-static dimensions.

378

I dont think you need to do ValueRange{...} . Just op.input1() should work,

This revision now requires changes to proceed.Feb 26 2021, 8:53 AM

Updated for ValueRange comment.

Made the minor changes possible. Deferring on the CopyOp changes as lack of tensor support is outside the scope of TOSA work. If I have some time I will look into updating linalg.copy

rsuderman marked 2 inline comments as done.Feb 26 2021, 2:05 PM
rsuderman added inline comments.
mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
368

I'm only supporting static shapes for now to get things bootstrapped. Once we have more dynamic cases we can swing back around to dynamic support.

mravishankar accepted this revision.Mar 1 2021, 9:10 AM
This revision is now accepted and ready to land.Mar 1 2021, 9:10 AM
This revision was automatically updated to reflect the committed changes.
rsuderman marked an inline comment as done.