From 8a790033073e005b41140b5c38a4eaada321c2f1 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Sun, 10 Mar 2024 14:06:56 -0500 Subject: [libc] Move RPC opcodes include out of the header Summary: This header isn't strictly necessary, and is currently broken because we install these to separate locations. --- libc/utils/gpu/loader/Loader.h | 1 + libc/utils/gpu/server/CMakeLists.txt | 4 ++++ libc/utils/gpu/server/llvmlibc_rpc_server.h | 4 +--- libc/utils/gpu/server/rpc_server.cpp | 10 +++++----- 4 files changed, 11 insertions(+), 8 deletions(-) (limited to 'libc') diff --git a/libc/utils/gpu/loader/Loader.h b/libc/utils/gpu/loader/Loader.h index cffbaa6..9338038 100644 --- a/libc/utils/gpu/loader/Loader.h +++ b/libc/utils/gpu/loader/Loader.h @@ -11,6 +11,7 @@ #include "utils/gpu/server/llvmlibc_rpc_server.h" +#include "llvm-libc-types/rpc_opcodes_t.h" #include "include/llvm-libc-types/test_rpc_opcodes_t.h" #include diff --git a/libc/utils/gpu/server/CMakeLists.txt b/libc/utils/gpu/server/CMakeLists.txt index 8712f24..10cfdb4 100644 --- a/libc/utils/gpu/server/CMakeLists.txt +++ b/libc/utils/gpu/server/CMakeLists.txt @@ -24,6 +24,10 @@ endif() install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/llvmlibc_rpc_server.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT libc-headers) +install(FILES ${LIBC_SOURCE_DIR}/include/llvm-libc-types/rpc_opcodes_t.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + RENAME llvmlibc_rpc_opcodes.h + COMPONENT libc-headers) install(TARGETS llvmlibc_rpc_server ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT libc) diff --git a/libc/utils/gpu/server/llvmlibc_rpc_server.h b/libc/utils/gpu/server/llvmlibc_rpc_server.h index f1a8fe0..b7f2a46 100644 --- a/libc/utils/gpu/server/llvmlibc_rpc_server.h +++ b/libc/utils/gpu/server/llvmlibc_rpc_server.h @@ -11,8 +11,6 @@ #include -#include "llvm-libc-types/rpc_opcodes_t.h" - #ifdef __cplusplus extern "C" { #endif @@ -84,7 +82,7 @@ rpc_status_t rpc_handle_server(uint32_t device_id); /// Register a callback to handle an opcode from the RPC client. The associated /// data must remain accessible as long as the user intends to handle the server /// with this callback. -rpc_status_t rpc_register_callback(uint32_t device_id, rpc_opcode_t opcode, +rpc_status_t rpc_register_callback(uint32_t device_id, uint16_t opcode, rpc_opcode_callback_ty callback, void *data); /// Obtain a pointer to a local client buffer that can be copied directly to the diff --git a/libc/utils/gpu/server/rpc_server.cpp b/libc/utils/gpu/server/rpc_server.cpp index 2c8186c..90af156 100644 --- a/libc/utils/gpu/server/rpc_server.cpp +++ b/libc/utils/gpu/server/rpc_server.cpp @@ -30,8 +30,8 @@ static_assert(RPC_MAXIMUM_PORT_COUNT == rpc::MAX_PORT_COUNT, template rpc_status_t handle_server_impl( rpc::Server &server, - const std::unordered_map &callbacks, - const std::unordered_map &callback_data, + const std::unordered_map &callbacks, + const std::unordered_map &callback_data, uint32_t &index) { auto port = server.try_open(lane_size, index); if (!port) @@ -239,8 +239,8 @@ struct Device { void *buffer; rpc::Server server; rpc::Client client; - std::unordered_map callbacks; - std::unordered_map callback_data; + std::unordered_map callbacks; + std::unordered_map callback_data; }; // A struct containing all the runtime state required to run the RPC server. @@ -335,7 +335,7 @@ rpc_status_t rpc_handle_server(uint32_t device_id) { } } -rpc_status_t rpc_register_callback(uint32_t device_id, rpc_opcode_t opcode, +rpc_status_t rpc_register_callback(uint32_t device_id, uint16_t opcode, rpc_opcode_callback_ty callback, void *data) { if (!state) -- cgit v1.1