[all-commits] [llvm/llvm-project] 0f88be: [Libomptarget] Fix Nvidia offloading hanging on da...
Joseph Huber via All-commits
all-commits at lists.llvm.org
Tue Sep 26 14:03:49 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0f88be77ea59360ae43f4e5683e23f7edce6aceb
https://github.com/llvm/llvm-project/commit/0f88be77ea59360ae43f4e5683e23f7edce6aceb
Author: Joseph Huber <35342157+jhuber6 at users.noreply.github.com>
Date: 2023-09-26 (Tue, 26 Sep 2023)
Changed paths:
M openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp
A openmp/libomptarget/test/libc/fwrite.c
Log Message:
-----------
[Libomptarget] Fix Nvidia offloading hanging on dataRetrieve using RPC (#66817)
Summary:
The RPC server is responsible for providing host services from the GPU.
Generally, the client running on the GPU will spin in place until the
host checks the server. Inside the runtime, we elected to have the user
thread do this checking while it would be otherwise waiting for the
kernel to finish. However, for Nvidia this caused problems when
offloading to a target region that requires a copy back.
This is caused by the implementation of `dataRetrieve` on Nvidia. We
initialize an asynchronous copy-back on the same stream that the kernel
is running on. This creates an implicit sync on the kernel to finish
before we issue the D2H copy, which we then wait on. This implicit sync
happens inside of the CUDA runtime. This is problematic when running the
RPC server because we need someone to check the RPC server. If no one
checks the RPC server then the kernel will never finish, meaning that
the memcpy will never be issued and the program hangs. This patch adds
an explicit check for unfinished work on the stream and waits for it to
complete.
More information about the All-commits
mailing list