File tree Expand file tree Collapse file tree 4 files changed +16
-6
lines changed
Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 1717#include < cstdint>
1818#include < deque>
1919#include < functional>
20+ #include < optional>
2021#include < stddef.h>
2122#include < stdint.h>
2223#include < type_traits>
@@ -247,8 +248,8 @@ class AsyncInfoTy {
247248 // / functions will be executed once and unregistered afterwards.
248249 // /
249250 // / \returns true if there is no pending asynchronous operations, false
250- // / otherwise.
251- bool isDone ();
251+ // / otherwise. We return a null value in the case of an error from the plugin.
252+ std::optional< bool > isDone ();
252253
253254 // / Add a new post-processing function to be executed after synchronization.
254255 // /
Original file line number Diff line number Diff line change @@ -412,9 +412,12 @@ EXTERN void __tgt_target_nowait_query(void **AsyncHandle) {
412412 if (QueryCounter.isAboveThreshold ())
413413 AsyncInfo->SyncType = AsyncInfoTy::SyncTy::BLOCKING;
414414
415+ auto DoneOrErr = AsyncInfo->isDone ();
416+ if (!DoneOrErr)
417+ FATAL_MESSAGE0 (1 , " Error while querying the async queue for completion.\n " );
415418 // If there are device operations still pending, return immediately without
416419 // deallocating the handle and increase the current thread query count.
417- if (!AsyncInfo-> isDone () ) {
420+ if (!*DoneOrErr ) {
418421 QueryCounter.increment ();
419422 return ;
420423 }
Original file line number Diff line number Diff line change @@ -51,8 +51,10 @@ void *&AsyncInfoTy::getVoidPtrLocation() {
5151 return BufferLocations.back ();
5252}
5353
54- bool AsyncInfoTy::isDone () {
55- synchronize ();
54+ std::optional<bool > AsyncInfoTy::isDone () {
55+ if (synchronize () == OFFLOAD_FAIL)
56+ return std::nullopt ;
57+
5658 // The async info operations are completed when the internal queue is empty.
5759 return isQueueEmpty ();
5860}
Original file line number Diff line number Diff line change @@ -250,9 +250,13 @@ class TaskAsyncInfoWrapperTy {
250250 if (AsyncInfo == &LocalAsyncInfo)
251251 return ;
252252
253+ auto DoneOrErr = AsyncInfo->isDone ();
254+ if (!DoneOrErr)
255+ FATAL_MESSAGE0 (1 ,
256+ " Error while querying the async queue for completion.\n " );
253257 // If the are device operations still pending, return immediately without
254258 // deallocating the handle.
255- if (!AsyncInfo-> isDone () )
259+ if (!*DoneOrErr )
256260 return ;
257261
258262 // Delete the handle and unset it from the OpenMP task data.
You can’t perform that action at this time.
0 commit comments