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

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 21 13:09:00 PDT 2023


fhahn added a comment.

In D150706#4515123 <https://reviews.llvm.org/D150706#4515123>, @michaelmaitland wrote:

>> I think with respect to MaxSafeDepDistBytes it is still not clear to me that the current value is incorrect, as it is just the distance computed between 2 dependencies and in the test the distance between %arrayidx2 and %%arrayidx5 is 24 bytes AFAICT.
>
> It is not `just the distance computed between 2 dependencies`. It is the `number of bytes we can access in parallel safely`, according to the docstring of `MaxSafeDepDistBytes`. I do not think that it would be safe to vectorize this access 24 bytes at a time. I only think it is safe to vectorize this access 8 bytes at a time.

So I think the doc string should be updated in that case. For LV legality, `MaxSafeVectorWidthInBits` is used which is computed & used correctly AFACIT.  I replaced LV's use of `MaxSafeDepDistBytes`  in 25d34215bb80459dd328d6f8eb86c43684375d88 <https://reviews.llvm.org/rG25d34215bb80459dd328d6f8eb86c43684375d88> and I think there's no need to expose `MaxSafeDepDistBytes` outside of LAA, as users should use `MaxSafeVectorWidthInBits` WDYT?



================
Comment at: llvm/test/Analysis/LoopAccessAnalysis/max_safe_dep_dist_non_unit_stride.ll:14
+; CHECK-NEXT:    Memory dependences are safe with a maximum dependence distance of 8 bytes
+; CHECK-NEXT:    The maximum number of bits that are safe to operate on in parallel is 0
 ; CHECK-NEXT:    Dependences:
----------------
This is now more pessimistic than necessary I think


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