[all-commits] [llvm/llvm-project] e537c8: [libc] Add basic support for calling host function...

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed Jul 19 08:12:05 PDT 2023


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

  Changed paths:
    M libc/config/gpu/entrypoints.txt
    M libc/include/llvm-libc-types/rpc_opcodes_t.h
    M libc/spec/gpu_ext.td
    M libc/src/gpu/CMakeLists.txt
    A libc/src/gpu/rpc_host_call.cpp
    A libc/src/gpu/rpc_host_call.h
    M libc/utils/gpu/server/rpc_server.cpp
    A openmp/libomptarget/test/libc/host_call.c

  Log Message:
  -----------
  [libc] Add basic support for calling host functions from the GPU

This patch adds the `rpc_host_call` function as a GPU extension. This is
exported from the `libc` project to use the RPC interface to call a
function pointer via RPC any copying the arguments by-value. The
interface can only support a single void pointer argument much like
pthreads. The function call here is the bare-bones version of what's
required for OpenMP reverse offloading. Full support will require
interfacing with the mapping table, nowait support, etc.

I decided to test this interface in `libomptarget` as that will be the
primary consumer and it would be more difficult to make a test in `libc`
due to the testing infrastructure not really having a concept of the
"host" as it runs directly on the GPU as if it were a CPU target.

Reviewed By: jplehr

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




More information about the All-commits mailing list