[PATCH] D71919: [LoopVectorize] Disable single stride access predicates when gather loads are available.

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 27 01:01:27 PST 2019


dmgreen created this revision.
dmgreen added reviewers: Ayal, hsaito, fhahn.
Herald added subscribers: rogfer01, hiraditya.
Herald added a project: LLVM.

The LoopVectorizer/LAA has the ability to add runtime checks for memory accesses that look like they may be single stride accesses, in an attempt to still run vectorized code. This can happen in a boring matrix multiply kernel, for example:

  for(int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++)
    {
      int sum = 0;
      for (int k = 0; k < l; k++)
        sum += A[i*l + k] * B[k*m + j];
      C[i*m + j] = sum;
    }
  }

However if we have access to efficient vector gather loads, they should be are a much better option than vectoizing with runtime checks for a stride of 1.

This adds a check into the place that appears to be dictating this, LAA, to check if the MaskedGather or MaskedScatter would be legal.


https://reviews.llvm.org/D71919

Files:
  llvm/include/llvm/Analysis/LoopAccessAnalysis.h
  llvm/lib/Analysis/LoopAccessAnalysis.cpp
  llvm/test/Transforms/LoopVectorize/ARM/mve-mat-mul.ll
  llvm/test/Transforms/LoopVectorize/X86/optsize.ll
  llvm/unittests/Transforms/Vectorize/VPlanSlpTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71919.235101.patch
Type: text/x-patch
Size: 13725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191227/d1b14223/attachment.bin>


More information about the llvm-commits mailing list