[PATCH] D122091: [amdgpu] Elide module lds allocation in kernels with no callees

Jon Chesterfield via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 19 18:13:11 PDT 2022


JonChesterfield created this revision.
JonChesterfield added reviewers: arsenm, rampitec, foad.
Herald added subscribers: kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
Herald added a project: All.
JonChesterfield requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

Introduces a string attribute, amdgpu-requires-module-lds, to allow
eliding the module.lds block from kernels. Will allocate the block as before
if the attribute is missing or has its default value of true.

Patch uses the new attribute to detect the simplest possible instance of this,
where a kernel makes no calls and thus cannot call any functions that use LDS.

Tests updated to match, coverage was already good. Interesting cases is in
lower-module-lds-offsets where annotating the kernel allows the backend to pick
a different (in this case better) variable ordering than previously. A later
patch will avoid moving kernel variables into module.lds when the kernel can
have this attribute, allowing optimal ordering and locally unused variable
elimination.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122091

Files:
  llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
  llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
  llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h
  llvm/test/CodeGen/AMDGPU/lower-kernel-and-module-lds.ll
  llvm/test/CodeGen/AMDGPU/lower-module-lds-constantexpr.ll
  llvm/test/CodeGen/AMDGPU/lower-module-lds-offsets.ll
  llvm/test/CodeGen/AMDGPU/lower-module-lds.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122091.416750.patch
Type: text/x-patch
Size: 14215 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220320/5fdb3cee/attachment.bin>


More information about the llvm-commits mailing list