[PATCH] D122126: [LoopVectorize] Don't interleave when the number of runtime checks exceeds the threshold

Zhou Kaipeng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 19:59:13 PDT 2022


TKaipeng added a comment.

In D122126#3418927 <https://reviews.llvm.org/D122126#3418927>, @dmgreen wrote:

>> 1. `Requirements`  can not be accessed in `selectInterleaveCount`, so additional parameters need to be added to selectInterleaveCount. Do you think it is necessary?<br>
>
> Yeah - it might need to pass Requirements.getNumRuntimePointerChecks() through to selectInterleaveCount. I think it's OK as you have it right now, but Florian (or anyone else) can complain if they disagree.
>
>> 2. I'm not sure if I need to keep `SelectedVF.Width.getKnownMinValue() > 1`, but if it is not necessary, we could remove it in a separate patch.
>
> I was just hoping that if it got to that block then it would prevent the interleaving. It looks like it doesn't work like that though.
>
> LGTM. Perhaps wait a day or two in case anyone else has comments.

I think `SelectedVF.Width.getKnownMinValue() > 1` is used to avoid the check when VF is scalar, but `ElementCount::isScalar()` seems better.

I don't think the position for the runtimeCheck is good.
Now, the code looks like:
1.If UserVF is OK, do vectorization using UserVF
2.Populate VFCandidates
3.Collect information for vplans
4.Build vplans for all vf candidates and select best VF
5.Check the number of runtime checks for selected VF if it's scalar. If it's too many, stop vectorization.

15234 would be a better order?
1.If UserVF is OK, do vectorization using UserVF
5.Check the number of runtime checks(No need to consider about the VF because the number of runtime checks are same for all VF). If it's too many, stop vectorization.
2.Populate VFCandidates
3.Collect information for vplans
4.Build vplans for all vf candidates

I'm not sure of my opinion. If it's wrong, happy to get a response :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122126/new/

https://reviews.llvm.org/D122126



More information about the llvm-commits mailing list