Skip to content

Commit 8a79003

Browse files
committed
[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.
1 parent a066f71 commit 8a79003

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

libc/utils/gpu/loader/Loader.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "utils/gpu/server/llvmlibc_rpc_server.h"
1313

14+
#include "llvm-libc-types/rpc_opcodes_t.h"
1415
#include "include/llvm-libc-types/test_rpc_opcodes_t.h"
1516

1617
#include <cstddef>

libc/utils/gpu/server/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ endif()
2424
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/llvmlibc_rpc_server.h
2525
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
2626
COMPONENT libc-headers)
27+
install(FILES ${LIBC_SOURCE_DIR}/include/llvm-libc-types/rpc_opcodes_t.h
28+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
29+
RENAME llvmlibc_rpc_opcodes.h
30+
COMPONENT libc-headers)
2731
install(TARGETS llvmlibc_rpc_server
2832
ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}"
2933
COMPONENT libc)

libc/utils/gpu/server/llvmlibc_rpc_server.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
#include <stdint.h>
1313

14-
#include "llvm-libc-types/rpc_opcodes_t.h"
15-
1614
#ifdef __cplusplus
1715
extern "C" {
1816
#endif
@@ -84,7 +82,7 @@ rpc_status_t rpc_handle_server(uint32_t device_id);
8482
/// Register a callback to handle an opcode from the RPC client. The associated
8583
/// data must remain accessible as long as the user intends to handle the server
8684
/// with this callback.
87-
rpc_status_t rpc_register_callback(uint32_t device_id, rpc_opcode_t opcode,
85+
rpc_status_t rpc_register_callback(uint32_t device_id, uint16_t opcode,
8886
rpc_opcode_callback_ty callback, void *data);
8987

9088
/// Obtain a pointer to a local client buffer that can be copied directly to the

libc/utils/gpu/server/rpc_server.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ static_assert(RPC_MAXIMUM_PORT_COUNT == rpc::MAX_PORT_COUNT,
3030
template <uint32_t lane_size>
3131
rpc_status_t handle_server_impl(
3232
rpc::Server &server,
33-
const std::unordered_map<rpc_opcode_t, rpc_opcode_callback_ty> &callbacks,
34-
const std::unordered_map<rpc_opcode_t, void *> &callback_data,
33+
const std::unordered_map<uint16_t, rpc_opcode_callback_ty> &callbacks,
34+
const std::unordered_map<uint16_t, void *> &callback_data,
3535
uint32_t &index) {
3636
auto port = server.try_open(lane_size, index);
3737
if (!port)
@@ -239,8 +239,8 @@ struct Device {
239239
void *buffer;
240240
rpc::Server server;
241241
rpc::Client client;
242-
std::unordered_map<rpc_opcode_t, rpc_opcode_callback_ty> callbacks;
243-
std::unordered_map<rpc_opcode_t, void *> callback_data;
242+
std::unordered_map<uint16_t, rpc_opcode_callback_ty> callbacks;
243+
std::unordered_map<uint16_t, void *> callback_data;
244244
};
245245

246246
// 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) {
335335
}
336336
}
337337

338-
rpc_status_t rpc_register_callback(uint32_t device_id, rpc_opcode_t opcode,
338+
rpc_status_t rpc_register_callback(uint32_t device_id, uint16_t opcode,
339339
rpc_opcode_callback_ty callback,
340340
void *data) {
341341
if (!state)

openmp/libomptarget/plugins-nextgen/common/src/RPC.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "PluginInterface.h"
1414

1515
#if defined(LIBOMPTARGET_RPC_SUPPORT)
16+
#include "llvm-libc-types/rpc_opcodes_t.h"
1617
#include "llvmlibc_rpc_server.h"
1718
#endif
1819

0 commit comments

Comments
 (0)