[Openmp-commits] [PATCH] D144191: [Libomptarget] Check errors when synchronizing the async queue

Ye Luo via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Feb 16 08:12:15 PST 2023


ye-luo added inline comments.


================
Comment at: openmp/libomptarget/src/interface.cpp:415
 
+  auto DoneOrErr = AsyncInfo->isDone();
+  if (!DoneOrErr)
----------------
Prefer DoneStatusOrError. Unclear how DoneOrErr encapsulate NotDones state.


================
Comment at: openmp/libomptarget/src/interface.cpp:416
+  auto DoneOrErr = AsyncInfo->isDone();
+  if (!DoneOrErr)
+    FATAL_MESSAGE0(1, "Error while synchronizing the async queue\n");
----------------
  if (!DoneOrErr.has_value()) can be more readable.


================
Comment at: openmp/libomptarget/src/omptarget.cpp:55
+std::optional<bool> AsyncInfoTy::isDone() {
+  if (int Result = synchronize())
+    return std::nullopt;
----------------
synchronize returns OFFLOAD_SUCCESS which has value 0.
quite hard to get through this logic by just reading the above line.
Why not 
```
if (synchronize() == OFFLOAD_SUCCESS)
  return isQueueEmpty();
return std::nullopt;
```



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144191/new/

https://reviews.llvm.org/D144191



More information about the Openmp-commits mailing list