We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 187f296 commit aa6f591Copy full SHA for aa6f591
offload/plugins-nextgen/cuda/src/rtl.cpp
@@ -914,9 +914,19 @@ struct CUDADeviceTy : public GenericDeviceTy {
914
return Plugin::check(Res, "error in cuStreamWaitEvent: %s");
915
}
916
917
- // TODO: This should be implementable on CUDA
918
Expected<bool> hasPendingWorkImpl(AsyncInfoWrapperTy &AsyncInfo) override {
919
- return true;
+ CUstream Stream;
+ if (auto Err = getStream(AsyncInfo, Stream))
920
+ return Err;
921
+
922
+ CUresult Ret = cuStreamQuery(Stream);
923
+ if (Ret == CUDA_SUCCESS)
924
+ return false;
925
926
+ if (Ret == CUDA_ERROR_NOT_READY)
927
+ return true;
928
929
+ return Plugin::check(Ret, "error in cuStreamQuery: %s");
930
931
932
/// Synchronize the current thread with the event.
0 commit comments