[PATCH] D156158: [LAA] Rename and fix semantics of MaxSafeDepDistBytes to MinDepDistBytes

Michael Maitland via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 24 11:33:41 PDT 2023


michaelmaitland created this revision.
michaelmaitland added reviewers: reames, fhahn, Ayal, ABataev.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
michaelmaitland requested review of this revision.
Herald added subscribers: llvm-commits, wangpc.
Herald added a project: LLVM.

`MaxSafeDepDistBytes` was not correct based on its name an semantics
in instances when there was a non-unit stride loop. For example,

  for (int k = 0; k < len; k+=3) {
    a[k] = a[k+4];
    a[k+2] = a[k+6];
  }

Here, the smallest dependence distance is 8 bytes, but MaxSafeDepDistBytes
was 24 bytes. `MaxSafeVectorWidthInBits` reported the correct number of bits
that could be vectorized since it disregarded semantics of
`MaxSafeDepDistBytes` and used the following semantics instead:

The smallest dependence distance in bytes in the loop. This may not be
the same as the maximum number of bytes that are safe to operate on
simultaneously.

As a result, the name of this variable should reflect those semantics and
its docstring should be updated accordingly.

A debug message that used `MaxSafeDepDistBytes` to signify to the user
how many bytes could be accessed in parallel is updated to use
`MaxSafeVectorWidthInBits` instead. That way, the same message if
communicated to the user, just in different units.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156158

Files:
  llvm/include/llvm/Analysis/LoopAccessAnalysis.h
  llvm/lib/Analysis/LoopAccessAnalysis.cpp
  llvm/test/Analysis/LoopAccessAnalysis/depend_diff_types.ll
  llvm/test/Analysis/LoopAccessAnalysis/depend_diff_types_opaque_ptr.ll
  llvm/test/Analysis/LoopAccessAnalysis/max_safe_dep_dist_non_unit_stride.ll
  llvm/test/Analysis/LoopAccessAnalysis/safe-with-dep-distance.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156158.543657.patch
Type: text/x-patch
Size: 9924 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230724/9f236187/attachment.bin>


More information about the llvm-commits mailing list