[libc-commits] [libc] df52a22 - [libc] Make the RPC server target always available

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Fri Jun 30 09:31:03 PDT 2023


Author: Joseph Huber
Date: 2023-06-30T11:30:57-05:00
New Revision: df52a22b1b7d912aeed8c79ecdb2e99f4189e4cb

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

LOG: [libc] Make the RPC server target always available

This patch makes sure that we always build the RPC server. The proposed
used for this is to begin integrating this server implementation into
`libomptarget`. That requires that we build this server ahead of time
when using a `LLVM_ENABLE_PROJECTS` build. Make a few tweaks to ensure
that the GCC compiler which may be used for this build doesn't complain.

Reviewed By: JonChesterfield

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

Added: 
    

Modified: 
    libc/CMakeLists.txt
    libc/utils/gpu/server/CMakeLists.txt
    libc/utils/gpu/server/rpc_server.h

Removed: 
    


################################################################################
diff  --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index d4e95fa13cadf..6acdb65ce550e 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -35,6 +35,11 @@ if(("libc" IN_LIST LLVM_ENABLE_RUNTIMES AND NOT LLVM_RUNTIMES_BUILD) OR
   # When libc is build as part of the runtimes/bootstrap build's CMake run, we
   # only need to build the host tools to build the libc. So, we just do enough
   # to build libc-hdrgen and return.
+
+  # Always make the RPC server availible to other projects for GPU mode.
+  if(LIBC_GPU_BUILD OR LIBC_GPU_ARCHITECTURES)
+    add_subdirectory(utils/gpu/server)
+  endif()
   return()
 endif()
 

diff  --git a/libc/utils/gpu/server/CMakeLists.txt b/libc/utils/gpu/server/CMakeLists.txt
index 04c3729c5f01e..c802d79e63644 100644
--- a/libc/utils/gpu/server/CMakeLists.txt
+++ b/libc/utils/gpu/server/CMakeLists.txt
@@ -5,6 +5,10 @@ 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})
 
+# Ignore unsupported clang attributes if we're using GCC.
+target_compile_options(llvmlibc_rpc_server PUBLIC
+                       $<$<CXX_COMPILER_ID:GNU>:-Wno-attributes>)
+
 # Install the server and associated header.
 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/rpc_server.h
         DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gpu-none-llvm/

diff  --git a/libc/utils/gpu/server/rpc_server.h b/libc/utils/gpu/server/rpc_server.h
index f4ba77fb90602..556f4e9ee84f9 100644
--- a/libc/utils/gpu/server/rpc_server.h
+++ b/libc/utils/gpu/server/rpc_server.h
@@ -22,7 +22,7 @@ const uint64_t RPC_MAXIMUM_PORT_COUNT = 64;
 
 /// The symbol name associated with the client for use with the LLVM C library
 /// implementation.
-static const char *rpc_client_symbol_name = "__llvm_libc_rpc_client";
+inline const char *rpc_client_symbol_name = "__llvm_libc_rpc_client";
 
 /// status codes.
 typedef enum {


        


More information about the libc-commits mailing list