[libc-commits] [libc] e0b487b - [libc] Rename and install the RPC server interface

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Jun 21 09:26:33 PDT 2023


Author: Joseph Huber
Date: 2023-06-21T11:26:24-05:00
New Revision: e0b487bfc07655f333552670732064d6c42915a9

URL: https://github.com/llvm/llvm-project/commit/e0b487bfc07655f333552670732064d6c42915a9
DIFF: https://github.com/llvm/llvm-project/commit/e0b487bfc07655f333552670732064d6c42915a9.diff

LOG: [libc] Rename and install the RPC server interface

This patch prepares the RPC interface to be installed. We place this in
the existing `llvm-gpu-none` directory as it will also give us access to
the generated `libc` headers for the opcodes.

Reviewed By: JonChesterfield

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

Added: 
    libc/utils/gpu/server/rpc_server.cpp
    libc/utils/gpu/server/rpc_server.h

Modified: 
    libc/utils/gpu/loader/Loader.h
    libc/utils/gpu/loader/amdgpu/CMakeLists.txt
    libc/utils/gpu/loader/nvptx/CMakeLists.txt
    libc/utils/gpu/server/CMakeLists.txt

Removed: 
    libc/utils/gpu/server/Server.cpp
    libc/utils/gpu/server/Server.h


################################################################################
diff  --git a/libc/utils/gpu/loader/Loader.h b/libc/utils/gpu/loader/Loader.h
index dd043b46b3c90..d0ee000a38d81 100644
--- a/libc/utils/gpu/loader/Loader.h
+++ b/libc/utils/gpu/loader/Loader.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_UTILS_GPU_LOADER_LOADER_H
 #define LLVM_LIBC_UTILS_GPU_LOADER_LOADER_H
 
-#include "utils/gpu/server/Server.h"
+#include "utils/gpu/server/rpc_server.h"
 #include <cstddef>
 #include <cstdint>
 #include <cstdio>

diff  --git a/libc/utils/gpu/loader/amdgpu/CMakeLists.txt b/libc/utils/gpu/loader/amdgpu/CMakeLists.txt
index 9cd5fe4ce2c1b..8e9c9a2bdc7d2 100644
--- a/libc/utils/gpu/loader/amdgpu/CMakeLists.txt
+++ b/libc/utils/gpu/loader/amdgpu/CMakeLists.txt
@@ -5,5 +5,5 @@ target_link_libraries(amdhsa_loader
   PRIVATE
   hsa-runtime64::hsa-runtime64
   gpu_loader
-  rpc_server
+  llvmlibc_rpc_server
 )

diff  --git a/libc/utils/gpu/loader/nvptx/CMakeLists.txt b/libc/utils/gpu/loader/nvptx/CMakeLists.txt
index c14d60d3fd1fe..0c76c49fa3098 100644
--- a/libc/utils/gpu/loader/nvptx/CMakeLists.txt
+++ b/libc/utils/gpu/loader/nvptx/CMakeLists.txt
@@ -8,7 +8,7 @@ target_include_directories(nvptx_loader PRIVATE ${LLVM_INCLUDE_DIRS})
 target_link_libraries(nvptx_loader
   PRIVATE
   gpu_loader
-  rpc_server
+  llvmlibc_rpc_server
   CUDA::cuda_driver
   LLVMObject
   LLVMSupport

diff  --git a/libc/utils/gpu/server/CMakeLists.txt b/libc/utils/gpu/server/CMakeLists.txt
index 2d5f9207f94cf..04c3729c5f01e 100644
--- a/libc/utils/gpu/server/CMakeLists.txt
+++ b/libc/utils/gpu/server/CMakeLists.txt
@@ -1,8 +1,14 @@
-add_library(rpc_server STATIC Server.cpp)
+add_library(llvmlibc_rpc_server STATIC rpc_server.cpp)
 
 # Include the RPC implemenation from libc.
-add_dependencies(rpc_server libc.src.__support.RPC.rpc)
-target_include_directories(rpc_server PRIVATE ${LIBC_SOURCE_DIR})
-# TODO: This is for the opcodes, we will copy the file here when installed.
-target_include_directories(rpc_server PUBLIC ${LIBC_SOURCE_DIR}/include)
-target_include_directories(rpc_server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+target_include_directories(llvmlibc_rpc_server PRIVATE ${LIBC_SOURCE_DIR})
+target_include_directories(llvmlibc_rpc_server PUBLIC ${LIBC_SOURCE_DIR}/include)
+target_include_directories(llvmlibc_rpc_server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+
+# Install the server and associated header.
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/rpc_server.h
+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gpu-none-llvm/
+        COMPONENT libc)
+install(TARGETS llvmlibc_rpc_server
+        ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}"
+        COMPONENT libc)

diff  --git a/libc/utils/gpu/server/Server.cpp b/libc/utils/gpu/server/rpc_server.cpp
similarity index 99%
rename from libc/utils/gpu/server/Server.cpp
rename to libc/utils/gpu/server/rpc_server.cpp
index 2edd0c0dacd59..644c19f99a052 100644
--- a/libc/utils/gpu/server/Server.cpp
+++ b/libc/utils/gpu/server/rpc_server.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Server.h"
+#include "rpc_server.h"
 
 #include "src/__support/RPC/rpc.h"
 #include <atomic>

diff  --git a/libc/utils/gpu/server/Server.h b/libc/utils/gpu/server/rpc_server.h
similarity index 100%
rename from libc/utils/gpu/server/Server.h
rename to libc/utils/gpu/server/rpc_server.h


        


More information about the libc-commits mailing list