diff --git a/openmp/runtime/src/kmp_gsupport.cpp b/openmp/runtime/src/kmp_gsupport.cpp --- a/openmp/runtime/src/kmp_gsupport.cpp +++ b/openmp/runtime/src/kmp_gsupport.cpp @@ -1891,6 +1891,9 @@ kmp_depend_info_t dep_list[ndeps]; for (kmp_int32 i = 0; i < ndeps; i++) dep_list[i] = gomp_depends.get_kmp_depend(i); +#if OMPT_SUPPORT + OMPT_STORE_RETURN_ADDRESS(gtid); +#endif __kmpc_omp_wait_deps(&loc, gtid, ndeps, dep_list, 0, NULL); KA_TRACE(20, ("GOMP_taskwait_depend exit: T#%d\n", gtid)); } diff --git a/openmp/runtime/src/kmp_taskdeps.cpp b/openmp/runtime/src/kmp_taskdeps.cpp --- a/openmp/runtime/src/kmp_taskdeps.cpp +++ b/openmp/runtime/src/kmp_taskdeps.cpp @@ -520,7 +520,6 @@ #if OMPT_SUPPORT if (ompt_enabled.enabled) { - OMPT_STORE_RETURN_ADDRESS(gtid); if (!current_task->ompt_task_info.frame.enter_frame.ptr) current_task->ompt_task_info.frame.enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0); @@ -531,7 +530,7 @@ current_task ? &(current_task->ompt_task_info.frame) : NULL, &(new_taskdata->ompt_task_info.task_data), ompt_task_explicit | TASK_TYPE_DETAILS_FORMAT(new_taskdata), 1, - OMPT_LOAD_RETURN_ADDRESS(gtid)); + OMPT_LOAD_OR_GET_RETURN_ADDRESS(gtid)); } new_taskdata->ompt_task_info.frame.enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0); @@ -700,7 +699,7 @@ current_task ? &(current_task->ompt_task_info.frame) : NULL, taskwait_task_data, ompt_task_explicit | ompt_task_undeferred | ompt_task_mergeable, 1, - OMPT_GET_RETURN_ADDRESS(0)); + OMPT_LOAD_OR_GET_RETURN_ADDRESS(gtid)); } } diff --git a/openmp/runtime/src/ompt-specific.h b/openmp/runtime/src/ompt-specific.h --- a/openmp/runtime/src/ompt-specific.h +++ b/openmp/runtime/src/ompt-specific.h @@ -81,6 +81,11 @@ __kmp_threads[gtid]->th.ompt_thread_info.return_address = \ __builtin_return_address(0) #define OMPT_LOAD_RETURN_ADDRESS(gtid) __ompt_load_return_address(gtid) +#define OMPT_LOAD_OR_GET_RETURN_ADDRESS(gtid) \ + ((ompt_enabled.enabled && gtid >= 0 && __kmp_threads[gtid] && \ + __kmp_threads[gtid]->th.ompt_thread_info.return_address)? \ + __ompt_load_return_address(gtid): \ + __builtin_return_address(0)) //****************************************************************************** // inline functions diff --git a/openmp/runtime/test/ompt/tasks/dependences_mutexinoutset.c b/openmp/runtime/test/ompt/tasks/dependences_mutexinoutset.c --- a/openmp/runtime/test/ompt/tasks/dependences_mutexinoutset.c +++ b/openmp/runtime/test/ompt/tasks/dependences_mutexinoutset.c @@ -1,10 +1,10 @@ // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s // REQUIRES: ompt -// GCC does not pass in mutexinoutset -// clang 9 introduced codegen for mutexinoutset +// GCC 9 introduced codegen for mutexinoutset +// UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7, gcc-8 -// UNSUPPORTED: gcc +// clang 9 introduced codegen for mutexinoutset // UNSUPPORTED: clang-4, clang-5, clang-6, clang-7, clang-8 #include "callback.h" diff --git a/openmp/runtime/test/ompt/tasks/taskwait-depend.c b/openmp/runtime/test/ompt/tasks/task_if0-depend.c copy from openmp/runtime/test/ompt/tasks/taskwait-depend.c copy to openmp/runtime/test/ompt/tasks/task_if0-depend.c --- a/openmp/runtime/test/ompt/tasks/taskwait-depend.c +++ b/openmp/runtime/test/ompt/tasks/task_if0-depend.c @@ -1,10 +1,6 @@ // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s // REQUIRES: ompt -// The GOMP wrapper does not handle `task if(0) depend()` and drops the -// dependency. Once this is fixed, reevaluate the GCC status: -// XFAIL: gcc-4, gcc-5, gcc-6, gcc-7, gcc-8, gcc-9, gcc-10 - #include "callback.h" #include @@ -20,7 +16,6 @@ #pragma omp task depend(out : x) { x++; } print_fuzzy_address(1); - //#pragma omp taskwait depend(in: x) <-- currently not supported in clang #pragma omp task if (0) depend(in : x) {} print_fuzzy_address(2); diff --git a/openmp/runtime/test/ompt/tasks/taskwait-depend.c b/openmp/runtime/test/ompt/tasks/taskwait-depend.c --- a/openmp/runtime/test/ompt/tasks/taskwait-depend.c +++ b/openmp/runtime/test/ompt/tasks/taskwait-depend.c @@ -1,9 +1,13 @@ // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s // REQUIRES: ompt -// The GOMP wrapper does not handle `task if(0) depend()` and drops the -// dependency. Once this is fixed, reevaluate the GCC status: -// XFAIL: gcc-4, gcc-5, gcc-6, gcc-7, gcc-8, gcc-9, gcc-10 +// taskwait with depend clause was introduced with gcc-9 +// UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7, gcc-8 + +// clang does not yet support taskwait with depend clause +// clang-12 introduced parsing, but no codegen +// update expected result when codegen in clang was added +// XFAIL: clang #include "callback.h" #include @@ -20,9 +24,7 @@ #pragma omp task depend(out : x) { x++; } print_fuzzy_address(1); - //#pragma omp taskwait depend(in: x) <-- currently not supported in clang -#pragma omp task if (0) depend(in : x) - {} + #pragma omp taskwait depend(in: x) print_fuzzy_address(2); } }