[llvm] [LAA] Hoist setting condition for RT-checks (PR #128045)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Sat May 3 03:47:10 PDT 2025
artagnon wrote:
> From what I can tell, we can have multiple `DepType::Unknown` dependences that, by themselves, do not trigger the retry with runtime memory checks, and therefore block vectorisation. But once a single `FoundNonConstantDistanceDependence` is found, the analysis seems to switch to the **"LAA: Retrying with memory checks"** path and allows all these dependences to be handled via runtime checks.
Yes, this is correct.
> Is this the intended behaviour?
Using a single `FoundNonConstantDistanceDependence` is not ideal, to begin with: it is not exactly the most principled condition to retry with runtime checks. But yes, that is the intended side-effect of the patch, that was originally unintended.
> If so, is there a rationale for treating `DepType::Unknown` differently depending on the presence of a non-constant distance dependence?
As far as I can tell, there is no rationale for this, although I'm unable to dissect the original intent of the code from the history. It should be noted that `FoundNonConstantDistanceDependence` is a misnomer:
```cpp
// TODO: Relax requirement that there is a common unscaled stride to retry
// with non-constant distance dependencies.
```
It is actually an ad-hoc condition for retrying with runtime checks, which is set when either there is a non-constant dependence distance, or if there is no common unscaled stride (what is the semantic meaning of the latter?).
Thanks for your write-up! I couldn't have written it more clearly myself, and I will adapt your write-up for the commit message.
https://github.com/llvm/llvm-project/pull/128045
More information about the llvm-commits
mailing list