This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] Use rank-reduced versions of subtensor and subtensor insert when possible.
ClosedPublic

Authored by mravishankar on Apr 28 2021, 3:29 PM.

Details

Summary

Convert subtensor and subtensor_insert operations to use their
rank-reduced versions to drop unit dimensions.

Diff Detail

Event Timeline

mravishankar created this revision.Apr 28 2021, 3:29 PM
mravishankar requested review of this revision.Apr 28 2021, 3:29 PM

THe changes to DropUnitDims.cpp (and the test file) are pulled out from https://reviews.llvm.org/D101258. Landing those changes required changes to the subview -> load folding needed for SPIR-V path to make it handle the rank-reducing case.

This revision is now accepted and ready to land.Apr 30 2021, 12:56 AM
antiagainst accepted this revision.May 3 2021, 11:27 AM

Cool! Thanks for rewriting the std op chain into affine apply chain!

mlir/lib/Dialect/MemRef/Transforms/FoldSubViewOps.cpp
58

Hmm, I recall seeing this check at various places. It might be worth creating some utility function for it. But your choice.

83

This if-else construct can be merged into the above?

mravishankar added inline comments.May 3 2021, 12:50 PM
mlir/lib/Dialect/MemRef/Transforms/FoldSubViewOps.cpp
58

Good idea, but it would delay this patch. So I will do that as a follow up.

83

THe previous one is checking strides. This is checking offsets.