[all-commits] [llvm/llvm-project] d0ff5e: [libc] Update RPC interface for system utilities o...

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed Apr 19 18:02:50 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d0ff5e40308ee33936bfcc131f33adb4066b946f
      https://github.com/llvm/llvm-project/commit/d0ff5e40308ee33936bfcc131f33adb4066b946f
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-04-19 (Wed, 19 Apr 2023)

  Changed paths:
    M libc/src/__support/OSUtil/gpu/io.cpp
    M libc/src/__support/OSUtil/gpu/io.h
    M libc/src/__support/OSUtil/gpu/quick_exit.cpp
    M libc/src/__support/RPC/rpc.h
    M libc/startup/gpu/amdgpu/start.cpp
    M libc/startup/gpu/nvptx/start.cpp
    M libc/utils/gpu/loader/CMakeLists.txt
    A libc/utils/gpu/loader/Server.h
    M libc/utils/gpu/loader/amdgpu/CMakeLists.txt
    M libc/utils/gpu/loader/amdgpu/Loader.cpp
    M libc/utils/gpu/loader/nvptx/CMakeLists.txt
    M libc/utils/gpu/loader/nvptx/Loader.cpp

  Log Message:
  -----------
  [libc] Update RPC interface for system utilities on the GPU

This patch reworks the RPC interface to allow more generic memory
operations using the shared better. This patch decomposes the entire RPC
interface into opening a port and calling `send` or `recv` on it.

The `send` function sends a single packet of the length of the buffer.
The `recv` function is paired with the `send` call to then use the data.
So, any aribtrary combination of sending packets is possible. The only
restriction is that the client initiates the exchange with a `send`
while the server consumes it with a `recv`.

The operation of this is driven by two independent state machines that
tracks the buffer ownership during loads / stores. We keep track of two
so that we can transition between a send state and a recv state without
an extra wait. State transitions are observed via bit toggling, e.g.

This interface supports an efficient `send -> ack -> send -> ack -> send`
interface and allows for the last send to be ignored without checking
the ack.

A following patch will add some more comprehensive testing to this interface. I
I informally made an RPC call that simply incremented an integer and it took
roughly 10 microsends to complete an RPC call.

Reviewed By: jdoerfert

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


  Commit: 0bd564a259e1647343e3137abe6b618d7ad09c18
      https://github.com/llvm/llvm-project/commit/0bd564a259e1647343e3137abe6b618d7ad09c18
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-04-19 (Wed, 19 Apr 2023)

  Changed paths:
    M libc/src/__support/RPC/rpc.h
    M libc/test/integration/startup/gpu/CMakeLists.txt
    A libc/test/integration/startup/gpu/rpc_test.cpp
    M libc/utils/gpu/loader/Server.h

  Log Message:
  -----------
  [libc] Add a test to directly stimulate the RPC interface

Currently, the RPC interface with the loader is only tested if the other
tests fail. This test adds a direct test that runs a simple integer
increment over the RPC handshake 10000 times.

Depends on https://reviews.llvm.org/D148288

Reviewed By: lntue

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


  Commit: a080798fb2d2343704512ad6adbf9fe1e13eec96
      https://github.com/llvm/llvm-project/commit/a080798fb2d2343704512ad6adbf9fe1e13eec96
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-04-19 (Wed, 19 Apr 2023)

  Changed paths:
    M libc/cmake/modules/LLVMLibCTestRules.cmake
    M libc/test/integration/startup/gpu/CMakeLists.txt
    M libc/test/integration/startup/gpu/rpc_test.cpp

  Log Message:
  -----------
  [libc] Test the RPC interface with multiple blocks

The RPC interface can support multiple independent clients. This support
currently only supports many single-thread warps / workgroups
coordinating over a single lock. This patch uses the support added in
the previous patch to test the RPC interface with multiple blocks.

Note that this does not work with multiple threads currently because of
the effect of warps / workgroups executing in lockstep incorrectly. This
will be added later.

Depends on D148485

Reviewed By: lntue, sivachandra

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


Compare: https://github.com/llvm/llvm-project/compare/abd66d918ae9...a080798fb2d2


More information about the All-commits mailing list