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

Tiehu Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 30 20:46:48 PDT 2022


TiehuZhang added a comment.

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

>> Why does this check SelectedVF.Width > 1? Can we just remove it or does that not help?
>
> Does this mean this didn't help? It seems that code would not alter the IC in any case, as it is already returning VectorizationFactor::Disabled.
>
> Just as a point of cleanup, is it possible to move the logic into selectInterleaveCount, so that it returns a value of 1 if there are too many runtime checks? I'm not sure all the info needed would be easily available inside the costmodel though.



1. `Requirements`  can not be accessed in `selectInterleaveCount`, so additional parameters need to be added to selectInterleaveCount. Do you think it is necessary?<br>
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.



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7675
   unsigned NumRuntimePointerChecks = Requirements.getNumRuntimePointerChecks();
   if (SelectedVF.Width.getKnownMinValue() > 1 && NumRuntimePointerChecks) {
     bool PragmaThresholdReached =
----------------
dmgreen wrote:
> Why does this check SelectedVF.Width > 1? Can we just remove it or does that not help?
Probably to reduce compilation time (although the impact is small) ?


================
Comment at: llvm/test/Transforms/LoopVectorize/interleaved-pointer-runtime-check-unprofitable.ll:1
+; RUN: opt -mtriple=powerpc64-unknown-linux-gnu -mcpu=a2 -S -loop-vectorize -debug-only=loop-vectorize < %s 2>&1 | FileCheck %s
+
----------------
dmgreen wrote:
> If you use -debug, it needs to REQUIRES: asserts
> It may be a simpler test to just show that the codegen is not vectorized/interleaved though, with a comment explaining that it would be too much overhead.
Done, thanks very much!


================
Comment at: llvm/test/Transforms/LoopVectorize/interleaved-pointer-runtime-check-unprofitable.ll:76
+  store double 0.000000e+00, double* %14, align 8
+  %49 = getelementptr i64, i64* %wet_cl, i64 undef
+  %50 = bitcast i64* %wet_cl to double*
----------------
fhahn wrote:
> Please avoid using `undef` in the test unless necessary.
Done, thanks very much!


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