[libc-commits] [PATCH] D146846: [libc] Implement the RPC client / server for NVPTX

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Mar 24 14:07:35 PDT 2023


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

This patch adds the necessary code to impelement the existing RPC client
/ server interface when targeting NVPTX GPUs. This follows closely to
the implementation in the AMDGPU version. This does not yet enable unit
testing as the `nvlink` linker does not support static libraries. So
that will need to be worked around.

I am ignoring the RPC duplication between the AMDGPU and NVPTX loaders. This
will be changed completely later so there's no point unifying the code at this
stage. The implementation was tested manually with the following file and
compilation flags.

  namespace __llvm_libc {
  void write_to_stderr(const char *msg);
  void quick_exit(int);
  } // namespace __llvm_libc
  
  using namespace __llvm_libc;
  
  int main(int argc, char **argv, char **envp) {
    for (int i = 0; i < argc; ++i) {
      write_to_stderr(argv[i]);
      write_to_stderr("\n");
    }
    quick_exit(255);
  }



  $ clang++ crt1.o rpc_client.o quick_exit.o io.o main.cpp --target=nvptx64-nvidia-cuda -march=sm_70 -o image
  $ ./nvptx_loader image 1 2 3
  image
  1
  2
  3
  $ echo $?
  255

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146846

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146846.508209.patch
Type: text/x-patch
Size: 4442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230324/328f6a9b/attachment.bin>


More information about the libc-commits mailing list