[libc] [llvm] [libc] Move libc server handlers to a shared header (PR #117908)
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 27 12:30:17 PST 2024
================
@@ -79,32 +78,32 @@ 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);
});
break;
}
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();
----------------
shiltian wrote:
and then this becomes `Port`?
https://github.com/llvm/llvm-project/pull/117908
More information about the llvm-commits
mailing list