[llvm] [LV] Vectorize Epilogues for loops with small VF but high IC (PR #108190)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 04:48:20 PST 2024


================
@@ -4677,7 +4683,11 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
     return Result;
   }
 
-  if (!CM.isEpilogueVectorizationProfitable(MainLoopVF)) {
+  unsigned Multiplier = IC;
+  if (MainLoopVF.isScalable())
+    Multiplier = getVScaleForTuning(OrigLoop, TTI).value_or(1);
----------------
fhahn wrote:

I wouldn't say it is incorrect, it just keeps the original behavior for scalable vectors as I think @juliannagele doesn't have access to HW with scalable vectors, which would be needed to evaluate the impact of changing this for scalable vectors.

At this point already picked the VF for the main loop, so the only change is that we consider epilogue vectorization for more cases with fixed vectors.

To avoid regression with fixed vectors, this patch relies on code that checks the number of remaining iterations, which currently doesn't support scalable vectors (look for `// TODO: extend to support scalable VFs`), which probably should be fixed first. Again, this should probably be done by someone with access to HW supporting scalable vectors.



https://github.com/llvm/llvm-project/pull/108190


More information about the llvm-commits mailing list