[all-commits] [llvm/llvm-project] b7315f: [LAA, LV] Add initial support for pointer-diff memo...

Florian Hahn via All-commits all-commits at lists.llvm.org
Mon May 16 07:27:50 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b7315ffc3c92d2408780b5748cbac1c651128079
      https://github.com/llvm/llvm-project/commit/b7315ffc3c92d2408780b5748cbac1c651128079
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2022-05-16 (Mon, 16 May 2022)

  Changed paths:
    M llvm/include/llvm/Analysis/LoopAccessAnalysis.h
    M llvm/include/llvm/Transforms/Utils/LoopUtils.h
    M llvm/lib/Analysis/LoopAccessAnalysis.cpp
    M llvm/lib/Transforms/Utils/LoopUtils.cpp
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    M llvm/test/Transforms/LoopVectorize/AArch64/sve-vector-reverse.ll
    M llvm/test/Transforms/LoopVectorize/ARM/mve-qabs.ll
    M llvm/test/Transforms/LoopVectorize/X86/masked_load_store.ll
    M llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll
    M llvm/test/Transforms/LoopVectorize/fpsat.ll
    M llvm/test/Transforms/LoopVectorize/multiple-exits-versioning.ll
    M llvm/test/Transforms/LoopVectorize/no_outside_user.ll
    M llvm/test/Transforms/LoopVectorize/runtime-check-readonly.ll
    M llvm/test/Transforms/LoopVectorize/runtime-check-small-clamped-bounds.ll
    M llvm/test/Transforms/LoopVectorize/runtime-check.ll
    M llvm/test/Transforms/LoopVectorize/runtime-checks-difference.ll
    M llvm/test/Transforms/LoopVectorize/scalable-loop-unpredicated-body-scalar-tail.ll
    M llvm/test/Transforms/LoopVectorize/tbaa-nodep.ll
    M llvm/test/Transforms/PhaseOrdering/AArch64/hoisting-sinking-required-for-vectorization.ll
    M llvm/test/Transforms/PhaseOrdering/X86/vdiv.ll

  Log Message:
  -----------
  [LAA,LV] Add initial support for pointer-diff memory checks.

This patch adds initial support for a pointer diff based runtime check
scheme for vectorization. This scheme requires fewer computations and
checks than the existing full overlap checking, if it is applicable.

The main idea is to only check if source and sink of a dependency are
far enough apart so the accesses won't overlap in the vector loop. To do
so, it is sufficient to compute the difference and compare it to the
`VF * UF * AccessSize`. It is sufficient to check
`(Sink - Src) <u VF * UF * AccessSize` to rule out a backwards
dependence in the vector loop with the given VF and UF. If Src >=u Sink,
there is not dependence preventing vectorization, hence the overflow
should not matter and using the ULT should be sufficient.

Note that the initial version is restricted in multiple ways:

1. Pointers must only either be read or written, by a single
   instruction (this allows re-constructing source/sink for
   dependences with the available information)
 2. Source and sink pointers must be add-recs, with matching steps
 3. The step must be a constant.
 3. abs(step) == AccessSize.

Most of those restrictions can be relaxed in the future.

See https://github.com/llvm/llvm-project/issues/53590.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D119078




More information about the All-commits mailing list