Skip to content

libc: Prefix RPC Status code to avoid conflict in windows build #119991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions libc/shared/rpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ namespace rpc {

/// Generic codes that can be used whem implementing the server.
enum Status {
SUCCESS = 0x0,
ERROR = 0x1000,
UNHANDLED_OPCODE = 0x1001,
RPC_SUCCESS = 0x0,
RPC_ERROR = 0x1000,
RPC_UNHANDLED_OPCODE = 0x1001,
};

/// A fixed size channel used to communicate between the RPC client and server.
Expand Down
4 changes: 2 additions & 2 deletions libc/utils/gpu/loader/Loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ inline uint32_t handle_server(rpc::Server &server, uint32_t index,
return 0;
index = port->get_index() + 1;

int status = rpc::SUCCESS;
int status = rpc::RPC_SUCCESS;
switch (port->get_opcode()) {
case RPC_TEST_INCREMENT: {
port->recv_and_send([](rpc::Buffer *buffer, uint32_t) {
Expand Down Expand Up @@ -186,7 +186,7 @@ inline uint32_t handle_server(rpc::Server &server, uint32_t index,
}

// Handle all of the `libc` specific opcodes.
if (status != rpc::SUCCESS)
if (status != rpc::RPC_SUCCESS)
handle_error("Error handling RPC server");

port->close();
Expand Down
6 changes: 3 additions & 3 deletions libc/utils/gpu/server/rpc_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,10 @@ rpc::Status handle_port_impl(rpc::Server::Port &port) {
break;
}
default:
return rpc::UNHANDLED_OPCODE;
return rpc::RPC_UNHANDLED_OPCODE;
}

return rpc::SUCCESS;
return rpc::RPC_SUCCESS;
}

namespace rpc {
Expand All @@ -455,7 +455,7 @@ rpc::Status handle_libc_opcodes(rpc::Server::Port &port, uint32_t num_lanes) {
case 64:
return handle_port_impl<64>(port);
default:
return rpc::ERROR;
return rpc::RPC_ERROR;
}
}
} // namespace rpc
10 changes: 5 additions & 5 deletions offload/plugins-nextgen/common/src/RPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ rpc::Status handle_offload_opcodes(plugin::GenericDeviceTy &Device,
break;
}
default:
return rpc::UNHANDLED_OPCODE;
return rpc::RPC_UNHANDLED_OPCODE;
break;
}
return rpc::SUCCESS;
return rpc::RPC_SUCCESS;
}

static rpc::Status handle_offload_opcodes(plugin::GenericDeviceTy &Device,
Expand All @@ -72,7 +72,7 @@ static rpc::Status handle_offload_opcodes(plugin::GenericDeviceTy &Device,
else if (NumLanes == 64)
return handle_offload_opcodes<64>(Device, Port);
else
return rpc::ERROR;
return rpc::RPC_ERROR;
}

RPCServerTy::RPCServerTy(plugin::GenericPluginTy &Plugin)
Expand Down Expand Up @@ -125,12 +125,12 @@ Error RPCServerTy::runServer(plugin::GenericDeviceTy &Device) {

// Let the `libc` library handle any other unhandled opcodes.
#ifdef LIBOMPTARGET_RPC_SUPPORT
if (Status == rpc::UNHANDLED_OPCODE)
if (Status == rpc::RPC_UNHANDLED_OPCODE)
Status = handle_libc_opcodes(*Port, Device.getWarpSize());
#endif

Port->close();
if (Status != rpc::SUCCESS)
if (Status != rpc::RPC_SUCCESS)
return createStringError("RPC server given invalid opcode!");

return Error::success();
Expand Down
Loading