[libc-commits] [PATCH] D149581: [libc] Change GPU startup and loader to use multiple kernels

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon May 1 06:09:30 PDT 2023


jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, tianshilei1992, JonChesterfield, tra, sivachandra, lntue, michaelrj.
Herald added subscribers: libc-commits, kosarev, mattd, asavonic, ecnelises, kerbowa, tschuett, jvesely.
Herald added projects: libc-project, All.
jhuber6 requested review of this revision.

The GPU has a different execution model to standard `_start`
implementations. On the GPU, all threads are active at the start of a
kernel. In order to correctly intitialize and call the constructors we
want single threaded semantics. Previously, this was done using a
makeshift global barrier with atomics. However, it should be easier to
simply put the portions of the code that must be single threaded in
separate kernels and then call those with only one thread. Generally,
mixing global state between kernel launches makes optimizations more
difficult, similarly to calling a function outside of the TU, but for
testing it is better to be correct.

Depends on D149527 <https://reviews.llvm.org/D149527> D148943 <https://reviews.llvm.org/D148943>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149581

Files:
  libc/startup/gpu/amdgpu/start.cpp
  libc/startup/gpu/nvptx/start.cpp
  libc/utils/gpu/loader/amdgpu/Loader.cpp
  libc/utils/gpu/loader/nvptx/Loader.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149581.518426.patch
Type: text/x-patch
Size: 27720 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230501/cbb12124/attachment-0001.bin>


More information about the libc-commits mailing list