This is an archive of the discontinued LLVM Phabricator instance.

[mlir][vector] Reorder elementwise(transpose)
ClosedPublic

Authored by antiagainst on Apr 12 2022, 5:39 AM.

Details

Summary

Similar to the existing pattern for reodering cast(transpose),
this makes transpose following transpose and increases the chance
of embedding the transposition inside contraction op. Actually
cast ops are just special instances of elementwise ops.

Diff Detail

Event Timeline

antiagainst created this revision.Apr 12 2022, 5:39 AM
Herald added a project: Restricted Project. · View Herald Transcript
antiagainst requested review of this revision.Apr 12 2022, 5:39 AM
mravishankar resigned from this revision.Apr 12 2022, 1:47 PM

Remove ReorderCastOnTranspose

ThomasRaoux added inline comments.Apr 14 2022, 3:39 PM
mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
1067

Should this use the ElementwiseMappable OpTrait instead?

antiagainst marked an inline comment as done.Apr 14 2022, 4:39 PM
antiagainst added inline comments.
mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
1067

ElementwiseMappable is not a "concrete" OpTrait; it's all of Elementwise, Vectorizable, Tensorizable, and Scalarizable: https://github.com/llvm/llvm-project/blob/09c2b7c35af8c4bad39f03e9f60df8bd07323028/mlir/lib/IR/Operation.cpp#L1118 So I'm not sure we can specialize using it at all? Besides, I don't think we need Scalarizable and Tensorizable here given we only concern vectors here?

ThomasRaoux added inline comments.Apr 14 2022, 4:42 PM
mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
1067

ah right, then what you want is Elementwise here?

This revision is now accepted and ready to land.Apr 14 2022, 8:18 PM
antiagainst marked 2 inline comments as done.Apr 15 2022, 6:06 AM
antiagainst added inline comments.
mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
1067

Changed. Though I think both works here, given Vectorizable is Elementwise + systematically vectorizable. For elementwise ops working on vectors, the second part should be true.

This revision was landed with ongoing or failed builds.Apr 15 2022, 6:06 AM
This revision was automatically updated to reflect the committed changes.
antiagainst marked an inline comment as done.