This is an archive of the discontinued LLVM Phabricator instance.

[mlir][vector] Add a pattern to reorder transfer_write ops
Changes PlannedPublic

Authored by antiagainst on Sep 16 2022, 7:52 PM.

Details

Summary

This commit adds patterns to reorder vector.transfer_write ops
that are used as tensor.insert_slice source or destination.
This helps to move tensor.insert_slice to be closer to
tensor.extract_slice so that we can cancel them afterwards.

This kind of IR pattern can be created with tiling and loop/vector
unrolling.

Diff Detail

Event Timeline

antiagainst created this revision.Sep 16 2022, 7:52 PM
antiagainst requested review of this revision.Sep 16 2022, 7:52 PM
antiagainst retitled this revision from [mlir][vector] Add a pattern to fold sandwiched transfer_write to [mlir][vector] Add a pattern to reorder transfer_write ops.Sep 16 2022, 7:55 PM
antiagainst edited the summary of this revision. (Show Details)
mlir/lib/Dialect/Vector/Transforms/CMakeLists.txt
4

Suffix the file name with Patterns.cpp plz

mlir/lib/Dialect/Vector/Transforms/ReorderTransferInsertExtractSlice.cpp
154 ↗(On Diff #460961)

I don't think I see any logic related to "disjoint" analysis?

For such an analysis, it would be good to unify the impl. and helper functions with lib/Dialect/Linalg/Transforms/Hoisting.cpp and/or bufferization and explicitly disallow having multiple different implementations.

antiagainst marked an inline comment as done.
antiagainst added inline comments.
mlir/lib/Dialect/Vector/Transforms/ReorderTransferInsertExtractSlice.cpp
154 ↗(On Diff #460961)

I don't think I see any logic related to "disjoint" analysis?

The analysis used at L206 is extracted as a general helper in a previous patch: https://reviews.llvm.org/D133872.

For such an analysis, it would be good to unify the impl. and helper functions with lib/Dialect/Linalg/Transforms/Hoisting.cpp and/or bufferization and explicitly disallow having multiple different implementations.

Yup. I'm using the new helper function everywhere; I can go through other places to switch to use it.

antiagainst marked an inline comment as done.

Rename file

antiagainst marked an inline comment as done.Sep 20 2022, 11:33 AM

Fix header comment

antiagainst planned changes to this revision.Sep 27 2022, 8:35 AM

Not immediately needed anymore. So taking back for now.

antiagainst planned changes to this revision.Oct 10 2022, 11:24 PM