[libc-commits] [PATCH] D149398: [libc] Add support for global ctors / dtors for AMDGPU
Joseph Huber via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Apr 27 18:25:05 PDT 2023
jhuber6 created this revision.
jhuber6 added reviewers: tra, jdoerfert, tianshilei1992, JonChesterfield, sivachandra, michaelrj, lntue, MaskRay.
Herald added subscribers: libc-commits, kosarev, ecnelises, kerbowa, tschuett, tpr, dstuttard, yaxunl, jvesely, kzhuravl.
Herald added projects: libc-project, All.
jhuber6 requested review of this revision.
Herald added a subscriber: wdng.
This patch makes the necessary changes to support calling global
constructors and destructors on the GPU. The patch in D149340 <https://reviews.llvm.org/D149340> allows the
`lld` linker to create the symbols pointing us to these globals. These
should be executed by a single thread, which is more difficult on the
GPU because all threads are active. I chose to use an atomic counter to
sync every thread on the GPU. This is very slow if you use more than a
few thousand threads, but for testing purposes it should be sufficient.
Depends on D149340 <https://reviews.llvm.org/D149340> D149363 <https://reviews.llvm.org/D149363>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D149398
Files:
libc/startup/gpu/amdgpu/CMakeLists.txt
libc/startup/gpu/amdgpu/start.cpp
libc/test/integration/startup/gpu/CMakeLists.txt
libc/test/integration/startup/gpu/init_fini_array_test.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149398.517765.patch
Type: text/x-patch
Size: 6581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230428/a3c1f63b/attachment.bin>
More information about the libc-commits
mailing list