diff options
Diffstat (limited to 'offload/libomptarget/OpenMP/API.cpp')
-rw-r--r-- | offload/libomptarget/OpenMP/API.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/offload/libomptarget/OpenMP/API.cpp b/offload/libomptarget/OpenMP/API.cpp index 4576f9b..b0f0573 100644 --- a/offload/libomptarget/OpenMP/API.cpp +++ b/offload/libomptarget/OpenMP/API.cpp @@ -16,6 +16,7 @@ #include "rtl.h" #include "OpenMP/InternalTypes.h" +#include "OpenMP/InteropAPI.h" #include "OpenMP/Mapping.h" #include "OpenMP/OMPT/Interface.h" #include "OpenMP/omp.h" @@ -683,3 +684,21 @@ EXTERN void *omp_get_mapped_ptr(const void *Ptr, int DeviceNum) { return TPR.TargetPointer; } + +// This routine gets called from the Host RTL at sync points (taskwait, barrier, +// ...) so we can synchronize the necessary objects from the offload side. +EXTERN void __tgt_target_sync(ident_t *loc_ref, int gtid, void *current_task, + void *event) { + if (!RTLAlive) + return; + + RTLOngoingSyncs++; + if (!RTLAlive) { + RTLOngoingSyncs--; + return; + } + + syncImplicitInterops(gtid, event); + + RTLOngoingSyncs--; +} |