This is an archive of the discontinued LLVM Phabricator instance.

[mlir][VectorOps] Don't drop scalable dims when lowering transfer_reads/writes (in VectorToLLVM)
ClosedPublic

Authored by benmxwl-arm on Sep 7 2023, 8:27 AM.

Details

Summary

This is a follow-on to D158753, and allows the lowering of a
transfer read/write of n-D vectors with a single trailing scalable dimension
to primitive vector ops.

The final conversion to LLVM depends on D158517 and D158752, without
these patches type conversion will fail (or an assert is hit in the LLVM
backend) if the final IR contains an array of scalable vectors.

This patch adds transform.apply_patterns.vector.lower_create_mask
which allows the lowering of vector.create_mask/constant_mask to be
tested independently of --convert-vector-to-llvm.

Diff Detail

Event Timeline

benmxwl-arm created this revision.Sep 7 2023, 8:27 AM
Herald added a reviewer: ftynse. · View Herald Transcript
Herald added a reviewer: dcaballe. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
benmxwl-arm requested review of this revision.Sep 7 2023, 8:27 AM
dcaballe accepted this revision.Sep 7 2023, 1:35 PM
This revision is now accepted and ready to land.Sep 7 2023, 1:35 PM
c-rhodes accepted this revision.Sep 8 2023, 1:13 AM

Slightly reworked the testing to use a new transform dialect op transform.apply_patterns.vector.lower_create_mask.
This allows testing the create_mask lowering independently of -convert-vector-to-llvm, which avoids hitting
TypeConverter asserts (until the other patches are merged).

benmxwl-arm edited the summary of this revision. (Show Details)Sep 8 2023, 8:24 AM
benmxwl-arm edited the summary of this revision. (Show Details)Sep 8 2023, 9:41 AM
benmxwl-arm edited the summary of this revision. (Show Details)Sep 8 2023, 9:48 AM
awarzynski accepted this revision.Sep 8 2023, 9:49 AM

Slightly reworked the testing to use a new transform dialect op transform.apply_patterns.vector.lower_create_mask.
This allows testing the create_mask lowering independently of -convert-vector-to-llvm, which avoids hitting
TypeConverter asserts (until the other patches are merged).

I really like this approach, thanks! While this does change the scope of this patch, I think that this is very straightforward and non-controversial. LGTM

mlir/test/Dialect/Vector/vector-scalable-create-mask-lowering.mlir
2
benmxwl-arm edited the summary of this revision. (Show Details)Sep 8 2023, 9:49 AM
benmxwl-arm edited the summary of this revision. (Show Details)Sep 11 2023, 2:52 AM
benmxwl-arm added inline comments.Sep 11 2023, 2:57 AM
mlir/test/Dialect/Vector/vector-scalable-create-mask-lowering.mlir
2

--split-input-file does not really work here since it'd require duplicating the transform.sequence for both tests (unless there's some way to add a common section?)

awarzynski added inline comments.Sep 11 2023, 3:13 AM
mlir/test/Dialect/Vector/vector-scalable-create-mask-lowering.mlir
2

I was hoping that this would just work ™ :)

You can try this, but I'm not convinced that that would be better:

I am happy for you to land this as is.

This revision was landed with ongoing or failed builds.Sep 11 2023, 9:49 AM
This revision was automatically updated to reflect the committed changes.
benmxwl-arm added inline comments.Sep 11 2023, 9:50 AM
mlir/test/Dialect/Vector/vector-scalable-create-mask-lowering.mlir
2

I decided to keep this as-is; I think it's more consistent with the other tests to have everything in one file :)