This is an archive of the discontinued LLVM Phabricator instance.

[LV] Add mask support for vectorizing interleaved groups
ClosedPublic

Authored by igor.kirillov on Jun 6 2023, 4:30 AM.

Details

Summary

This patch extends LoopVectorize to handle the vectorization of interleaved
memory accesses with scalable vectors when mask is required or/and predicated
tail folding is enabled.

Diff Detail

Event Timeline

igor.kirillov created this revision.Jun 6 2023, 4:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2023, 4:30 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
igor.kirillov requested review of this revision.Jun 6 2023, 4:30 AM
igor.kirillov added a subscriber: mgabka.

Refactor lambda function

igor.kirillov edited the summary of this revision. (Show Details)

Rebase

I think it would be worthwhile to have a test covering conditional execution inside the original source loop as well as the active lane mask for tail folding. See llvm/test/Transforms/LoopVectorize/interleaved-accesses-masked-group.ll for examples.

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
2973–2974

We could use SVE masking for fixed length as well, but that can be done at a later date if you want.

Matt added a subscriber: Matt.Jun 15 2023, 7:49 PM
igor.kirillov edited the summary of this revision. (Show Details)

Updating after precommiting the tests

mgabka added inline comments.Jun 26 2023, 7:45 AM
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
2679

could you add an assert here:
assert(InterleaveFactor == 2 &&

"Unsupported deinterleave factor for scalable vectors");

there is one in line 2731m but this function is called before reaching that line.

Add assertion

igor.kirillov marked an inline comment as done.Jun 26 2023, 1:11 PM
igor.kirillov edited the summary of this revision. (Show Details)

Rebase after pre-commit

huntergr accepted this revision.Jun 28 2023, 7:53 AM

LGTM.

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
2688

Nit: when passing a null or boolean literal into a function, it's customary in LLVM to add an inline comment before it indicating the parameter name, as below.

/*FMFSource=*/nullptr would work.

This revision is now accepted and ready to land.Jun 28 2023, 7:53 AM

Add argument name