[PATCH] D59295: [AMDGPU] Pre-allocate WWM registers to reduce VGPR pressure.

Neil Henning via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 06:30:02 PDT 2019


sheredom created this revision.
sheredom added reviewers: nhaehnle, dstuttard, cwabbott.
sheredom added a project: AMDGPU.
Herald added subscribers: llvm-commits, jdoerfert, jfb, t-tye, tpr, yaxunl, mgorny, wdng, jvesely, kzhuravl, arsenm.
Herald added a project: LLVM.

This change incorporates an effort by Connor Abbot to change how we deal with WWM operations potentially trashing valid values in inactive lanes.

Previously, the SIFixWWMLiveness pass would work out which registers were being trashed within WWM regions, and ensure that the register allocator did not have any values it was depending on resident in those registers if the WWM section would trash them. This worked perfectly well, but would cause sometimes severe register pressure when the WWM section resided before divergent control flow (or at least that is where I mostly observed it).

This fix instead runs through the WWM sections and pre allocates some registers for WWM. It then reserves these registers so that the register allocator cannot use them. This results in a significant register saving on some WWM shaders I'm working with (130 -> 104 VGPRs, with just this change!).

This change was entirely thought up by @cwabbott (I claim no credit for the original idea!), but I had some time to look at it and so we agreed that I could give it a final polish for submission.


Repository:
  rL LLVM

https://reviews.llvm.org/D59295

Files:
  include/llvm/IR/IntrinsicsAMDGPU.td
  lib/Target/AMDGPU/AMDGPU.h
  lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
  lib/Target/AMDGPU/CMakeLists.txt
  lib/Target/AMDGPU/SIFixWWMLiveness.cpp
  lib/Target/AMDGPU/SIMachineFunctionInfo.h
  lib/Target/AMDGPU/SIPreAllocateWWMRegs.cpp
  lib/Target/AMDGPU/SIRegisterInfo.cpp
  test/CodeGen/AMDGPU/atomic_optimizations_buffer.ll
  test/CodeGen/AMDGPU/atomic_optimizations_global_pointer.ll
  test/CodeGen/AMDGPU/atomic_optimizations_local_pointer.ll
  test/CodeGen/AMDGPU/atomic_optimizations_raw_buffer.ll
  test/CodeGen/AMDGPU/atomic_optimizations_struct_buffer.ll
  test/CodeGen/AMDGPU/fix-wwm-liveness.mir
  test/CodeGen/AMDGPU/indirect-addressing-term.ll
  test/CodeGen/AMDGPU/wwm-reserved.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59295.190402.patch
Type: text/x-patch
Size: 53251 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190313/4d958db7/attachment-0001.bin>


More information about the llvm-commits mailing list