[llvm] [LV]Initial support for safe distance in predicated DataWithEVL vectorization mode. (PR #102897)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 00:55:15 PDT 2024


================
@@ -3903,9 +3919,14 @@ FixedScalableVFPair LoopVectorizationCostModel::computeFeasibleMaxVF(
   // dependence distance).
   unsigned MaxSafeElements =
       llvm::bit_floor(Legal->getMaxSafeVectorWidthInBits() / WidestType);
+  unsigned MaxScalableSafeElements = MaxSafeElements;
+  if (foldTailWithEVL() && !Legal->isSafeForAnyVectorWidth()) {
+    MaxScalableSafeElements = std::numeric_limits<unsigned>::max();
----------------
fhahn wrote:

Might be good to document this. IIUC this means if we have something like `MaxSafeElements == 4`, we will still try VFs > 4, even thought we know only at most 4 lanes will execute? Is this desirable? 

Or should this limit to the next power-of-2 of MaxSafeElements?

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


More information about the llvm-commits mailing list