[Openmp-commits] [PATCH] D44522: [Libomptarget] Behavior of library upon target offload failure

George Rokos via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Mar 15 09:17:34 PDT 2018

grokos created this revision.
grokos added reviewers: Hahnfeld, jlpeyton, jhen, RaviNarayanaswamy.
grokos added a project: OpenMP.

This patch regulates the library's behavior in case of offload failure.

1. It is OK to always fail as we can safely fall back to the host, since data on the host is up to date (no kernel has run on the device, so data has not been modified). In this case libomptarget prints a warning so that the user knows we have fallen back to the host. The warning is printed unconditionally, independently from debug/release configuration or the value of `LIBOMPTARGET_DEBUG`.
2. It is not OK to succeed at first and then fail, as the most up to date data might be on the device, so falling back to the host is not guaranteed to yield correct results. In case we have had even one successful target execution and a subsequent target region fails to run on the device, the library terminates the program due to possible inconsistency of data. A corresponding warning is printed unconditionally.

Following requests from developers, I am also introducing a new environment variable `LIBOMPTARGET_FORCE_TERMINATION` which overrides the above behavior and forces program termination upon target offload failure even for the very first kernel (i.e. the user dictates that it is not OK to always fail).

  rOMP OpenMP



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44522.138572.patch
Type: text/x-patch
Size: 5955 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20180315/67dd13ad/attachment-0001.bin>

More information about the Openmp-commits mailing list