[Openmp-commits] [openmp] r366810 - [libomptarget] Handle offload policy in push_tripcount

Jonas Hahnfeld via Openmp-commits openmp-commits at lists.llvm.org
Tue Jul 23 07:20:48 PDT 2019

Author: hahnfeld
Date: Tue Jul 23 07:20:48 2019
New Revision: 366810

URL: http://llvm.org/viewvc/llvm-project?rev=366810&view=rev
[libomptarget] Handle offload policy in push_tripcount

If the first target region in a program calls the push_tripcount
function, libomptarget didn't handle the offload policy correctly.
This could lead to unexpected error messages as seen in

To solve this, add a check calling IsOffloadDisabled() as all other
entry points already do. If this method returns false, libomptarget
is effectively disabled.

Differential Revision: https://reviews.llvm.org/D64626


Modified: openmp/trunk/libomptarget/src/interface.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/libomptarget/src/interface.cpp?rev=366810&r1=366809&r2=366810&view=diff
--- openmp/trunk/libomptarget/src/interface.cpp (original)
+++ openmp/trunk/libomptarget/src/interface.cpp Tue Jul 23 07:20:48 2019
@@ -306,6 +306,9 @@ EXTERN int __tgt_target_teams_nowait(int
 EXTERN void __kmpc_push_target_tripcount(int64_t device_id,
     uint64_t loop_tripcount) {
+  if (IsOffloadDisabled())
+    return;
   if (device_id == OFFLOAD_DEVICE_DEFAULT) {
     device_id = omp_get_default_device();

More information about the Openmp-commits mailing list