This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Vector] Support 0-D vectors in `BroadcastOp`
ClosedPublic

Authored by michalt on Nov 24 2021, 10:51 AM.

Details

Summary

This changes the op to produce AnyVectorOfAnyRank following mostly the code for 1-D vectors.

Depends On D114598

Diff Detail

Event Timeline

michalt created this revision.Nov 24 2021, 10:51 AM
michalt requested review of this revision.Nov 24 2021, 10:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 24 2021, 10:51 AM
michalt retitled this revision from [mlir][Vector] Support 0-D vectors in `BroadcastOp` to [mlir][Vector] Support 0-D vectors in `BroadcastOp`/`SplatOp`.Nov 24 2021, 11:57 AM
michalt edited the summary of this revision. (Show Details)
nicolasvasilache requested changes to this revision.Nov 24 2021, 12:27 PM

Generally looks good, thank you !
Please address the comments and this'll be good to go.

mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
713

SplatOp requires its own independent tests that are missing here.

Can you please have a first revision that changes the semantics of SplatOp and adds a proper test?
Then you can stack this on top and keep things orthogonal.

756

<= 1 somehow feels more natural / in line with how we've been writing this type of condition throughout the codebase.

mlir/lib/Dialect/Vector/VectorTransforms.cpp
561

Not really in practice though: if you forward the 0-d around you will get invalid IR until all possible consumers of broadcast are updated to support 0-d.
I'd drop this micro-optimization.

This revision now requires changes to proceed.Nov 24 2021, 12:27 PM
michalt updated this revision to Diff 389790.Nov 25 2021, 7:36 AM
michalt marked 3 inline comments as done.

Address review comments

michalt edited the summary of this revision. (Show Details)Nov 25 2021, 7:44 AM
michalt retitled this revision from [mlir][Vector] Support 0-D vectors in `BroadcastOp`/`SplatOp` to [mlir][Vector] Support 0-D vectors in `BroadcastOp`.
michalt edited the summary of this revision. (Show Details)

LGTM, thanks!

This will prob. also need to be rebased since I couldn't land the parent.

This revision is now accepted and ready to land.Nov 25 2021, 12:19 PM
This revision was landed with ongoing or failed builds.Nov 26 2021, 9:19 AM
This revision was automatically updated to reflect the committed changes.