[PATCH] D105682: [AMDGPU] Handle functions in llvm's global ctors and dtors list

Reshabh Sharma via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 9 01:40:03 PDT 2021


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

This patch introduces a new code object metadata field, ".kind" which is used to add support for init and fini kernels.

HSAStreamer will use function attributes, "device-init" and "device-fini" to distinguish between init and fini kernels from the regular kernels and will emit metadata with ".kind" set to "init" and "fini" respectively.

To reduce the number of init and fini kernels, the ctors and dtors present in the llvm's global.ctors and global.dtors lists are called from a single init and fini kernel respectively.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105682

Files:
  llvm/docs/AMDGPUUsage.rst
  llvm/lib/Target/AMDGPU/AMDGPU.h
  llvm/lib/Target/AMDGPU/AMDGPUCtorDtorLowering.cpp
  llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
  llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
  llvm/lib/Target/AMDGPU/CMakeLists.txt
  llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
  llvm/test/CodeGen/AMDGPU/lower-ctor-dtor.ll
  llvm/test/CodeGen/AMDGPU/lower-multiple-ctor-dtor.ll
  llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105682.357425.patch
Type: text/x-patch
Size: 13730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210709/e2fcd1f8/attachment.bin>


More information about the llvm-commits mailing list