This is an archive of the discontinued LLVM Phabricator instance.

[LV] Introduce TTI::getMinimumVF
AbandonedPublic

Authored by kparzysz on Mar 16 2018, 12:02 PM.

Details

Summary

TargetTransformInfo::getMinimumVF(ElementType) will return the target's minimum VF for a given element type. By default the minimum VF is 2. The VF=1 (i.e. not vectorizing) is still considered a valid VF, and if vectorization is not profitable, the minimum VF will not force it to happen.

This is a followup to D44523.

Diff Detail

Repository
rL LLVM

Event Timeline

kparzysz created this revision.Mar 16 2018, 12:02 PM
kparzysz added inline comments.Mar 16 2018, 12:08 PM
lib/Transforms/Vectorize/LoopVectorize.cpp
6088

This early exit introduced some changes in behavior. Originally, SmallestType and WidestType would be -1u and 8 respectively in case where no types were found. The rest of the calculations would then operate on those values.

With this change, in a few testcases, the loops were not vectorized, so the vectorization width was set via metadata. These testcases were not testing whether the vectorization actually occurs, but some other aspects of its functionality, so such changes did not seem unreasonable.

7447

This is somewhat suboptimal because the loop blocks are traversed twice, but I didn't want to make too many changes before the first review.

This is a larger change than I was thinking. Making MaximizeBandwidth TTI based not good enough?

This is a larger change than I was thinking. Making MaximizeBandwidth TTI based not good enough?

It sounds like a good idea to allow targets to enable it. I published D44735 to do it.

The advantage of the approach in this patch is that it gives a guarantee of the minimum VF. I'm not sure if the TTI callback for maximizing bandwidth will ensure that, since it still considers all powers of 2 between 1 and the MaxVF.

kparzysz abandoned this revision.Apr 4 2018, 11:22 AM

Replaced by D45271.