[PATCH] D88819: [LV] Support for Remainder loop vectorization

Vinay Madhusudan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 5 04:00:26 PDT 2020


mivnay created this revision.
mivnay added a project: LLVM.
Herald added subscribers: llvm-commits, bmahjour, pengfei, javed.absar, kristof.beyls.
mivnay requested review of this revision.

Ticket : https://bugs.llvm.org/show_bug.cgi?id=46929

Loop Vectorize currently doesn’t support epilog loop vectorization. The idea is to vectorize the remainder scalar loop after the initial vectorization with Vector Factor (VF) less than the original loop. Once this loop gets executed, the remaining iterations (if any) will go to the original scalar loop.

- Iteration checks are performed for both the vectorized and epilog vectorized loops
- Runtime checks (alias and SCEV checks) are done (only once) for either vectorized or epilog vector loops. If it fails, the original scalar loop is executed.

This helps in executing the vector code either for loops with smaller trip count (less than the original VF) or for loops with considerable remainder iterations after the original vectorization. Currently it is enabled for VF > 16.

This change gains in one of the SPEC CPU 2017 benchmark in both AArch64 and X86 Targets. It gains around 5% in x264 in Ryzen 2700x ref run.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88819

Files:
  include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
  lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
  lib/Transforms/Vectorize/LoopVectorizationPlanner.h
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Transforms/LoopVectorize/X86/invariant-store-vectorization.ll
  test/Transforms/LoopVectorize/X86/masked_load_store.ll
  test/Transforms/LoopVectorize/epilog-loop-vectorize.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88819.296140.patch
Type: text/x-patch
Size: 128391 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201005/8d825a3e/attachment.bin>


More information about the llvm-commits mailing list