[libc-commits] [PATCH] D154112: [libc] Fix the implementation of exit on the GPU
Joseph Huber via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Jun 29 11:22:40 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG667c10353e87: [libc] Fix the implementation of exit on the GPU (authored by jhuber6).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154112/new/
https://reviews.llvm.org/D154112
Files:
libc/docs/gpu/support.rst
libc/src/__support/OSUtil/gpu/quick_exit.cpp
libc/utils/gpu/server/rpc_server.cpp
Index: libc/utils/gpu/server/rpc_server.cpp
===================================================================
--- libc/utils/gpu/server/rpc_server.cpp
+++ libc/utils/gpu/server/rpc_server.cpp
@@ -102,6 +102,8 @@
break;
}
case RPC_EXIT: {
+ // Send a response to the client to signal that we are ready to exit.
+ port->recv_and_send([](rpc::Buffer *) {});
port->recv([](rpc::Buffer *buffer) {
int status = 0;
std::memcpy(&status, buffer->data, sizeof(int));
Index: libc/src/__support/OSUtil/gpu/quick_exit.cpp
===================================================================
--- libc/src/__support/OSUtil/gpu/quick_exit.cpp
+++ libc/src/__support/OSUtil/gpu/quick_exit.cpp
@@ -17,7 +17,9 @@
namespace __llvm_libc {
void quick_exit(int status) {
+ // We want to first make sure the server is listening before we exit.
rpc::Client::Port port = rpc::client.open<RPC_EXIT>();
+ port.send_and_recv([](rpc::Buffer *) {}, [](rpc::Buffer *) {});
port.send([&](rpc::Buffer *buffer) {
reinterpret_cast<uint32_t *>(buffer->data)[0] = status;
});
Index: libc/docs/gpu/support.rst
===================================================================
--- libc/docs/gpu/support.rst
+++ libc/docs/gpu/support.rst
@@ -89,6 +89,7 @@
atof |check|
atol |check|
atoll |check|
+exit |check| |check|
labs |check|
llabs |check|
strtod |check|
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154112.535930.patch
Type: text/x-patch
Size: 1469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230629/868f3bcb/attachment-0001.bin>
More information about the libc-commits
mailing list