Skip to content

Commit

Permalink
[libc] Make the RPC server target always available
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jhuber6 committed Jun 30, 2023
1 parent 62f57bc commit df52a22
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions libc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 4 additions & 0 deletions libc/utils/gpu/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion libc/utils/gpu/server/rpc_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit df52a22

Please sign in to comment.