[libc-commits] [PATCH] D149598: [libc] Support concurrent RPC port access on the GPU

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon May 1 10:51:44 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.

Previously we used a single port to implement the RPC. This was
sufficient for single threaded tests but can potentially cause deadlocks
when using multiple threads. The reason for this is that GPUs make no
forward progress guarantees. Therefore one group of threads waiting on
another group of threads can spin forever because there is no guarantee
that the other threads will continue executing. The typical workaround
for this is to allocate enough memory that a sufficiently large number
of work groups can make progress. As long as this number is somewhat
close to the amount of total concurrency we can obtain reliable
execution around a shared resource.

This patch enables using multiple ports by widening the arrays to a
predetermined size and indexes into them. Empty ports are currently
obtained via a trivial linker scan. This should be imporoved in the
future for performance reasons. Portions of D148191 <https://reviews.llvm.org/D148191> were applied to
achieve parallel support.

Depends on D149581 <https://reviews.llvm.org/D149581>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149598

Files:
  libc/src/__support/RPC/rpc.h
  libc/src/__support/RPC/rpc_util.h
  libc/startup/gpu/amdgpu/start.cpp
  libc/startup/gpu/nvptx/start.cpp
  libc/utils/gpu/loader/Server.h
  libc/utils/gpu/loader/amdgpu/Loader.cpp
  libc/utils/gpu/loader/nvptx/Loader.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149598.518490.patch
Type: text/x-patch
Size: 19067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230501/65ce5be6/attachment-0001.bin>


More information about the libc-commits mailing list