This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] Allow folding to rank-zero tensor when using rank-reducing subtensors.
ClosedPublic

Authored by mravishankar on May 5 2021, 3:05 PM.

Details

Summary

The pattern to convert subtensor ops to their rank-reduced versions
(by dropping unit-dims in the result) can also convert to a zero-rank
tensor. Handle that case.
This also fixes a OOB access bug in the existing pattern for such
cases.

Diff Detail

Event Timeline

mravishankar created this revision.May 5 2021, 3:05 PM
mravishankar requested review of this revision.May 5 2021, 3:05 PM
antiagainst accepted this revision.May 6 2021, 10:50 AM
antiagainst added inline comments.
mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
467

then the fold

470

These two if statements can be merged into one?

This revision is now accepted and ready to land.May 6 2021, 10:50 AM
mravishankar marked 2 inline comments as done.

Address comments and rebase.