This is an archive of the discontinued LLVM Phabricator instance.

[mlir][ArmSME] Lower vector.broadcast to ArmSME
ClosedPublic

Authored by c-rhodes on Aug 23 2023, 12:55 AM.

Details

Summary

This adds support for lowering vector.broadcast ops to SME, if the
source is either a scalar, 0-d vector, or 1-d vector, and the result a
2-d scalable vector that aligns with SME tiles.

This follows on from D157005 which introduced a vector to tile slice op
that moves a 1-d scalable vector to a slice of a 2-d scalable vector
(tile). The lowering from vector.broadcast is similar, a couple of
helper functions are added to prevent duplication.

Lowering of vector.broadcast contributes towards a path from linalg.fill
to SME.

Depends on D157005

Diff Detail

Event Timeline

c-rhodes created this revision.Aug 23 2023, 12:55 AM
Herald added a project: Restricted Project. · View Herald Transcript
c-rhodes requested review of this revision.Aug 23 2023, 12:55 AM
awarzynski accepted this revision.Aug 24 2023, 12:47 AM

LGTM, thanks!

I've made a few small suggestions, but it's up to you whether to incorporate them. Great to see all this "just working" :)

mlir/lib/Conversion/VectorToArmSME/VectorToArmSME.cpp
29

[nit] getLoopOverTileSlices?

45

// Returns a tile of the given vector type.

Could this be more specific? Perhaps rename as getSMETileAndCastToVector. It's a bit of a mouthful, but I wouldn't mind. Otherwise, a longer comment would be appreciated :)

[nit] Use doxygen

175

I find such short sample snippets very helpful. I know that being accurate can be painful (and lead to unnecessarily long comments), but its not a doc test, so it's OK to focus on the structure and skip the details.

mlir/test/Dialect/ArmSME/vector-ops-to-sme.mlir
186

I'd be tempted to add (here and below):

// CHECK: scf.for

Just to highlight that that remains an important part of the lowering (no matter what's being broadcast).

This revision is now accepted and ready to land.Aug 24 2023, 12:47 AM
c-rhodes updated this revision to Diff 553044.Aug 24 2023, 2:00 AM

Address comments.

c-rhodes marked 4 inline comments as done.Aug 24 2023, 2:01 AM

LGTM, thanks!

I've made a few small suggestions, but it's up to you whether to incorporate them. Great to see all this "just working" :)

Thanks for reviewing! Addressed all your comments

c-rhodes updated this revision to Diff 553071.Aug 24 2023, 4:14 AM

Rebase (vector_to_tile_slice renamed to move_vector_to_tile_slice)

dcaballe accepted this revision.Aug 27 2023, 9:36 PM

LGTM, thanks!

mlir/lib/Conversion/VectorToArmSME/VectorToArmSME.cpp
222

nit: spelling out some of these autos would help readability

This revision was automatically updated to reflect the committed changes.
c-rhodes marked an inline comment as done.Aug 29 2023, 2:43 AM
Matt added a subscriber: Matt.Aug 30 2023, 1:44 PM