[llvm] [AMDGPU] Add option to pre-allocate SGPR spill VGPRs (PR #70626)

Carl Ritson via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 31 01:49:01 PDT 2023


================
@@ -201,6 +205,10 @@ bool SIPreAllocateWWMRegs::runOnMachineFunction(MachineFunction &MF) {
 
   RegClassInfo.runOnMachineFunction(MF);
 
+  bool PreallocateSGPRSpillVGPRs =
+      EnablePreallocateSGPRSpillVGPRs ||
+      MF.getFunction().hasFnAttribute("amdgpu-prealloc-sgpr-spill-vgprs");
----------------
perlfu wrote:

As @jayfoad pointed out we typically use attributes as we can start embedding this in IR regardless of backend version.

I have spoken with @cdevadas about more complete allocator handling of WWM registers, and will support migration to it when from the graphics side when it is ready.

In the immediate term we need to work around corruption that split-spilling of SGPR spill VGPRs is causing (in complex divergent control flow) and can take the hit of pre-allocating the VGPRs required for all our current workloads.

https://github.com/llvm/llvm-project/pull/70626


More information about the llvm-commits mailing list