This is an archive of the discontinued LLVM Phabricator instance.

[mlir][tosa] Remove constant-0 dim expr values from TOSA lowerings
ClosedPublic

Authored by rsuderman on Apr 27 2021, 5:45 PM.

Details

Summary

Constant-0 dim expr values should be avoided for linalg as it can prevent
fusion. This includes adding support for rank-0 reshapes.

Diff Detail

Event Timeline

rsuderman created this revision.Apr 27 2021, 5:45 PM
rsuderman requested review of this revision.Apr 27 2021, 5:45 PM
rsuderman updated this revision to Diff 341048.Apr 27 2021, 6:31 PM

Fixed final remaining ConstExpr for reduce

mravishankar accepted this revision.Apr 28 2021, 3:36 PM

Nice!

mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
448

I dont think you need template dyn_cast<...> here. That is only needed if the method is templated.

502

You might as well use a linalg.tensor_reshape, but this is fine too.

FYI, for tosa::ReshapeOp you can use the utility method here https://reviews.llvm.org/D101343 which should be able to give you the reassociation maps that you need for lowring the reshape to linalg.

This revision is now accepted and ready to land.Apr 28 2021, 3:36 PM
rsuderman updated this revision to Diff 341668.Apr 29 2021, 3:02 PM

Updated for Mahesh's comments.

rsuderman marked 2 inline comments as done.Apr 29 2021, 3:05 PM
rsuderman added inline comments.
mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
502

I'll do a pass back through once your review lands. There are a few areas I can clean up this way.

rsuderman marked an inline comment as done.Apr 29 2021, 3:22 PM
This revision was landed with ongoing or failed builds.Apr 29 2021, 3:23 PM
This revision was automatically updated to reflect the committed changes.