Index: openmp/trunk/runtime/src/kmp_csupport.c =================================================================== --- openmp/trunk/runtime/src/kmp_csupport.c +++ openmp/trunk/runtime/src/kmp_csupport.c @@ -1559,13 +1559,10 @@ #if OMPT_SUPPORT && OMPT_TRACE if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_loop_end)) { - kmp_info_t *this_thr = __kmp_threads[ global_tid ]; - kmp_team_t *team = this_thr -> th.th_team; - int tid = __kmp_tid_from_gtid( global_tid ); - + ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL); + ompt_task_info_t *task_info = __ompt_get_taskinfo(0); ompt_callbacks.ompt_callback(ompt_event_loop_end)( - team->t.ompt_team_info.parallel_id, - team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id); + team_info->parallel_id, task_info->task_id); } #endif Index: openmp/trunk/runtime/test/lit.cfg =================================================================== --- openmp/trunk/runtime/test/lit.cfg +++ openmp/trunk/runtime/test/lit.cfg @@ -2,6 +2,7 @@ # Configuration file for the 'lit' test runner. import os +import re import subprocess import lit.formats @@ -47,6 +48,11 @@ " -L " + config.library_dir + \ " " + config.test_extra_cflags +# Allow XFAIL to work +config.target_triple = [ ] +if re.search('gcc', config.test_compiler) is not None: + config.available_features.add('gcc') + # Setup environment to find dynamic library at runtime append_dynamic_library_path(config.library_dir) if config.using_hwloc: Index: openmp/trunk/runtime/test/ompt/callback.h =================================================================== --- openmp/trunk/runtime/test/ompt/callback.h +++ openmp/trunk/runtime/test/ompt/callback.h @@ -44,6 +44,23 @@ } static void +on_ompt_event_loop_begin( + ompt_parallel_id_t parallel_id, + ompt_task_id_t parent_task_id, + void *workshare_function) +{ + printf("%" PRIu64 ": ompt_event_loop_begin: parallel_id=%" PRIu64 ", parent_task_id=%" PRIu64 ", workshare_function=%p\n", ompt_get_thread_id(), parallel_id, parent_task_id, workshare_function); +} + +static void +on_ompt_event_loop_end( + ompt_parallel_id_t parallel_id, + ompt_task_id_t task_id) +{ + printf("%" PRIu64 ": ompt_event_loop_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 "\n", ompt_get_thread_id(), parallel_id, task_id); +} + +static void on_ompt_event_parallel_begin( ompt_task_id_t parent_task_id, ompt_frame_t *parent_task_frame, @@ -79,6 +96,8 @@ ompt_set_callback(ompt_event_barrier_end, (ompt_callback_t) &on_ompt_event_barrier_end); ompt_set_callback(ompt_event_implicit_task_begin, (ompt_callback_t) &on_ompt_event_implicit_task_begin); ompt_set_callback(ompt_event_implicit_task_end, (ompt_callback_t) &on_ompt_event_implicit_task_end); + ompt_set_callback(ompt_event_loop_begin, (ompt_callback_t) &on_ompt_event_loop_begin); + ompt_set_callback(ompt_event_loop_end, (ompt_callback_t) &on_ompt_event_loop_end); ompt_set_callback(ompt_event_parallel_begin, (ompt_callback_t) &on_ompt_event_parallel_begin); ompt_set_callback(ompt_event_parallel_end, (ompt_callback_t) &on_ompt_event_parallel_end); } Index: openmp/trunk/runtime/test/ompt/worksharing/for/auto.c =================================================================== --- openmp/trunk/runtime/test/ompt/worksharing/for/auto.c +++ openmp/trunk/runtime/test/ompt/worksharing/for/auto.c @@ -0,0 +1,7 @@ +// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base.h +// REQUIRES: ompt +// GCC doesn't call runtime for auto = static schedule +// XFAIL: gcc + +#define SCHEDULE auto +#include "base.h" Index: openmp/trunk/runtime/test/ompt/worksharing/for/auto_serialized.c =================================================================== --- openmp/trunk/runtime/test/ompt/worksharing/for/auto_serialized.c +++ openmp/trunk/runtime/test/ompt/worksharing/for/auto_serialized.c @@ -0,0 +1,7 @@ +// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_serialized.h +// REQUIRES: ompt +// GCC doesn't call runtime for auto = static schedule +// XFAIL: gcc + +#define SCHEDULE auto +#include "base_serialized.h" Index: openmp/trunk/runtime/test/ompt/worksharing/for/base.h =================================================================== --- openmp/trunk/runtime/test/ompt/worksharing/for/base.h +++ openmp/trunk/runtime/test/ompt/worksharing/for/base.h @@ -0,0 +1,35 @@ +#include "callback.h" +#include + +int main() +{ + unsigned int i; + + #pragma omp parallel for num_threads(4) schedule(SCHEDULE) + for (i = 0; i < 4; i++) { + } + + // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id={{[0-9]+}}, parent_task_frame=0x{{[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=4, parallel_function=0x{{[0-f]+}}, invoker={{.*}} + + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], workshare_function=0x{{[0-f]+}} + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] + + // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] + // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], workshare_function=0x{{[0-f]+}} + // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] + // CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] + + // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] + // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], workshare_function=0x{{[0-f]+}} + // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] + // CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] + + // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] + // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], workshare_function=0x{{[0-f]+}} + // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] + // CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] + + return 0; +} Index: openmp/trunk/runtime/test/ompt/worksharing/for/base_serialized.h =================================================================== --- openmp/trunk/runtime/test/ompt/worksharing/for/base_serialized.h +++ openmp/trunk/runtime/test/ompt/worksharing/for/base_serialized.h @@ -0,0 +1,20 @@ +#include "callback.h" +#include + +int main() +{ + unsigned int i; + + #pragma omp parallel for num_threads(1) schedule(SCHEDULE) + for (i = 0; i < 1; i++) { + } + + // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], parent_task_frame=0x{{[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=1, parallel_function=0x{{[0-f]+}}, invoker={{.+}} + + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], workshare_function=0x{{[0-f]+}} + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] + + return 0; +} Index: openmp/trunk/runtime/test/ompt/worksharing/for/dynamic.c =================================================================== --- openmp/trunk/runtime/test/ompt/worksharing/for/dynamic.c +++ openmp/trunk/runtime/test/ompt/worksharing/for/dynamic.c @@ -0,0 +1,5 @@ +// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base.h +// REQUIRES: ompt + +#define SCHEDULE dynamic +#include "base.h" Index: openmp/trunk/runtime/test/ompt/worksharing/for/dynamic_serialized.c =================================================================== --- openmp/trunk/runtime/test/ompt/worksharing/for/dynamic_serialized.c +++ openmp/trunk/runtime/test/ompt/worksharing/for/dynamic_serialized.c @@ -0,0 +1,5 @@ +// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_serialized.h +// REQUIRES: ompt + +#define SCHEDULE dynamic +#include "base_serialized.h" Index: openmp/trunk/runtime/test/ompt/worksharing/for/guided.c =================================================================== --- openmp/trunk/runtime/test/ompt/worksharing/for/guided.c +++ openmp/trunk/runtime/test/ompt/worksharing/for/guided.c @@ -0,0 +1,5 @@ +// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base.h +// REQUIRES: ompt + +#define SCHEDULE guided +#include "base.h" Index: openmp/trunk/runtime/test/ompt/worksharing/for/guided_serialized.c =================================================================== --- openmp/trunk/runtime/test/ompt/worksharing/for/guided_serialized.c +++ openmp/trunk/runtime/test/ompt/worksharing/for/guided_serialized.c @@ -0,0 +1,5 @@ +// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_serialized.h +// REQUIRES: ompt + +#define SCHEDULE guided +#include "base_serialized.h" Index: openmp/trunk/runtime/test/ompt/worksharing/for/runtime.c =================================================================== --- openmp/trunk/runtime/test/ompt/worksharing/for/runtime.c +++ openmp/trunk/runtime/test/ompt/worksharing/for/runtime.c @@ -0,0 +1,5 @@ +// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base.h +// REQUIRES: ompt + +#define SCHEDULE runtime +#include "base.h" Index: openmp/trunk/runtime/test/ompt/worksharing/for/runtime_serialized.c =================================================================== --- openmp/trunk/runtime/test/ompt/worksharing/for/runtime_serialized.c +++ openmp/trunk/runtime/test/ompt/worksharing/for/runtime_serialized.c @@ -0,0 +1,5 @@ +// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_serialized.h +// REQUIRES: ompt + +#define SCHEDULE runtime +#include "base_serialized.h" Index: openmp/trunk/runtime/test/ompt/worksharing/for/static.c =================================================================== --- openmp/trunk/runtime/test/ompt/worksharing/for/static.c +++ openmp/trunk/runtime/test/ompt/worksharing/for/static.c @@ -0,0 +1,7 @@ +// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base.h +// REQUIRES: ompt +// GCC doesn't call runtime for static schedule +// XFAIL: gcc + +#define SCHEDULE static +#include "base.h" Index: openmp/trunk/runtime/test/ompt/worksharing/for/static_serialized.c =================================================================== --- openmp/trunk/runtime/test/ompt/worksharing/for/static_serialized.c +++ openmp/trunk/runtime/test/ompt/worksharing/for/static_serialized.c @@ -0,0 +1,7 @@ +// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_serialized.h +// REQUIRES: ompt +// GCC doesn't call runtime for static schedule +// XFAIL: gcc + +#define SCHEDULE static +#include "base_serialized.h"