[PATCH] D115413: [amdgpu] Drop lowering of LDS used by global variables

Jon Chesterfield via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 8 17:23:51 PST 2021


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

Approximately revert D103431 <https://reviews.llvm.org/D103431>.

LDS variables are allocated at kernel launch and deallocated at kernel exit.
The address is therefore kernel execution dependent. Global variables are
initialized by values written to .data, which can't be done for a LDS variable
as there is no kernel running, or by a global constructor. Initializing the
global to the address of some LDS allocated by a global constructor is possible
but indistinguishable from undef.

Assigning the address of a LDS variable to a global should be a sema error. It
isn't for openmp, haven't checked other languages. Failing that it could be set
to undef, perhaps in this pass.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115413

Files:
  llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
  llvm/lib/Target/AMDGPU/Utils/AMDGPULDSUtils.cpp
  llvm/lib/Target/AMDGPU/Utils/AMDGPULDSUtils.h
  llvm/test/CodeGen/AMDGPU/lower-kernel-lds-global-uses.ll
  llvm/test/CodeGen/AMDGPU/lower-module-lds-global-alias.ll
  llvm/test/CodeGen/AMDGPU/lower-module-lds-global-uses.ll
  llvm/test/CodeGen/AMDGPU/lower-module-lds-indirect.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115413.392998.patch
Type: text/x-patch
Size: 24132 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211209/56ced305/attachment.bin>


More information about the llvm-commits mailing list