[PATCH] D150706: [LAA] Update MaxSafeDepDistBytes when non-unit stride

Michael Maitland via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 10:32:20 PDT 2023


michaelmaitland added a comment.

In D150706#4506956 <https://reviews.llvm.org/D150706#4506956>, @fhahn wrote:

> Does this fix a miscompile in loop-vectorize (or elsewhere)?
>
> AFAICT `MaxSafeDepDistBytes` is simply the distance in bytes between dependent accesses and it's not directly the number of elements/iterations that can be performed in parallel without conflict. Loop-vectorize uses `getMaxSafeVectorWidthInBits` to limit the max VF which is the number of elements that can be processed in parallel.

`MaxSafeVectorWidthInBits` value depends on `MaxVFInBits`, whose value depends on `MaxVF`, whose value depends on `MaxSafeDepDistBytes`. `MaxSafeDepDistBytes` is calculated incorrectly prior to the changes introduces in this patch as you can see by the test case diff in this patch. In order for us to avoid a miscompile that is elicited by the example in this patch, we should fix the problem of incorrectly calculating `MaxSafeDepDistBytes`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150706/new/

https://reviews.llvm.org/D150706



More information about the llvm-commits mailing list