[PATCH] D22867: [LV] Untangle the concepts of uniform and scalar

Wei Mi via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 11:30:45 PDT 2016


On Fri, Jul 29, 2016 at 11:12 AM, Matthew Simpson
<mssimpso at codeaurora.org> wrote:
> mssimpso added a comment.
>
> In https://reviews.llvm.org/D22867#500844, @wmi wrote:
>
>> There are two factors here:
>>
>> 1. Now calculateRegisterUsage only considers the pressure of vector register, not scalar register. TTI.getNumberOfRegisters only returns vector register number. Scalar register pressure is not modeled in loop vectorization.
>
>
> This doesn't make sense to me. We use register pressure when deciding to unroll, and we surely do that when we're not vectorizing (VF = 1). I believe TTI.getNumberOfRegisters(true) is what returns the number of vector registers, but in a quick scan of calculateRegisterUsage it doesn't even look like we consider this. I think we just count the number of live intervals. Am I missing something?
>

What I mean is only vector register pressure is considered when
selectVectorizationFactor. scalar register pressure is only considered
in selectInterleaveCount and only when VF==1.
When selectVectorizationFactor, scalar register pressure is not
considered, so we don't want to count scalarized iv as a live range
usage.

>> 2. induction variable has larger impact on register pressure than ORs above, it has live range across the loop while ORs generated have limited live range. If we don't add iv to VecValuesToIgnore, it may involve some impact from scalar register pressure increase into consideration, but it will definitely pessimize the maximum vector register pressure.
>
>>
>
>>   I think it is also better to add GEP to VecValuesToIgnore too for non-consecutive memory access case.  although GEP has less impact on vector register pressure than iv.
>
>
> It sounds like you're advocating to add values to VecValuesToIgnore if isScalarAfterVectorization is true rather than isUniformAfterVectorization? This would make sense to me if calculateRegisterUsage is only intended to track the pressure of vector registers, but I'm not sure that it is. Can you please clarify?
>

Yes, calculateRegisterUsage is only intended to track the pressure of
vector registers when selectVectorizationFactor. The reason is
explained above.
Yes, I think it is better to add values to VecValuesToIgnore if
isScalarAfterVectorization is true.

Thanks,
Wei.


More information about the llvm-commits mailing list