aboutsummaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorJoseph Huber <huberjn@outlook.com>2024-03-10 14:06:56 -0500
committerJoseph Huber <huberjn@outlook.com>2024-03-10 14:07:47 -0500
commit8a790033073e005b41140b5c38a4eaada321c2f1 (patch)
tree99db3292123ad27769db0649cf4516ed3e51c31b /libc
parenta066f71e70b9cbfdc2f2eb41e7c4d8372d216a6e (diff)
downloadllvm-8a790033073e005b41140b5c38a4eaada321c2f1.zip
llvm-8a790033073e005b41140b5c38a4eaada321c2f1.tar.gz
llvm-8a790033073e005b41140b5c38a4eaada321c2f1.tar.bz2
[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.
Diffstat (limited to 'libc')
-rw-r--r--libc/utils/gpu/loader/Loader.h1
-rw-r--r--libc/utils/gpu/server/CMakeLists.txt4
-rw-r--r--libc/utils/gpu/server/llvmlibc_rpc_server.h4
-rw-r--r--libc/utils/gpu/server/rpc_server.cpp10
4 files changed, 11 insertions, 8 deletions
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 <cstddef>
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 <stdint.h>
-#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 <uint32_t lane_size>
rpc_status_t handle_server_impl(
rpc::Server &server,
- const std::unordered_map<rpc_opcode_t, rpc_opcode_callback_ty> &callbacks,
- const std::unordered_map<rpc_opcode_t, void *> &callback_data,
+ const std::unordered_map<uint16_t, rpc_opcode_callback_ty> &callbacks,
+ const std::unordered_map<uint16_t, void *> &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<rpc_opcode_t, rpc_opcode_callback_ty> callbacks;
- std::unordered_map<rpc_opcode_t, void *> callback_data;
+ std::unordered_map<uint16_t, rpc_opcode_callback_ty> callbacks;
+ std::unordered_map<uint16_t, void *> 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)