This is an archive of the discontinued LLVM Phabricator instance.

[LoopVectorize] Calculate Max Feasible Scalable VF.
AbandonedPublic

Authored by sdesmalen on Feb 4 2021, 5:22 AM.

Details

Summary

This patch adds a 'enable-scalable-vectorizaton' flag to the
loopvectorizer, which for now doesn't change the vectorization, but it
let's computeMaxVF call computeFeasibleMaxVF with 'ComputeScalableMaxVF =
true', which prints the output to a DEBUG ostream. This is then verified
by the corresponding test.

This patch is a preparatory patch with the ultimate goal of making
computeMaxVF() return both a max fixed VF and a max scalable VF,
so that selectVectorizationFactor() can pick the most cost-effective
vectorization factor.

Diff Detail

Event Timeline

sdesmalen created this revision.Feb 4 2021, 5:22 AM
sdesmalen requested review of this revision.Feb 4 2021, 5:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 4 2021, 5:22 AM
david-arm added inline comments.Feb 23 2021, 9:22 AM
llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
81 ↗(On Diff #324642)

Not a problem really, but just wondering why you moved it here? I thought since Val is unsigned the two different checks are identical?

sdesmalen added inline comments.Feb 23 2021, 9:26 AM
llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
81 ↗(On Diff #324642)

That's because Val can now also be -1 (<=> FK_Undefined), used for -scalable-vectorization=on.

sdesmalen added inline comments.Feb 23 2021, 9:37 AM
llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
81 ↗(On Diff #324642)

Sorry, when I replied I didn't realise Val was indeed unsigned, you're right that the result is the same. I thought I'd move it here to make it more clear that both Force and Scalable work the same way (as in, they take FK_Disabled, FK_Undefined or FK_Enabled). But yes, the change is a non-functional one.

I guess this means you can set it to 'disabled' or 'enabled', but not explicitly to 'auto' using the hints.

This revision is now accepted and ready to land.Feb 24 2021, 1:16 AM
sdesmalen updated this revision to Diff 327899.Mar 3 2021, 1:46 PM

Rebased patch.

sdesmalen abandoned this revision.Mar 12 2021, 7:35 AM

Abandoned in favour of D98509