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

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 4 14:00:26 PDT 2022


fhahn added a comment.

Thanks for the update!

In D122126#3421022 <https://reviews.llvm.org/D122126#3421022>, @TKaipeng wrote:

> 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 :)

It's indeed not at the most optimal position focused solely at compile-time. But I think for this patch, I think it would be good to roughly keep roughly the original order, especially if we manage to check & error at a single place.



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:10460
     IC = CM.selectInterleaveCount(VF.Width, *VF.Cost.getValue());
+    if (!UserIC && requiresTooManyRtChecks) {
+      ORE->emit([&]() {
----------------
Can the handling be merged into a single check & diagnostic?


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