This is an archive of the discontinued LLVM Phabricator instance.

[mlir][vector] Add additional scalar vector transfer rewrites
ClosedPublic

Authored by springerm on Dec 20 2022, 5:31 AM.

Details

Summary
  • Rewrite vector.transfer_write of vectors with 1 element to memref.store
  • Rewrite vector.extract(vector.transfer_read) to memref.load

Diff Detail

Event Timeline

springerm created this revision.Dec 20 2022, 5:31 AM
Herald added a project: Restricted Project. · View Herald Transcript
springerm requested review of this revision.Dec 20 2022, 5:31 AM
Herald added a project: Restricted Project. · View Herald Transcript
nicolasvasilache requested changes to this revision.Dec 22 2022, 12:47 AM

we discussed offline ho to refactor this.

This revision now requires changes to proceed.Dec 22 2022, 12:47 AM
springerm updated this revision to Diff 484756.Dec 22 2022, 1:19 AM

address comments

springerm added inline comments.Dec 22 2022, 1:21 AM
mlir/test/Dialect/Vector/scalar-vector-transfer-to-memref.mlir
103–104

Note: Turns out there is already a canonicalization pattern that folds this with -canonicalize. No need to implement.

Much better, thanks!

Now that I see this, I'd go further: seems to me you could completely avoid worrying about the provenance of the op.
Just extract[0..0] -> memref.store whtever the case and let other patterns kick in.

mlir/lib/Dialect/Vector/Transforms/VectorTransferOpTransforms.cpp
744–746

Can we change the name here?
I find the use of "fold" overloaded and misleading here.
RewriteScalarExtractElementOfTransferRead etc ?

springerm updated this revision to Diff 484803.Dec 22 2022, 5:14 AM

address comments

springerm marked an inline comment as done.Dec 22 2022, 5:15 AM
springerm retitled this revision from [mlir][vector] Add additional scalar vector transfer foldings to [mlir][vector] Add additional scalar vector transfer rewrites.
springerm edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Dec 22 2022, 5:39 AM