[llvm] [LAA] Support backward dependences with non-constant distance. (PR #91525)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 13:16:24 PDT 2024


================
@@ -314,6 +316,11 @@ class MemoryDepChecker {
   /// RecordDependences is true.
   SmallVector<Dependence, 8> Dependences;
 
+  /// The maximum width of a target's vector registers. Is used to decide if a
+  /// backwards dependence with non-constant stride should be classified as
+  /// backwards-vectorizable or unknown (triggering a runtime check).
+  unsigned MaxTargetVectorWidthInBits = 0;
----------------
fhahn wrote:

At the moment, it would effectively limit the interleave count to 1. Unfortunately it is difficult to estimate the expected interleave count here. We could  try to get the max interleave count, but that would require computing the VF, which in turn needs the element size.

Ideally LAA would not make the decision whether to use runtime checks or not, but record the backwards-vectorizable dependences with non-constant distances, and let LV later decide limit the VF or do runtime checks.  But that would be a much larger change (LV at the moment considers the maximum safe width very early on). 

So to start with, it would be great if we could go with a reasonable heuristic. Perhaps we should consider a relatively large interleave count (e.g. 4) initially?

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


More information about the llvm-commits mailing list