[Openmp-commits] [openmp] 8a79003 - [libc] Move RPC opcodes include out of the header
Joseph Huber via Openmp-commits
openmp-commits at lists.llvm.org
Sun Mar 10 12:07:54 PDT 2024
Author: Joseph Huber
Date: 2024-03-10T14:07:47-05:00
New Revision: 8a790033073e005b41140b5c38a4eaada321c2f1
URL: https://github.com/llvm/llvm-project/commit/8a790033073e005b41140b5c38a4eaada321c2f1
DIFF: https://github.com/llvm/llvm-project/commit/8a790033073e005b41140b5c38a4eaada321c2f1.diff
LOG: [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.
Added:
Modified:
libc/utils/gpu/loader/Loader.h
libc/utils/gpu/server/CMakeLists.txt
libc/utils/gpu/server/llvmlibc_rpc_server.h
libc/utils/gpu/server/rpc_server.cpp
openmp/libomptarget/plugins-nextgen/common/src/RPC.cpp
Removed:
################################################################################
diff --git a/libc/utils/gpu/loader/Loader.h b/libc/utils/gpu/loader/Loader.h
index cffbaa673afd37..93380383701978 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 8712f24de84f7b..10cfdb45a2c9d2 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 f1a8fe06281cbf..b7f2a463b1f5c8 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 2c8186c13ffac6..90af1569c4c53b 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)
diff --git a/openmp/libomptarget/plugins-nextgen/common/src/RPC.cpp b/openmp/libomptarget/plugins-nextgen/common/src/RPC.cpp
index 05ae5acb01ddfc..f46b27701b5b91 100644
--- a/openmp/libomptarget/plugins-nextgen/common/src/RPC.cpp
+++ b/openmp/libomptarget/plugins-nextgen/common/src/RPC.cpp
@@ -13,6 +13,7 @@
#include "PluginInterface.h"
#if defined(LIBOMPTARGET_RPC_SUPPORT)
+#include "llvm-libc-types/rpc_opcodes_t.h"
#include "llvmlibc_rpc_server.h"
#endif
More information about the Openmp-commits
mailing list