Skip to content

Commit

Permalink
Revert "[Libomptarget] Check errors when synchronizing the async queue"
Browse files Browse the repository at this point in the history
This reverts commit 8617091.

Reverting this to reland as it will make it easier to backport.
  • Loading branch information
jhuber6 committed Feb 16, 2023
1 parent 53862b5 commit 48c8e16
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
5 changes: 2 additions & 3 deletions openmp/libomptarget/include/omptarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <cstdint>
#include <deque>
#include <functional>
#include <optional>
#include <stddef.h>
#include <stdint.h>
#include <type_traits>
Expand Down Expand Up @@ -248,8 +247,8 @@ class AsyncInfoTy {
/// functions will be executed once and unregistered afterwards.
///
/// \returns true if there is no pending asynchronous operations, false
/// otherwise. We return a null value in the case of an error from the plugin.
std::optional<bool> isDone();
/// otherwise.
bool isDone();

/// Add a new post-processing function to be executed after synchronization.
///
Expand Down
5 changes: 1 addition & 4 deletions openmp/libomptarget/src/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,9 @@ EXTERN void __tgt_target_nowait_query(void **AsyncHandle) {
if (QueryCounter.isAboveThreshold())
AsyncInfo->SyncType = AsyncInfoTy::SyncTy::BLOCKING;

auto DoneOrErr = AsyncInfo->isDone();
if (!DoneOrErr)
FATAL_MESSAGE0(1, "Error while synchronizing the async queue\n");
// If there are device operations still pending, return immediately without
// deallocating the handle and increase the current thread query count.
if (!*DoneOrErr) {
if (!AsyncInfo->isDone()) {
QueryCounter.increment();
return;
}
Expand Down
6 changes: 2 additions & 4 deletions openmp/libomptarget/src/omptarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ void *&AsyncInfoTy::getVoidPtrLocation() {
return BufferLocations.back();
}

std::optional<bool> AsyncInfoTy::isDone() {
if (int Result = synchronize())
return std::nullopt;

bool AsyncInfoTy::isDone() {
synchronize();
// The async info operations are completed when the internal queue is empty.
return isQueueEmpty();
}
Expand Down
5 changes: 1 addition & 4 deletions openmp/libomptarget/src/private.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,9 @@ class TaskAsyncInfoWrapperTy {
if (AsyncInfo == &LocalAsyncInfo)
return;

auto DoneOrErr = AsyncInfo->isDone();
if (!DoneOrErr)
FATAL_MESSAGE0(1, "Error while synchronizing the async queue\n");
// If the are device operations still pending, return immediately without
// deallocating the handle.
if (!*DoneOrErr)
if (!AsyncInfo->isDone())
return;

// Delete the handle and unset it from the OpenMP task data.
Expand Down

0 comments on commit 48c8e16

Please sign in to comment.