Skip to content

Commit

Permalink
[OpenMP] Disable libomptarget integration on unsupported platforms
Browse files Browse the repository at this point in the history
Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D140419
  • Loading branch information
GuilhermeValarini committed Dec 20, 2022
1 parent 3d2aa54 commit 4e32d5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions openmp/runtime/src/kmp_config.h.cmake
Expand Up @@ -94,6 +94,8 @@
#define KMP_HAVE_POSIX_MEMALIGN LIBOMP_HAVE_POSIX_MEMALIGN
#cmakedefine01 LIBOMP_HAVE__ALIGNED_MALLOC
#define KMP_HAVE__ALIGNED_MALLOC LIBOMP_HAVE__ALIGNED_MALLOC
#cmakedefine01 OPENMP_ENABLE_LIBOMPTARGET
#define ENABLE_LIBOMPTARGET OPENMP_ENABLE_LIBOMPTARGET

// Configured cache line based on architecture
#if KMP_ARCH_PPC64
Expand Down
7 changes: 6 additions & 1 deletion openmp/runtime/src/kmp_tasking.cpp
Expand Up @@ -21,8 +21,10 @@
#include "ompt-specific.h"
#endif

#if ENABLE_LIBOMPTARGET
// Declaration of synchronization function from libomptarget.
extern "C" void __tgt_target_nowait_query(void **) KMP_WEAK_ATTRIBUTE_INTERNAL;
#endif

/* forward declaration */
static void __kmp_enable_tasking(kmp_task_team_t *task_team,
Expand Down Expand Up @@ -1798,12 +1800,15 @@ static void __kmp_invoke_task(kmp_int32 gtid, kmp_task_t *task,
KMP_FSYNC_ACQUIRED(taskdata); // acquired self (new task)
#endif

#if ENABLE_LIBOMPTARGET
if (taskdata->td_target_data.async_handle != NULL) {
// If we have a valid target async handle, that means that we have already
// executed the task routine once. We must query for the handle completion
// instead of re-executing the routine.
__tgt_target_nowait_query(&taskdata->td_target_data.async_handle);
} else if (task->routine != NULL) {
} else
#endif
if (task->routine != NULL) {
#ifdef KMP_GOMP_COMPAT
if (taskdata->td_flags.native) {
((void (*)(void *))(*(task->routine)))(task->shareds);
Expand Down

0 comments on commit 4e32d5c

Please sign in to comment.