[all-commits] [llvm/llvm-project] aea866: [libc] Support concurrent RPC port access on the GPU

Joseph Huber via All-commits all-commits at lists.llvm.org
Fri May 5 08:12:35 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aea866c12cb428eb5fe062ffa910a63daff62b01
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-05-05 (Fri, 05 May 2023)

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

  Log Message:
  [libc] Support concurrent RPC port access on the GPU

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 were applied to
achieve parallel support.

Depends on D149581

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D149598

More information about the All-commits mailing list