[PATCH] D20895: AMDGPU: Make FrameLowering stack alignment 16

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 1 18:48:45 PDT 2016


arsenm created this revision.
arsenm added a reviewer: tstellarAMD.
arsenm added a subscriber: llvm-commits.
Herald added subscribers: kzhuravl, arsenm.

We don't need it to be that high. The natural alignment for a single workitem's stack is 16.

http://reviews.llvm.org/D20895

Files:
  lib/Target/AMDGPU/AMDGPUSubtarget.cpp

Index: lib/Target/AMDGPU/AMDGPUSubtarget.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUSubtarget.cpp
+++ lib/Target/AMDGPU/AMDGPUSubtarget.cpp
@@ -107,23 +107,24 @@
 
   initializeSubtargetDependencies(TT, GPU, FS);
 
-  const unsigned MaxStackAlign = 64 * 16; // Maximum stack alignment (long16)
+  // Scratch is allocated in 256 dword per wave blocks.
+  const unsigned StackAlign = 4 * 256 / getWavefrontSize();
 
   if (getGeneration() <= AMDGPUSubtarget::NORTHERN_ISLANDS) {
     InstrInfo.reset(new R600InstrInfo(*this));
     TLInfo.reset(new R600TargetLowering(TM, *this));
 
     // FIXME: Should have R600 specific FrameLowering
     FrameLowering.reset(new AMDGPUFrameLowering(
                           TargetFrameLowering::StackGrowsUp,
-                          MaxStackAlign,
+                          StackAlign,
                           0));
   } else {
     InstrInfo.reset(new SIInstrInfo(*this));
     TLInfo.reset(new SITargetLowering(TM, *this));
     FrameLowering.reset(new SIFrameLowering(
                           TargetFrameLowering::StackGrowsUp,
-                          MaxStackAlign,
+                          StackAlign,
                           0));
 #ifndef LLVM_BUILD_GLOBAL_ISEL
     GISelAccessor *GISel = new GISelAccessor();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20895.59331.patch
Type: text/x-patch
Size: 1330 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160602/35a4a7e9/attachment.bin>


More information about the llvm-commits mailing list