This is an archive of the discontinued LLVM Phabricator instance.

[mlir][vector] Extend transfer_write to read propagation
ClosedPublic

Authored by ThomasRaoux on Jul 19 2022, 5:42 PM.

Details

Summary

Folding of transfer_write into transfer_read is already supported but
this requires the read and write to have the same permuation map.
After linalg vectorization it is common to have different ppermuation
map for write followed by read even though the cases could be
propagated.
This canonicalization handle cases where the permuation maps are
different but the data read and written match and replace the transfer
ops with broadcast and permuation

Diff Detail

Event Timeline

ThomasRaoux created this revision.Jul 19 2022, 5:42 PM
Herald added a project: Restricted Project. · View Herald Transcript
ThomasRaoux requested review of this revision.Jul 19 2022, 5:42 PM
mlir/lib/Dialect/Vector/IR/VectorOps.cpp
3288

Can you please rephrase? I have trouble parsing this comment.

3291

Seems like a good helper to add to the interface itself.
Note that this is an upper bound on the size of the chunk.

3341

The while case is not tested, please add both a positive and a negative test.

3367

typo

3373

typo

Address review comments

ThomasRaoux marked 2 inline comments as done.Jul 20 2022, 9:14 AM
ThomasRaoux added inline comments.
mlir/lib/Dialect/Vector/IR/VectorOps.cpp
3288

Rephrased and moved into interface

3291

Moved it to VectorTransferOpInterface

3341

Good point, I removed the while loop as isDisjointTransferIndices seems to assume minor identity map. We would need to change it to use getTensorChunkSizeAccessed for it to work here

This revision is now accepted and ready to land.Jul 21 2022, 7:03 AM