[PATCH] D105192: [AMDGPU] Optimize VGPR LiveRange in waterfall loops

Sebastian Neubauer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 30 07:06:01 PDT 2021


sebastian-ne created this revision.
sebastian-ne added reviewers: arsenm, critson, foad, ruiling.
Herald added subscribers: wenlei, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl, MatzeB.
sebastian-ne requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

The loops are run exactly once per lane, so VGPRs do not need to be
saved. Mark waterfall loops with SI_WATERFALL_LOOP and use the
SIOptimizeVGPRLiveRange pass to add phi nodes that take undef when
coming from the loop.

There are still a few shortcomings, that is

1. Return values from a function call in the loop are copied because their live range conflicts with the live range of arguments, even if arguments are only IMPLICIT_DEF after the phi insertion.
2. If a VGPR argument is used after the loop, the register is still copied unnecessarily inside the loop (see @test_indirect_call_vgpr_ptr_arg_and_reuse in indirect-call.ll).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105192

Files:
  llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
  llvm/lib/Target/AMDGPU/SIInstructions.td
  llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp
  llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp
  llvm/lib/Target/AMDGPU/SIOptimizeVGPRLiveRange.cpp
  llvm/test/CodeGen/AMDGPU/image-sample-waterfall.ll
  llvm/test/CodeGen/AMDGPU/indirect-call.ll
  llvm/test/CodeGen/AMDGPU/llvm.amdgcn.struct.buffer.load.format.v3f16.ll
  llvm/test/CodeGen/AMDGPU/mubuf-legalize-operands.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105192.355538.patch
Type: text/x-patch
Size: 43594 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210630/80eeb9a7/attachment-0001.bin>


More information about the llvm-commits mailing list