diff options
Diffstat (limited to 'libc')
-rw-r--r-- | libc/utils/gpu/loader/amdgpu/Loader.cpp | 4 | ||||
-rw-r--r-- | libc/utils/gpu/loader/nvptx/Loader.cpp | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/libc/utils/gpu/loader/amdgpu/Loader.cpp b/libc/utils/gpu/loader/amdgpu/Loader.cpp index eab3d6a00079..a98b557b877c 100644 --- a/libc/utils/gpu/loader/amdgpu/Loader.cpp +++ b/libc/utils/gpu/loader/amdgpu/Loader.cpp @@ -221,6 +221,10 @@ hsa_status_t launch_kernel(hsa_agent_t dev_agent, hsa_executable_t executable, /*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); diff --git a/libc/utils/gpu/loader/nvptx/Loader.cpp b/libc/utils/gpu/loader/nvptx/Loader.cpp index fc30274163dc..7879deea65a0 100644 --- a/libc/utils/gpu/loader/nvptx/Loader.cpp +++ b/libc/utils/gpu/loader/nvptx/Loader.cpp @@ -186,6 +186,10 @@ CUresult launch_kernel(CUmodule binary, CUstream stream, 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; } |