[PATCH] D107284: [LoopVectorize] Add support for replication of more intrinsics with scalable vectors

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 2 08:13:06 PDT 2021


david-arm created this revision.
david-arm added reviewers: sdesmalen, kmclaughlin, fhahn, spatel, nikic.
Herald added subscribers: rogfer01, hiraditya.
david-arm requested review of this revision.
Herald added subscribers: llvm-commits, vkmr.
Herald added a project: LLVM.

In VPRecipeBuilder::handleReplication we check if an instruction is uniform
based purely on whether or not the instruction lives in the Uniforms list.
However, there are certain cases where calls to intrinsics are effectively
uniform too and these do not fall into the Uniforms list.

Therefore, in addition to checking the existence of the instruction in
the Uniforms list we now also call a new function:

  VPRecipeBuilder::isUniformReplicate

to see if this is effectively also a uniform replication. There are four
cases to consider:

1. The intrinsics 'experimental.noalias.scope.decl' and 'sideeffect' are

always uniform by definition.

2. If intrinsics 'lifetime.start', 'lifetime.end' and 'assume' have

loop invariant input operands then these are also uniform too.

3. If the 'assume' intrinsic's operand is not loop invariant, then we

are free to treat this as uniform anyway since it's only a performance
hint. We will get the benefit for the first lane.

4. When the input pointers for 'lifetime.start' and 'lifetime.end' are loop

variant then for scalable vectors we assume these still ultimately come
from the broadcast of an alloca. We do not support scalable vectorisation
of loops containing alloca instructions, hence the alloca itself would
be invariant. If the pointer does not come from an alloca then the
intrinsic itself has no effect.

I have updated the assume test for fixed width, since we now treat it
as uniform:

  Transforms/LoopVectorize/assume.ll

I've also added new scalable vectorisation tests for other intriniscs:

  Transforms/LoopVectorize/scalable-assume.ll
  Transforms/LoopVectorize/scalable-lifetime.ll
  Transforms/LoopVectorize/scalable-noalias-scope-decl.ll


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107284

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h
  llvm/test/Transforms/LoopVectorize/assume.ll
  llvm/test/Transforms/LoopVectorize/scalable-assume.ll
  llvm/test/Transforms/LoopVectorize/scalable-lifetime.ll
  llvm/test/Transforms/LoopVectorize/scalable-noalias-scope-decl.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107284.363482.patch
Type: text/x-patch
Size: 19828 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210802/40c55cf9/attachment.bin>


More information about the llvm-commits mailing list