Files
clang-p2996/libc/utils/gpu/server/CMakeLists.txt
Joseph Huber 598e882ee8 [libc] Template the writing mode for the writer class (#111559)
Summary:
Currently we dispatch the writing mode off of a runtime enum passed in
by the constructor. This causes very unfortunate codegen for the GPU
targets where we get worst-case codegen because of the unused function
pointer for `sprintf`. Instead, this patch moves all of this to a
template so it can be masked out. This results in no dynamic stack and
uses 60 VGPRs instead of 117. It also compiles about 5x as fast.
2025-03-12 13:51:44 -05:00

31 lines
1.5 KiB
CMake

add_library(llvmlibc_rpc_server STATIC rpc_server.cpp)
# Include the RPC implemenation from libc.
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:Clang>:-Wno-c99-extensions>
$<$<CXX_COMPILER_ID:GNU>:-Wno-attributes>)
target_compile_definitions(llvmlibc_rpc_server PUBLIC
LIBC_COPT_USE_C_ASSERT
LIBC_COPT_MEMCPY_USE_EMBEDDED_TINY
LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64
LIBC_COPT_ARRAY_ARG_LIST
LIBC_COPT_PRINTF_DISABLE_WRITE_INT
LIBC_COPT_PRINTF_DISABLE_INDEX_MODE
LIBC_COPT_PRINTF_DISABLE_STRERROR
LIBC_NAMESPACE=${LIBC_NAMESPACE})
# Install the server and associated header.
install(FILES ${LIBC_SOURCE_DIR}/shared/rpc.h
${LIBC_SOURCE_DIR}/shared/rpc_util.h
${LIBC_SOURCE_DIR}/shared/rpc_opcodes.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/shared
COMPONENT libc-headers)
install(TARGETS llvmlibc_rpc_server
ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}"
COMPONENT libc)