This is an archive of the discontinued LLVM Phabricator instance.

[mlir][vector][bufferize] Bufferize vector.mask and vector.yield
ClosedPublic

Authored by springerm on Jan 13 2023, 5:49 AM.

Details

Summary

The masked op can currently not bufferize out-of-place. Such IR would be rejected by the One-Shot Bufferize because it would mean that a new buffer allocation is yielded from a block. Furthermore, only one operation is currently allowed inside vector.mask.

Depends On: D141685

Diff Detail

Event Timeline

springerm created this revision.Jan 13 2023, 5:49 AM
Herald added a project: Restricted Project. · View Herald Transcript
springerm requested review of this revision.Jan 13 2023, 5:49 AM
Herald added a project: Restricted Project. · View Herald Transcript
springerm updated this revision to Diff 491333.Jan 23 2023, 5:54 AM

Extract areAllocationsAllowedInRegion into separate revision.

springerm edited the summary of this revision. (Show Details)Jan 23 2023, 5:54 AM
dcaballe added inline comments.Jan 23 2023, 11:34 PM
mlir/lib/Dialect/Vector/Transforms/BufferizableOpInterfaceImpl.cpp
148–150

You should be able to cast here as this terminator is enforced by the op verifier.

159

-> mask.getMaskableOp()

163–188

I'm wondering if we could simplify all this logic just by masking the new buferized operation with a new mask. I'm introducing a maskOperation utility that takes care of creating the new yield with the new return values, etc.

springerm updated this revision to Diff 493255.Jan 30 2023, 2:39 AM
springerm marked 2 inline comments as done.

address comments and better error message

springerm added inline comments.Jan 30 2023, 2:39 AM
mlir/lib/Dialect/Vector/Transforms/BufferizableOpInterfaceImpl.cpp
163–188

Yes that would make the code a bit shorter here. Overall, I'm not too worried about it because this is common pattern that we also have with other ops (during bufferization some results change, others do not). Let me know if you add a new helper function, then I will use it here.

dcaballe accepted this revision.Jan 30 2023, 5:16 PM

Thanks!

This revision is now accepted and ready to land.Jan 30 2023, 5:16 PM
This revision was landed with ongoing or failed builds.Jan 31 2023, 12:02 AM
This revision was automatically updated to reflect the committed changes.