This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg] Lower PadTensorOp to InitTensorOp + FillOp + SubTensorInitOp
ClosedPublic

Authored by springerm on Jun 4 2021, 2:51 AM.

Details

Summary

Currently limited to constant pad values. Any combination of dynamic/static tensor sizes and padding sizes is supported.

Depends On D103590

Diff Detail

Event Timeline

springerm created this revision.Jun 4 2021, 2:51 AM
springerm requested review of this revision.Jun 4 2021, 2:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 4 2021, 2:51 AM
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
677

The key reason why this pattern is needed here is that it triggers vectorization on subtensor_insert (which is generally undesirable because bufferization generally makes them go away for free).
Please document this.

739

I would immediately vectorize SubTensorInsertOp.
I wouldn't implement a vectorization pattern for SubTensorInsertOp right now because it is generally dangerous (see bufferization comment above).
This way your GenericPadTensorOpVectorizationPattern becomes a true vectorization pattern and you can drop the note.

If / when multiple vectorization patterns occur we can factor it out and be very loud about how it should / should not be used.

springerm updated this revision to Diff 349851.Jun 4 2021, 6:03 AM

address comments

springerm marked 2 inline comments as done.Jun 4 2021, 6:08 AM
springerm added inline comments.
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
677

This functionality is coming the next commit, see comment below.

739

I'm putting that in a separate commit if that's OK. (To keep the change small.) Added a comment at the beginning of the function to explain what's still missing.

nicolasvasilache accepted this revision.Jun 4 2021, 7:43 AM
nicolasvasilache added inline comments.
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
739

ah yes, I missed the intent that the "not yet a vectorization" conveys SGTM then!

This revision is now accepted and ready to land.Jun 4 2021, 7:43 AM
springerm updated this revision to Diff 350017.Jun 4 2021, 9:11 PM
springerm marked 2 inline comments as done.

rebase

springerm updated this revision to Diff 350045.Jun 5 2021, 2:33 AM

small change

springerm updated this revision to Diff 350477.Jun 7 2021, 8:01 PM

small improvements

springerm updated this revision to Diff 350553.Jun 8 2021, 2:50 AM

no change

This revision was landed with ongoing or failed builds.Jun 13 2021, 10:26 PM
This revision was automatically updated to reflect the committed changes.
springerm marked an inline comment as done.