diff options
| author | Joseph Huber <huberjn@outlook.com> | 2024-11-27 14:57:52 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-27 14:57:52 -0600 |
| commit | 1d810ece2b2c8fab77720493864257f0ea3336a9 (patch) | |
| tree | b6f354ad827721daadd2d9bc8fe876ce03111317 /offload/plugins-nextgen/common/src/RPC.cpp | |
| parent | 89d8e70031189eacb915beae2ffc642c0de1ec1a (diff) | |
[libc] Move libc server handlers to a shared header (#117908)
Summary:
We can simply include this header from the shared directory now and do
not need to have this level of indirection. Simply stash it with the
other libc opcode handlers.
If we were able to move the printf handlers to the shared directory then
this could just be a header as well, which would HEAVILY simplify the
mess associated with building the RPC server first in the projects
build, then copying it to the runtimes build.
Diffstat (limited to 'offload/plugins-nextgen/common/src/RPC.cpp')
| -rw-r--r-- | offload/plugins-nextgen/common/src/RPC.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/offload/plugins-nextgen/common/src/RPC.cpp b/offload/plugins-nextgen/common/src/RPC.cpp index 9913961a37d2..c35431da69eb 100644 --- a/offload/plugins-nextgen/common/src/RPC.cpp +++ b/offload/plugins-nextgen/common/src/RPC.cpp @@ -14,7 +14,6 @@ // TODO: This should be included unconditionally and cleaned up. #if defined(LIBOMPTARGET_RPC_SUPPORT) -#include "llvmlibc_rpc_server.h" #include "shared/rpc.h" #include "shared/rpc_opcodes.h" #endif @@ -74,21 +73,21 @@ Error RPCServerTy::runServer(plugin::GenericDeviceTy &Device) { std::min(Device.requestedRPCPortCount(), rpc::MAX_PORT_COUNT); rpc::Server Server(NumPorts, Buffers[Device.getDeviceId()]); - auto port = Server.try_open(Device.getWarpSize()); - if (!port) + auto Port = Server.try_open(Device.getWarpSize()); + if (!Port) return Error::success(); int Status = rpc::SUCCESS; - switch (port->get_opcode()) { + switch (Port->get_opcode()) { case RPC_MALLOC: { - port->recv_and_send([&](rpc::Buffer *Buffer, uint32_t) { + Port->recv_and_send([&](rpc::Buffer *Buffer, uint32_t) { Buffer->data[0] = reinterpret_cast<uintptr_t>(Device.allocate( Buffer->data[0], nullptr, TARGET_ALLOC_DEVICE_NON_BLOCKING)); }); break; } case RPC_FREE: { - port->recv([&](rpc::Buffer *Buffer, uint32_t) { + Port->recv([&](rpc::Buffer *Buffer, uint32_t) { Device.free(reinterpret_cast<void *>(Buffer->data[0]), TARGET_ALLOC_DEVICE_NON_BLOCKING); }); @@ -96,10 +95,10 @@ Error RPCServerTy::runServer(plugin::GenericDeviceTy &Device) { } default: // Let the `libc` library handle any other unhandled opcodes. - Status = libc_handle_rpc_port(&*port, Device.getWarpSize()); + Status = handle_libc_opcodes(*Port, Device.getWarpSize()); break; } - port->close(); + Port->close(); if (Status != rpc::SUCCESS) return createStringError("RPC server given invalid opcode!"); |
