This is an archive of the discontinued LLVM Phabricator instance.

[Libomptarget] Check errors when synchronizing the async queue
ClosedPublic

Authored by jhuber6 on Feb 16 2023, 7:53 AM.

Details

Summary

Currently when we synchronize the asynchronous queue for the plugins, we
ignore the return value. This is problematic because we will continue on
like nothing happened if the kernel fails.

Fixes https://github.com/llvm/llvm-project/issues/60814

Diff Detail

Event Timeline

jhuber6 created this revision.Feb 16 2023, 7:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2023, 7:53 AM
jhuber6 requested review of this revision.Feb 16 2023, 7:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2023, 7:53 AM
jdoerfert accepted this revision.Feb 16 2023, 8:00 AM

LG, one nit.

openmp/libomptarget/include/omptarget.h
250–251

docs plz

This revision is now accepted and ready to land.Feb 16 2023, 8:00 AM
jhuber6 updated this revision to Diff 498026.Feb 16 2023, 8:05 AM

Add line for the error.

ye-luo added inline comments.Feb 16 2023, 8:12 AM
openmp/libomptarget/src/interface.cpp
415

Prefer DoneStatusOrError. Unclear how DoneOrErr encapsulate NotDones state.

416
if (!DoneOrErr.has_value()) can be more readable.
openmp/libomptarget/src/omptarget.cpp
55

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;
ye-luo added inline comments.Feb 16 2023, 11:47 AM
openmp/libomptarget/src/interface.cpp
415

Changed my mind. Shorter name is fine.

openmp/libomptarget/src/omptarget.cpp
55

Got unhappy GNU.

/home/yeluo/opt/llvm-clang/llvm-project/openmp/libomptarget/src/omptarget.cpp: In member function 'std::optional<bool> AsyncInfoTy::isDone()':
/home/yeluo/opt/llvm-clang/llvm-project/openmp/libomptarget/src/omptarget.cpp:55:11: warning: unused variable 'Result' [-Wunused-variable]
   55 |   if (int Result = synchronize())
openmp/libomptarget/src/private.h
255

This message confused me "Error while query the async queue completion.\n"