[libc-commits] [PATCH] D150456: [libc] Check the RPC server once again after the kernel exits
Joseph Huber via Phabricator via libc-commits
libc-commits at lists.llvm.org
Fri May 12 09:35:57 PDT 2023
jhuber6 created this revision.
jhuber6 added reviewers: tianshilei1992, JonChesterfield, sivachandra, michaelrj, lntue.
Herald added subscribers: libc-commits, mattd, asavonic, ecnelises, kerbowa, tschuett, jvesely.
Herald added projects: libc-project, All.
jhuber6 requested review of this revision.
We support asynchronous sends, that means that the kernel can issue a
send, then exit the kernel as we do with the `EXIT` syscall. Because of
the condition it's therefore possible for the kernel to exit and break
from the loop before we check the server again. This can potentially
cause us to ignore an `EXIT` call from the GPU.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D150456
Files:
libc/utils/gpu/loader/amdgpu/Loader.cpp
libc/utils/gpu/loader/nvptx/Loader.cpp
Index: libc/utils/gpu/loader/nvptx/Loader.cpp
===================================================================
--- libc/utils/gpu/loader/nvptx/Loader.cpp
+++ libc/utils/gpu/loader/nvptx/Loader.cpp
@@ -186,6 +186,10 @@
while (cuStreamQuery(stream) == CUDA_ERROR_NOT_READY)
handle_server();
+ // Handle the server one more time in case the kernel exited with a pending
+ // send still in flight.
+ handle_server();
+
return CUDA_SUCCESS;
}
Index: libc/utils/gpu/loader/amdgpu/Loader.cpp
===================================================================
--- libc/utils/gpu/loader/amdgpu/Loader.cpp
+++ libc/utils/gpu/loader/amdgpu/Loader.cpp
@@ -221,6 +221,10 @@
/*timeout_hint=*/1024, HSA_WAIT_STATE_ACTIVE) != 0)
handle_server();
+ // Handle the server one more time in case the kernel exited with a pending
+ // send still in flight.
+ handle_server();
+
// Destroy the resources acquired to launch the kernel and return.
if (hsa_status_t err = hsa_amd_memory_pool_free(args))
handle_error(err);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150456.521689.patch
Type: text/x-patch
Size: 1055 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230512/5d6bfe04/attachment.bin>
More information about the libc-commits
mailing list