[PATCH] D82496: [amdgpu] Add codegen support for HIP dynamic shared memory.

Michael Liao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 9 23:15:48 PDT 2020


hliao marked an inline comment as done.
hliao added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h:60
 
   unsigned getLDSSize() const {
+    if (DynLDSAlign)
----------------
arsenm wrote:
> Rename to getAllocatedLDSSize()? I think there should be a separate method to get the size plus the roundup to the dynamic alignment
To report the LDS usage accurately, the final LDSSize need to count the padding due to dynamic shared memory alignment. Now, the re-alignment on LDS is explicitly done before the final instruction selection.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h:61
   unsigned getLDSSize() const {
+    if (DynLDSAlign)
+      LDSSize = alignTo(LDSSize, *DynLDSAlign);
----------------
arsenm wrote:
> I think having this here actually breaks the calculation of the total size for all of the statically known globals
The re-alignment is done explicitly just before final instruction selection and just once. BTW, `getLDSSize` should be only valid after instruction selection.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82496/new/

https://reviews.llvm.org/D82496



More information about the llvm-commits mailing list