[llvm-branch-commits] [openmp] b281a05 - [OpenMP][OMPT] Implement verbose tool loading

2020-11-25 Thread Joachim Protze via llvm-branch-commits

Author: Isabel Thärigen
Date: 2020-11-25T18:17:44+01:00
New Revision: b281a05dacb485d3c3c9cc7f7f5e8fb858ac67bc

URL: 
https://github.com/llvm/llvm-project/commit/b281a05dacb485d3c3c9cc7f7f5e8fb858ac67bc
DIFF: 
https://github.com/llvm/llvm-project/commit/b281a05dacb485d3c3c9cc7f7f5e8fb858ac67bc.diff

LOG: [OpenMP][OMPT] Implement verbose tool loading

OpenMP 5.1 introduces the new env variable
OMP_TOOL_VERBOSE_INIT=(disabled|stdout|stderr|) to enable verbose
loading and initialization of OMPT tools.
This env variable helps to understand the cause when loading of a tool fails
(e.g., undefined symbols or dependency not in LD_LIBRARY_PATH)
Output of OMP_TOOL_VERBOSE_INIT is added for OMP_DISPLAY_ENV

Tests for this patch are integrated into the different existing tool loading
tests, making these tests more verbose. An Archer specific verbose test is
integrated into an existing Archer test.

Patch prepared by: Isabel Thärigen

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

Added: 


Modified: 
openmp/runtime/src/kmp_settings.cpp
openmp/runtime/src/ompt-general.cpp
openmp/runtime/test/ompt/loadtool/tool_available/tool_available.c

openmp/runtime/test/ompt/loadtool/tool_available_search/tool_available_search.c
openmp/runtime/test/ompt/loadtool/tool_not_available/tool_not_available.c
openmp/tools/archer/tests/parallel/parallel-simple.c

Removed: 




diff  --git a/openmp/runtime/src/kmp_settings.cpp 
b/openmp/runtime/src/kmp_settings.cpp
index 5745cbba585f..9ae6b31cacc8 100644
--- a/openmp/runtime/src/kmp_settings.cpp
+++ b/openmp/runtime/src/kmp_settings.cpp
@@ -4695,6 +4695,27 @@ static void 
__kmp_stg_print_omp_tool_libraries(kmp_str_buf_t *buffer,
   }
 } // __kmp_stg_print_omp_tool_libraries
 
+static char *__kmp_tool_verbose_init = NULL;
+
+static void __kmp_stg_parse_omp_tool_verbose_init(char const *name,
+  char const *value, void 
*data) {
+  __kmp_stg_parse_str(name, value, &__kmp_tool_verbose_init);
+} // __kmp_stg_parse_omp_tool_libraries
+
+static void __kmp_stg_print_omp_tool_verbose_init(kmp_str_buf_t *buffer,
+  char const *name, void 
*data) {
+  if (__kmp_tool_verbose_init)
+__kmp_stg_print_str(buffer, name, __kmp_tool_libraries);
+  else {
+if (__kmp_env_format) {
+  KMP_STR_BUF_PRINT_NAME;
+} else {
+  __kmp_str_buf_print(buffer, "   %s", name);
+}
+__kmp_str_buf_print(buffer, ": %s\n", KMP_I18N_STR(NotDefined));
+  }
+} // __kmp_stg_print_omp_tool_verbose_init
+
 #endif
 
 // Table.
@@ -4937,6 +4958,8 @@ static kmp_setting_t __kmp_stg_table[] = {
  0},
 {"OMP_TOOL_LIBRARIES", __kmp_stg_parse_omp_tool_libraries,
  __kmp_stg_print_omp_tool_libraries, NULL, 0, 0},
+{"OMP_TOOL_VERBOSE_INIT", __kmp_stg_parse_omp_tool_verbose_init,
+ __kmp_stg_print_omp_tool_verbose_init, NULL, 0, 0},
 #endif
 
 {"", NULL, NULL, NULL, 0, 0}}; // settings

diff  --git a/openmp/runtime/src/ompt-general.cpp 
b/openmp/runtime/src/ompt-general.cpp
index 22eac2ebf7b8..36bd6b55f33a 100644
--- a/openmp/runtime/src/ompt-general.cpp
+++ b/openmp/runtime/src/ompt-general.cpp
@@ -45,6 +45,20 @@
 #define OMPT_STR_MATCH(haystack, needle) (!strcasecmp(haystack, needle))
 #endif
 
+// prints for an enabled OMP_TOOL_VERBOSE_INIT.
+// In the future a prefix could be added in the first define, the second define
+// omits the prefix to allow for continued lines. Example: "PREFIX: Start
+// tool... Success." instead of "PREFIX: Start tool... PREFIX: Success."
+#define OMPT_VERBOSE_INIT_PRINT(...)   
\
+  if (verbose_init)
\
+  fprintf(verbose_file, __VA_ARGS__)
+#define OMPT_VERBOSE_INIT_CONTINUED_PRINT(...) 
\
+  if (verbose_init)
\
+  fprintf(verbose_file, __VA_ARGS__)
+
+static FILE *verbose_file;
+static int verbose_init;
+
 /*
  * types
  /
@@ -230,6 +244,9 @@ ompt_try_start_tool(unsigned int omp_version, const char 
*runtime_version) {
   const char *sep = ":";
 #endif
 
+  OMPT_VERBOSE_INIT_PRINT("- START LOGGING OF TOOL REGISTRATION -\n");
+  OMPT_VERBOSE_INIT_PRINT("Search for OMP tool in current address space... ");
+
 #if KMP_OS_DARWIN
   // Try in the current address space
   ret = ompt_tool_darwin(omp_version, runtime_version);
@@ -240,50 +257,114 @@ ompt_try_start_tool(unsigned int omp_version, const char 
*runtime_version) {
 #else
 #error Activation of OMPT is not supported on this platform.
 #endif
-  if (ret)
+  if (ret) {
+OMPT_VERBOSE_INIT_CONTINUED_PRINT("Sucess.\n");
+OMPT_VERBOSE_INIT_PRINT(
+  

[llvm-branch-commits] [openmp] 6d3b816 - [OpenMP][OMPT] Introduce a guard to handle OMPT return address

2020-11-25 Thread Joachim Protze via llvm-branch-commits

Author: Joachim Protze
Date: 2020-11-25T18:17:44+01:00
New Revision: 6d3b81664a4b79b32ed2c2f46b21ab0dca9029cc

URL: 
https://github.com/llvm/llvm-project/commit/6d3b81664a4b79b32ed2c2f46b21ab0dca9029cc
DIFF: 
https://github.com/llvm/llvm-project/commit/6d3b81664a4b79b32ed2c2f46b21ab0dca9029cc.diff

LOG: [OpenMP][OMPT] Introduce a guard to handle OMPT return address

This is an alternative approach to address inconsistencies pointed out in: 
D90078
This patch makes sure that the return address is reset, when leaving the scope.
In some cases, I had to move the macro out of an if-statement to have it in the
right scope, in some cases I added an additional block to restrict the scope.

This patch does not handle inconsistencies, which might occur if the return
address is still set when we call into the application.

Test case (repeated_calls.c) provided by @hbae

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

Added: 
openmp/runtime/test/ompt/parallel/repeated_calls.c

Modified: 
openmp/runtime/src/kmp_csupport.cpp
openmp/runtime/src/kmp_gsupport.cpp
openmp/runtime/src/ompt-specific.h

Removed: 




diff  --git a/openmp/runtime/src/kmp_csupport.cpp 
b/openmp/runtime/src/kmp_csupport.cpp
index 119386c49843..1a8db51a667b 100644
--- a/openmp/runtime/src/kmp_csupport.cpp
+++ b/openmp/runtime/src/kmp_csupport.cpp
@@ -297,8 +297,8 @@ void __kmpc_fork_call(ident_t *loc, kmp_int32 argc, 
kmpc_micro microtask, ...) {
 parent_team->t.t_implicit_task_taskdata[tid].ompt_task_info.frame);
   }
   ompt_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
-  OMPT_STORE_RETURN_ADDRESS(gtid);
 }
+OMPT_STORE_RETURN_ADDRESS(gtid);
 #endif
 
 #if INCLUDE_SSC_MARKS
@@ -713,8 +713,8 @@ void __kmpc_barrier(ident_t *loc, kmp_int32 global_tid) {
 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
 if (ompt_frame->enter_frame.ptr == NULL)
   ompt_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
-OMPT_STORE_RETURN_ADDRESS(global_tid);
   }
+  OMPT_STORE_RETURN_ADDRESS(global_tid);
 #endif
   __kmp_threads[global_tid]->th.th_ident = loc;
   // TODO: explicit barrier_wait_id:
@@ -851,8 +851,8 @@ void __kmpc_ordered(ident_t *loc, kmp_int32 gtid) {
   kmp_team_t *team;
   ompt_wait_id_t lck;
   void *codeptr_ra;
+  OMPT_STORE_RETURN_ADDRESS(gtid);
   if (ompt_enabled.enabled) {
-OMPT_STORE_RETURN_ADDRESS(gtid);
 team = __kmp_team_from_gtid(gtid);
 lck = (ompt_wait_id_t)(uintptr_t)&team->t.t_ordered.dt.t_value;
 /* OMPT state update */
@@ -1607,8 +1607,8 @@ kmp_int32 __kmpc_barrier_master(ident_t *loc, kmp_int32 
global_tid) {
 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
 if (ompt_frame->enter_frame.ptr == NULL)
   ompt_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
-OMPT_STORE_RETURN_ADDRESS(global_tid);
   }
+  OMPT_STORE_RETURN_ADDRESS(global_tid);
 #endif
 #if USE_ITT_NOTIFY
   __kmp_threads[global_tid]->th.th_ident = loc;
@@ -1671,8 +1671,8 @@ kmp_int32 __kmpc_barrier_master_nowait(ident_t *loc, 
kmp_int32 global_tid) {
 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
 if (ompt_frame->enter_frame.ptr == NULL)
   ompt_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
-OMPT_STORE_RETURN_ADDRESS(global_tid);
   }
+  OMPT_STORE_RETURN_ADDRESS(global_tid);
 #endif
 #if USE_ITT_NOTIFY
   __kmp_threads[global_tid]->th.th_ident = loc;
@@ -2069,8 +2069,8 @@ void __kmpc_copyprivate(ident_t *loc, kmp_int32 gtid, 
size_t cpy_size,
 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
 if (ompt_frame->enter_frame.ptr == NULL)
   ompt_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
-OMPT_STORE_RETURN_ADDRESS(gtid);
   }
+  OMPT_STORE_RETURN_ADDRESS(gtid);
 #endif
 /* This barrier is not a barrier region boundary */
 #if USE_ITT_NOTIFY
@@ -2083,11 +2083,9 @@ void __kmpc_copyprivate(ident_t *loc, kmp_int32 gtid, 
size_t cpy_size,
 
 // Consider next barrier a user-visible barrier for barrier region boundaries
 // Nesting checks are already handled by the single construct checks
-
+  {
 #if OMPT_SUPPORT
-  if (ompt_enabled.enabled) {
 OMPT_STORE_RETURN_ADDRESS(gtid);
-  }
 #endif
 #if USE_ITT_NOTIFY
   __kmp_threads[gtid]->th.th_ident = loc; // TODO: check if it is needed (e.g.
@@ -2099,6 +2097,7 @@ void __kmpc_copyprivate(ident_t *loc, kmp_int32 gtid, 
size_t cpy_size,
 ompt_frame->enter_frame = ompt_data_none;
   }
 #endif
+  }
 }
 
 /* -- 
*/
@@ -3462,8 +3461,8 @@ __kmpc_reduce_nowait(ident_t *loc, kmp_int32 global_tid, 
kmp_int32 num_vars,
   __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
   if (ompt_frame->enter_frame.ptr == NULL)
 ompt_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
-  OMPT_STORE_RETURN_AD

[llvm-branch-commits] [openmp] cdf9401 - [OpenMP][OMPT][NFC] Fix flaky test

2020-11-29 Thread Joachim Protze via llvm-branch-commits

Author: Joachim Protze
Date: 2020-11-29T19:07:41+01:00
New Revision: cdf9401df84ef382467d1ca1c1c458c11fd6043a

URL: 
https://github.com/llvm/llvm-project/commit/cdf9401df84ef382467d1ca1c1c458c11fd6043a
DIFF: 
https://github.com/llvm/llvm-project/commit/cdf9401df84ef382467d1ca1c1c458c11fd6043a.diff

LOG: [OpenMP][OMPT][NFC] Fix flaky test

The test had a chance to finish the first task before the second task is
created. In this case, the dependences-pair event would not trigger.

Added: 


Modified: 
openmp/runtime/test/ompt/tasks/dependences.c

Removed: 




diff  --git a/openmp/runtime/test/ompt/tasks/dependences.c 
b/openmp/runtime/test/ompt/tasks/dependences.c
index 9e9349f95610..16732e3fe1f0 100644
--- a/openmp/runtime/test/ompt/tasks/dependences.c
+++ b/openmp/runtime/test/ompt/tasks/dependences.c
@@ -9,6 +9,7 @@
 
 int main() {
   int x = 0;
+  int condition=0;
 #pragma omp parallel num_threads(2)
   {
 #pragma omp master
@@ -16,10 +17,10 @@ int main() {
   print_ids(0);
   printf("%" PRIu64 ": address of x: %p\n", ompt_get_thread_data()->value,
  &x);
-#pragma omp task depend(out : x)
+#pragma omp task depend(out : x) shared(condition)
   {
 x++;
-delay(100);
+OMPT_WAIT(condition,1);
   }
   print_fuzzy_address(1);
   print_ids(0);
@@ -27,6 +28,7 @@ int main() {
 #pragma omp task depend(in : x)
   { x = -1; }
   print_ids(0);
+  OMPT_SIGNAL(condition);
 }
   }
 



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [openmp] 723be40 - [OpenMP][OMPT][NFC] Fix failing test

2020-11-29 Thread Joachim Protze via llvm-branch-commits

Author: Joachim Protze
Date: 2020-11-29T19:07:42+01:00
New Revision: 723be4042a3aa38523c60b1dd96b20448053c41e

URL: 
https://github.com/llvm/llvm-project/commit/723be4042a3aa38523c60b1dd96b20448053c41e
DIFF: 
https://github.com/llvm/llvm-project/commit/723be4042a3aa38523c60b1dd96b20448053c41e.diff

LOG: [OpenMP][OMPT][NFC] Fix failing test

The test would fail for gcc, when built with debug flag.

Added: 


Modified: 
openmp/runtime/test/ompt/tasks/serialized.c

Removed: 




diff  --git a/openmp/runtime/test/ompt/tasks/serialized.c 
b/openmp/runtime/test/ompt/tasks/serialized.c
index a2c102ac53c2..1ce0b17a395c 100644
--- a/openmp/runtime/test/ompt/tasks/serialized.c
+++ b/openmp/runtime/test/ompt/tasks/serialized.c
@@ -22,12 +22,15 @@ int main() {
   int t = (int)sin(0.1);
 #pragma omp task if (t)
   {
-void *task_frame = get_frame_address(0);
-if (creator_frame == task_frame) {
-  // Assume this code was inlined which the compiler is allowed to do.
+if (creator_frame == get_frame_address(0)) {
+  printf("Assume this code was inlined which the compiler is allowed 
to do:\n");
   print_frame(0);
+} else if (creator_frame == get_frame_address(1)) {
+  printf("Assume this code was called from the application:\n");
+  print_frame(1);
 } else {
   // The exit frame must be our parent!
+  printf("Assume this code was not inlined, exit frame must be our 
parent:\n");
   print_frame_from_outlined_fn(1);
 }
 print_ids(0);



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [openmp] fd3d1b0 - [OpenMP][Tests][NFC] Use FileCheck from cmake config

2020-11-30 Thread Joachim Protze via llvm-branch-commits

Author: Joachim Protze
Date: 2020-11-30T23:16:56+01:00
New Revision: fd3d1b09c12f1419292172627dbca9929f0daf39

URL: 
https://github.com/llvm/llvm-project/commit/fd3d1b09c12f1419292172627dbca9929f0daf39
DIFF: 
https://github.com/llvm/llvm-project/commit/fd3d1b09c12f1419292172627dbca9929f0daf39.diff

LOG: [OpenMP][Tests][NFC] Use FileCheck from cmake config

Added: 


Modified: 
openmp/runtime/test/lit.cfg

Removed: 




diff  --git a/openmp/runtime/test/lit.cfg b/openmp/runtime/test/lit.cfg
index e133ef095a2a..0d4a6107ff2b 100644
--- a/openmp/runtime/test/lit.cfg
+++ b/openmp/runtime/test/lit.cfg
@@ -144,3 +144,5 @@ if config.has_ompt:
 else:
 config.substitutions.append(("%preload-tool", "env 
LD_PRELOAD=%T/tool.so"))
 config.substitutions.append(("%no-as-needed-flag", 
"-Wl,--no-as-needed"))
+else:
+config.substitutions.append(("FileCheck", config.test_filecheck))



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [openmp] d3ec512 - [OpenMP][OMPT] Make sure that 0 is never used as ID in tests (NFC)

2020-12-04 Thread Joachim Protze via llvm-branch-commits

Author: Joachim Protze
Date: 2020-12-04T18:41:56+01:00
New Revision: d3ec512b1d6906486d9f8cea93385774f52e6065

URL: 
https://github.com/llvm/llvm-project/commit/d3ec512b1d6906486d9f8cea93385774f52e6065
DIFF: 
https://github.com/llvm/llvm-project/commit/d3ec512b1d6906486d9f8cea93385774f52e6065.diff

LOG: [OpenMP][OMPT] Make sure that 0 is never used as ID in tests (NFC)

Added: 


Modified: 
openmp/runtime/test/ompt/callback.h

Removed: 




diff  --git a/openmp/runtime/test/ompt/callback.h 
b/openmp/runtime/test/ompt/callback.h
index f4e4f038026d..2bc26b51da18 100644
--- a/openmp/runtime/test/ompt/callback.h
+++ b/openmp/runtime/test/ompt/callback.h
@@ -1139,6 +1139,8 @@ int ompt_initialize(
   ompt_get_unique_id = (ompt_get_unique_id_t) lookup("ompt_get_unique_id");
   ompt_finalize_tool = (ompt_finalize_tool_t)lookup("ompt_finalize_tool");
 
+  ompt_get_unique_id();
+
   ompt_get_num_procs = (ompt_get_num_procs_t) lookup("ompt_get_num_procs");
   ompt_get_num_places = (ompt_get_num_places_t) lookup("ompt_get_num_places");
   ompt_get_place_proc_ids = (ompt_get_place_proc_ids_t) 
lookup("ompt_get_place_proc_ids");



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [openmp] a148216 - [OpenMP][OMPT] Fix OMPT return address guard for gomp interface

2020-12-05 Thread Joachim Protze via llvm-branch-commits

Author: Joachim Protze
Date: 2020-12-05T19:06:28+01:00
New Revision: a148216b31292e52c0229dae98f52d3b2c350400

URL: 
https://github.com/llvm/llvm-project/commit/a148216b31292e52c0229dae98f52d3b2c350400
DIFF: 
https://github.com/llvm/llvm-project/commit/a148216b31292e52c0229dae98f52d3b2c350400.diff

LOG: [OpenMP][OMPT] Fix OMPT return address guard for gomp interface

D91692 missed various locations in kmp_gsupport, where the scope for
OMPT_STORE_RETURN_ADDRESS is too narrow, i.e. the scope ends before the OMPT
callback is called in some nested function.

This patch fixes the scoping issue, so that all OMPT tests pass, when the
tests are built with gcc.

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

Added: 


Modified: 
openmp/runtime/src/kmp_gsupport.cpp

Removed: 




diff  --git a/openmp/runtime/src/kmp_gsupport.cpp 
b/openmp/runtime/src/kmp_gsupport.cpp
index 7b4a941d275f..08ad5c6d1551 100644
--- a/openmp/runtime/src/kmp_gsupport.cpp
+++ b/openmp/runtime/src/kmp_gsupport.cpp
@@ -102,8 +102,8 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_BARRIER)(void) {
   if (ompt_enabled.enabled) {
 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
 ompt_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
-OMPT_STORE_RETURN_ADDRESS(gtid);
   }
+  OMPT_STORE_RETURN_ADDRESS(gtid);
 #endif
   __kmpc_barrier(&loc, gtid);
 #if OMPT_SUPPORT && OMPT_OPTIONAL
@@ -250,20 +250,20 @@ void 
*KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SINGLE_COPY_START)(void) {
   if (ompt_enabled.enabled) {
 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
 ompt_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
-OMPT_STORE_RETURN_ADDRESS(gtid);
   }
+  OMPT_STORE_RETURN_ADDRESS(gtid);
 #endif
   __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
 
   // Retrieve the value of the copyprivate data point, and wait for all
   // threads to do likewise, then return.
   retval = __kmp_team_from_gtid(gtid)->t.t_copypriv_data;
+  {
 #if OMPT_SUPPORT && OMPT_OPTIONAL
-  if (ompt_enabled.enabled) {
 OMPT_STORE_RETURN_ADDRESS(gtid);
-  }
 #endif
-  __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
+__kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
+  }
 #if OMPT_SUPPORT && OMPT_OPTIONAL
   if (ompt_enabled.enabled) {
 ompt_frame->enter_frame = ompt_data_none;
@@ -286,16 +286,16 @@ void 
KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SINGLE_COPY_END)(void *data) {
   if (ompt_enabled.enabled) {
 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
 ompt_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
-OMPT_STORE_RETURN_ADDRESS(gtid);
   }
+  OMPT_STORE_RETURN_ADDRESS(gtid);
 #endif
   __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
+  {
 #if OMPT_SUPPORT && OMPT_OPTIONAL
-  if (ompt_enabled.enabled) {
 OMPT_STORE_RETURN_ADDRESS(gtid);
-  }
 #endif
-  __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
+__kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
+  }
 #if OMPT_SUPPORT && OMPT_OPTIONAL
   if (ompt_enabled.enabled) {
 ompt_frame->enter_frame = ompt_data_none;
@@ -482,8 +482,8 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_START)(void 
(*task)(void *),
   if (ompt_enabled.enabled) {
 __ompt_get_task_info_internal(0, NULL, NULL, &parent_frame, NULL, NULL);
 parent_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
-OMPT_STORE_RETURN_ADDRESS(gtid);
   }
+  OMPT_STORE_RETURN_ADDRESS(gtid);
 #endif
 
   MKLOC(loc, "GOMP_parallel_start");
@@ -1231,10 +1231,10 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASK)(void 
(*func)(void *), void *data,
 #if OMPT_SUPPORT
   kmp_taskdata_t *current_task;
   if (ompt_enabled.enabled) {
-OMPT_STORE_RETURN_ADDRESS(gtid);
 current_task = __kmp_threads[gtid]->th.th_current_task;
 current_task->ompt_task_info.frame.enter_frame.ptr = 
OMPT_GET_FRAME_ADDRESS(0);
   }
+  OMPT_STORE_RETURN_ADDRESS(gtid);
 #endif
 
   if (if_cond) {
@@ -1262,8 +1262,8 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASK)(void 
(*func)(void *), void *data,
   thread->th.ompt_thread_info.wait_id = 0;
   thread->th.ompt_thread_info.state = ompt_state_work_parallel;
   taskdata->ompt_task_info.frame.exit_frame.ptr = 
OMPT_GET_FRAME_ADDRESS(0);
-  OMPT_STORE_RETURN_ADDRESS(gtid);
 }
+OMPT_STORE_RETURN_ADDRESS(gtid);
 #endif
 if (gomp_flags & KMP_GOMP_TASK_DEPENDS_FLAG) {
   KMP_ASSERT(depend);
@@ -1300,8 +1300,7 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKWAIT)(void) {
   int gtid = __kmp_entry_gtid();
 
 #if OMPT_SUPPORT
-  if (ompt_enabled.enabled)
-OMPT_STORE_RETURN_ADDRESS(gtid);
+  OMPT_STORE_RETURN_ADDRESS(gtid);
 #endif
 
   KA_TRACE(20, ("GOMP_taskwait: T#%d\n", gtid));
@@ -1378,8 +1377,8 @@ void 
KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START)(
   if (ompt_enabled.enabled) {
 __ompt_get_task_info_internal(0,