diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h --- a/openmp/runtime/src/kmp.h +++ b/openmp/runtime/src/kmp.h @@ -15,6 +15,7 @@ #define KMP_H #include "kmp_config.h" +#include "kmp_tasking_flags.h" /* #define BUILD_PARALLEL_ORDERED 1 */ @@ -2366,39 +2367,6 @@ #endif // BUILD_TIED_TASK_STACK -typedef struct kmp_tasking_flags { /* Total struct must be exactly 32 bits */ - /* Compiler flags */ /* Total compiler flags must be 16 bits */ - unsigned tiedness : 1; /* task is either tied (1) or untied (0) */ - unsigned final : 1; /* task is final(1) so execute immediately */ - unsigned merged_if0 : 1; /* no __kmpc_task_{begin/complete}_if0 calls in if0 - code path */ - unsigned destructors_thunk : 1; /* set if the compiler creates a thunk to - invoke destructors from the runtime */ - unsigned proxy : 1; /* task is a proxy task (it will be executed outside the - context of the RTL) */ - unsigned priority_specified : 1; /* set if the compiler provides priority - setting for the task */ - unsigned detachable : 1; /* 1 == can detach */ - unsigned hidden_helper : 1; /* 1 == hidden helper task */ - unsigned reserved : 8; /* reserved for compiler use */ - - /* Library flags */ /* Total library flags must be 16 bits */ - unsigned tasktype : 1; /* task is either explicit(1) or implicit (0) */ - unsigned task_serial : 1; // task is executed immediately (1) or deferred (0) - unsigned tasking_ser : 1; // all tasks in team are either executed immediately - // (1) or may be deferred (0) - unsigned team_serial : 1; // entire team is serial (1) [1 thread] or parallel - // (0) [>= 2 threads] - /* If either team_serial or tasking_ser is set, task team may be NULL */ - /* Task State Flags: */ - unsigned started : 1; /* 1==started, 0==not started */ - unsigned executing : 1; /* 1==executing, 0==not executing */ - unsigned complete : 1; /* 1==complete, 0==not complete */ - unsigned freed : 1; /* 1==freed, 0==allocated */ - unsigned native : 1; /* 1==gcc-compiled task, 0==intel */ - unsigned reserved31 : 7; /* reserved for library use */ - -} kmp_tasking_flags_t; struct kmp_taskdata { /* aligned during dynamic allocation */ kmp_int32 td_task_id; /* id, assigned by debugger */ @@ -3684,6 +3652,7 @@ size_t sizeof_kmp_task_t, size_t sizeof_shareds, kmp_routine_entry_t task_entry); +void __kmp_init_implicit_task_flags(kmp_taskdata_t *task, kmp_team_t *team); extern void __kmp_init_implicit_task(ident_t *loc_ref, kmp_info_t *this_thr, kmp_team_t *team, int tid, int set_curr_task); diff --git a/openmp/runtime/src/kmp_tasking.cpp b/openmp/runtime/src/kmp_tasking.cpp --- a/openmp/runtime/src/kmp_tasking.cpp +++ b/openmp/runtime/src/kmp_tasking.cpp @@ -1067,6 +1067,26 @@ } #endif // TASK_UNUSED +// __kmp_init_implicit_task_flags: Initialize td_flags field +// of an implicit task + +// task: implicit task which td_flags are initialized +void __kmp_init_implicit_task_flags(kmp_taskdata_t *task, kmp_team_t *team) { + task->td_flags.tiedness = TASK_TIED; + task->td_flags.tasktype = TASK_IMPLICIT; + task->td_flags.proxy = TASK_FULL; + + // All implicit tasks are executed immediately, not deferred + task->td_flags.task_serial = 1; + task->td_flags.tasking_ser = (__kmp_tasking_mode == tskm_immediate_exec); + task->td_flags.team_serial = (team->t.t_serialized) ? 1 : 0; + + task->td_flags.started = 1; + task->td_flags.executing = 1; + task->td_flags.complete = 0; + task->td_flags.freed = 0; +} + // __kmp_init_implicit_task: Initialize the appropriate fields in the implicit // task for a given thread // @@ -1096,19 +1116,7 @@ task->td_taskwait_counter = 0; task->td_taskwait_thread = 0; - task->td_flags.tiedness = TASK_TIED; - task->td_flags.tasktype = TASK_IMPLICIT; - task->td_flags.proxy = TASK_FULL; - - // All implicit tasks are executed immediately, not deferred - task->td_flags.task_serial = 1; - task->td_flags.tasking_ser = (__kmp_tasking_mode == tskm_immediate_exec); - task->td_flags.team_serial = (team->t.t_serialized) ? 1 : 0; - - task->td_flags.started = 1; - task->td_flags.executing = 1; - task->td_flags.complete = 0; - task->td_flags.freed = 0; + __kmp_init_implicit_task_flags(task, team); task->td_depnode = NULL; task->td_last_tied = task; diff --git a/openmp/runtime/src/kmp_tasking_flags.h b/openmp/runtime/src/kmp_tasking_flags.h new file mode 100644 --- /dev/null +++ b/openmp/runtime/src/kmp_tasking_flags.h @@ -0,0 +1,59 @@ +/* + * kmp_tasking_flags.h -- OpenMP task flags + */ + +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef KMP_TASKING_FLAGS_H +#define KMP_TASKING_FLAGS_H + +// Set all tasking flags to zero, under assumption +// that kmp_tasking_flags struct is exactly 32 bits long. +#define TASKING_FLAGS_CLEAR(td_flags_ptr) *((uint32_t *)td_flags_ptr) = 0; + +// In order to avoid circular reference, declare the following data structure +// here in order to be safely included by both ompt-internal.h and kmp.h files. +// It could be declared inside ompt-internal.h instead. +// However, it's not only used by OMPT, so it is better to declare it +// in a separate header file. +typedef struct kmp_tasking_flags { /* Total struct must be exactly 32 bits */ + /* Compiler flags */ /* Total compiler flags must be 16 bits */ + unsigned tiedness : 1; /* task is either tied (1) or untied (0) */ + unsigned final : 1; /* task is final(1) so execute immediately */ + unsigned merged_if0 : 1; /* no __kmpc_task_{begin/complete}_if0 calls in if0 + code path */ + unsigned destructors_thunk : 1; /* set if the compiler creates a thunk to + invoke destructors from the runtime */ + unsigned proxy : 1; /* task is a proxy task (it will be executed outside the + context of the RTL) */ + unsigned priority_specified : 1; /* set if the compiler provides priority + setting for the task */ + unsigned detachable : 1; /* 1 == can detach */ + unsigned hidden_helper : 1; /* 1 == hidden helper task */ + unsigned reserved : 8; /* reserved for compiler use */ + + /* Library flags */ /* Total library flags must be 16 bits */ + unsigned tasktype : 1; /* task is either explicit(1) or implicit (0) */ + unsigned task_serial : 1; // task is executed immediately (1) or deferred (0) + unsigned tasking_ser : 1; // all tasks in team are either executed immediately + // (1) or may be deferred (0) + unsigned team_serial : 1; // entire team is serial (1) [1 thread] or parallel + // (0) [>= 2 threads] + /* If either team_serial or tasking_ser is set, task team may be NULL */ + /* Task State Flags: */ + unsigned started : 1; /* 1==started, 0==not started */ + unsigned executing : 1; /* 1==executing, 0==not executing */ + unsigned complete : 1; /* 1==complete, 0==not complete */ + unsigned freed : 1; /* 1==freed, 0==allocated */ + unsigned native : 1; /* 1==gcc-compiled task, 0==intel */ + unsigned reserved31 : 7; /* reserved for library use */ + +} kmp_tasking_flags_t; + +#endif // KMP_TASKING_FLAGS_H diff --git a/openmp/runtime/src/ompt-internal.h b/openmp/runtime/src/ompt-internal.h --- a/openmp/runtime/src/ompt-internal.h +++ b/openmp/runtime/src/ompt-internal.h @@ -13,6 +13,7 @@ #ifndef __OMPT_INTERNAL_H__ #define __OMPT_INTERNAL_H__ +#include "kmp_tasking_flags.h" #include "ompt-event-specific.h" #include "omp-tools.h" @@ -109,6 +110,8 @@ ompt_task_info_t ompt_task_info; int heap; struct ompt_lw_taskteam_s *parent; + // preserve td_flags of kmp_taskdata_t after linking happens + kmp_tasking_flags_t td_flags; } ompt_lw_taskteam_t; typedef struct { diff --git a/openmp/runtime/src/ompt-specific.cpp b/openmp/runtime/src/ompt-specific.cpp --- a/openmp/runtime/src/ompt-specific.cpp +++ b/openmp/runtime/src/ompt-specific.cpp @@ -264,6 +264,8 @@ lwt->ompt_task_info.scheduling_parent = NULL; lwt->heap = 0; lwt->parent = 0; + // clear tasking flags + TASKING_FLAGS_CLEAR(&lwt->td_flags); } void __ompt_lw_taskteam_link(ompt_lw_taskteam_t *lwt, kmp_info_t *thr, @@ -297,6 +299,23 @@ ompt_task_info_t tmp_task = lwt->ompt_task_info; link_lwt->ompt_task_info = *OMPT_CUR_TASK_INFO(thr); *OMPT_CUR_TASK_INFO(thr) = tmp_task; + + // copy td_flags + // Note: cur_task may belong to the explicit task, so we need + // to preserve the td_flags->tasktype. + kmp_taskdata_t *cur_task = thr->th.th_current_task; + link_lwt->td_flags = cur_task->td_flags; + // linked task isn't executing at the moment + link_lwt->td_flags.executing = 0; + // clear td_flags of cur_task + TASKING_FLAGS_CLEAR(&cur_task->td_flags); + // Since cur_task now represents an implicit task of the serialized + // parallel region, initialize tasking flags (of cur_task) the same way + // it is done for implicit tasks of regular regions. + // Otherwise, td_flags may be inherited from previously linked + // explicit tasks. + __kmp_init_implicit_task_flags(cur_task, thr->th.th_team); + } else { // this is the first serialized team, so we just store the values in the // team and drop the taskteam-object @@ -316,6 +335,12 @@ ompt_task_info_t tmp_task = lwtask->ompt_task_info; lwtask->ompt_task_info = *OMPT_CUR_TASK_INFO(thr); *OMPT_CUR_TASK_INFO(thr) = tmp_task; + + // copy back the td_flags + thr->th.th_current_task->td_flags = lwtask->td_flags; + // unlinked task is executing at the moment + thr->th.th_current_task->td_flags.executing = 1; + #if OMPD_SUPPORT if (ompd_state & OMPD_ENABLE_BP) { ompd_bp_parallel_end(); @@ -339,6 +364,10 @@ // task support //---------------------------------------------------------- +#define OMPT_GET_TASK_FLAGS(task) \ + (task->td_flags.tasktype ? ompt_task_explicit : ompt_task_implicit) | \ + TASK_TYPE_DETAILS_FORMAT(task) + int __ompt_get_task_info_internal(int ancestor_level, int *type, ompt_data_t **task_data, ompt_frame_t **task_frame, @@ -367,13 +396,64 @@ *next_lwt = LWT_FROM_TEAM(taskdata->td_team), *prev_lwt = NULL; + // This flag indicates that the task T1 at the specified ancestor_level + // is the task that belongs to the serialized parallel region R1. + // Note that the T1 isn't the innermost task of the region R1 at + // the time of the call of this function and it can be either an explicit + // or an implicit task. Let T2 be the innermost explicit task of the R1, + // which is at the same time enclosed by T1 (might not be directly + // enclosed). The T2 contains contains another serialized parallel region + // R2. At the moment of R2's creation, R1's team information is memoized + // inside an lwt, which is put at the beginning of the lightweight tasks + // linked list. The same lwt contains the information about the + // task active at the moment, which is the task T2. + // When providing the information about T1, the team information is read + // from lwt, while the task information is read from the taskdata that + // corresponds to the T1. + bool tasks_share_lwt = false; + while (ancestor_level > 0) { // needed for thread_num prev_team = team; prev_lwt = lwt; - // next lightweight team (if any) - if (lwt) + + if (lwt) { + kmp_taskdata_t *scheduling_parent = + lwt->ompt_task_info.scheduling_parent; + // At the time lwt was created, the active task was an explicit task. + // Thus, lwt->ompt_task_info represents the information about that + // task. It is possible that the explicit task is nested inside the + // hierarchy of explicit tasks on top of which is the implicit task + // of the enclosing parallel region R. The inner loop iterates over + // this hierarchy by using the scheduling_parent pointer until either + // reaching the requested ancestor_level or encountering the implicit + // task of the enclosing parallel region R. Since this implicit task + // doesn't have the scheduling_parent, search continues from the + // innermost tasks that encloses the region R. + // Note that the lwt->ompt_team_info is going to be shared by all tasks + // nested in the the same serialized parallel region. + while (scheduling_parent && ancestor_level > 0) { + // access to the parent task + taskdata = scheduling_parent; + ancestor_level--; + // get another explicit task, if any + scheduling_parent = taskdata->ompt_task_info.scheduling_parent; + } + + if (ancestor_level == 0) { + // The requested ancestor_level is reached, so leave the loop, but + // first mark that the information about the task should be read + // from taskdata instead of the lwt. + tasks_share_lwt = true; + break; + } + + // Since the previous loop eventually exhausted all nested tasks that + // belongs to the same serialized parallel region R, try to access the + // lwt that corresponds to the serialized region that encloses the + // region R, if any. lwt = lwt->parent; + } // next heavyweight team (if any) after // lightweight teams are exhausted @@ -399,19 +479,21 @@ } if (lwt) { - info = &lwt->ompt_task_info; + // Decide whether to read task information from taskdata or lwt. + info = tasks_share_lwt ? &taskdata->ompt_task_info : &lwt->ompt_task_info; team_info = &lwt->ompt_team_info; if (type) { - *type = ompt_task_implicit; + // decide whether to read td_flags from taskdata or lwt + // Since macro expands, it is safer to enclose it by parentheses. + *type = tasks_share_lwt ? (OMPT_GET_TASK_FLAGS(taskdata)) + : (OMPT_GET_TASK_FLAGS(lwt)); } } else if (taskdata) { info = &taskdata->ompt_task_info; team_info = &team->t.ompt_team_info; if (type) { if (taskdata->td_parent) { - *type = (taskdata->td_flags.tasktype ? ompt_task_explicit - : ompt_task_implicit) | - TASK_TYPE_DETAILS_FORMAT(taskdata); + *type = OMPT_GET_TASK_FLAGS(taskdata); } else { *type = ompt_task_initial; } diff --git a/openmp/runtime/test/ompt/tasks/lwts_if0_info.c b/openmp/runtime/test/ompt/tasks/lwts_if0_info.c new file mode 100644 --- /dev/null +++ b/openmp/runtime/test/ompt/tasks/lwts_if0_info.c @@ -0,0 +1,121 @@ +// RUN: %libomp-compile-and-run | FileCheck %s +// REQUIRES: ompt + +#include "callback.h" +#include + + +__attribute__ ((noinline)) // workaround for bug in icc +void print_task_info_at(int ancestor_level, int id) +{ +#pragma omp critical + { + int task_type; + char buffer[2048]; + ompt_data_t *parallel_data; + ompt_data_t *task_data; + ompt_get_task_info(ancestor_level, &task_type, &task_data, NULL, ¶llel_data, NULL); + format_task_type(task_type, buffer); + printf("%" PRIu64 ": ancestor_level=%d id=%d task_type=%s=%d " + "parallel_id=%" PRIu64 " task_id=%" PRIu64 "\n", + ompt_get_thread_data()->value, ancestor_level, id, buffer, + task_type, parallel_data->value, task_data->value); + } +}; + +int main() +{ + //initial task + print_task_info_at(0, 0); + +#pragma omp parallel if(0) + { + // region 0 + // outermost lwt + print_task_info_at(0, 1); + +#pragma omp task if(0) + { + // task 0 + print_task_info_at(0, 2); + + // check hierarchy now + print_task_info_at(0, 2); + print_task_info_at(1, 1); + print_task_info_at(2, 0); + +#pragma omp parallel if(0) + { + // region 1 + print_task_info_at(0, 3); + + // check hierarchy now + print_task_info_at(0, 3); + print_task_info_at(1, 2); + print_task_info_at(2, 1); + print_task_info_at(3, 0); + + print_task_info_at(0, 3); + } + + print_task_info_at(0, 2); + + }; + + print_task_info_at(0, 1); + + } + + print_task_info_at(0, 0); + + // Check if libomp supports the callbacks for this test. + // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create' + // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task' + + + // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]] + // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_initial_task_begin: parallel_id=[[PARALLEL_ID_0:[0-9]+]], task_id=[[TASK_ID_0:[0-9]+]], actual_parallelism=1, index=1, flags=1 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=0 task_type=ompt_task_initial=1 parallel_id=[[PARALLEL_ID_0]] task_id=[[TASK_ID_0]] + + // region 0 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[TASK_ID_0]], + // CHECK-SAME: parallel_id=[[PARALLEL_ID_1:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_1]], task_id=[[TASK_ID_1:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_1]] + + // task 0 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[TASK_ID_1]] + // CHECK-SAME: new_task_id=[[TASK_ID_2:[0-9]+]] + // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_undeferred=134217732 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=2 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_2]] + + // check hierarchy now + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=2 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_2]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=1 id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_1]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=2 id=0 task_type=ompt_task_initial=1 parallel_id=[[PARALLEL_ID_0]] task_id=[[TASK_ID_0]] + + // region 1 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[TASK_ID_2]], + // CHESK-SAME: parallel_id=[[PARALLEL_ID_2:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_2:[0-9]+]], task_id=[[TASK_ID_3:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=3 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_2]] task_id=[[TASK_ID_3]] + + // check hierarchy now + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=3 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_2]] task_id=[[TASK_ID_3]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=1 id=2 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_2]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=2 id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_1]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=3 id=0 task_type=ompt_task_initial=1 parallel_id=[[PARALLEL_ID_0]] task_id=[[TASK_ID_0]] + + // region 1 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=3 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_2]] task_id=[[TASK_ID_3]] + + // task 0 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=2 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_2]] + + // region 0 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_1]] + + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=0 task_type=ompt_task_initial=1 parallel_id=[[PARALLEL_ID_0]] task_id=[[TASK_ID_0]] + + return 0; +} \ No newline at end of file diff --git a/openmp/runtime/test/ompt/tasks/lwts_info.c b/openmp/runtime/test/ompt/tasks/lwts_info.c new file mode 100644 --- /dev/null +++ b/openmp/runtime/test/ompt/tasks/lwts_info.c @@ -0,0 +1,122 @@ +// RUN: %libomp-compile-and-run | FileCheck %s +// REQUIRES: ompt + +#include "callback.h" +#include + + +__attribute__ ((noinline)) // workaround for bug in icc +void print_task_info_at(int ancestor_level, int id) +{ +#pragma omp critical + { + int task_type; + char buffer[2048]; + ompt_data_t *parallel_data; + ompt_data_t *task_data; + ompt_get_task_info(ancestor_level, &task_type, &task_data, NULL, ¶llel_data, NULL); + format_task_type(task_type, buffer); + printf("%" PRIu64 ": ancestor_level=%d id=%d task_type=%s=%d " + "parallel_id=%" PRIu64 " task_id=%" PRIu64 "\n", + ompt_get_thread_data()->value, ancestor_level, id, buffer, + task_type, parallel_data->value, task_data->value); + } +}; + + +int main() +{ + //initial task + print_task_info_at(0, 0); + +#pragma omp parallel num_threads(1) + { + // region 0 + // outermost lwt + print_task_info_at(0, 1); + +#pragma omp task + { + // task 0 + print_task_info_at(0, 2); + + // check hierarchy now + print_task_info_at(0, 2); + print_task_info_at(1, 1); + print_task_info_at(2, 0); + +#pragma omp parallel num_threads(1) + { + // region 1 + print_task_info_at(0, 3); + + // check hierarchy now + print_task_info_at(0, 3); + print_task_info_at(1, 2); + print_task_info_at(2, 1); + print_task_info_at(3, 0); + + print_task_info_at(0, 3); + } + + print_task_info_at(0, 2); + + }; + + print_task_info_at(0, 1); + + } + + print_task_info_at(0, 0); + + // Check if libomp supports the callbacks for this test. + // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create' + // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task' + + + // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]] + // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_initial_task_begin: parallel_id=[[PARALLEL_ID_0:[0-9]+]], task_id=[[TASK_ID_0:[0-9]+]], actual_parallelism=1, index=1, flags=1 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=0 task_type=ompt_task_initial=1 parallel_id=[[PARALLEL_ID_0]] task_id=[[TASK_ID_0]] + + // region 0 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[TASK_ID_0]], + // CHECK-SAME: parallel_id=[[PARALLEL_ID_1:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_1]], task_id=[[TASK_ID_1:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_1]] + + // task 0 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[TASK_ID_1]] + // CHECK-SAME: new_task_id=[[TASK_ID_2:[0-9]+]] + // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_undeferred=134217732 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=2 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_2]] + + // check hierarchy now + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=2 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_2]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=1 id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_1]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=2 id=0 task_type=ompt_task_initial=1 parallel_id=[[PARALLEL_ID_0]] task_id=[[TASK_ID_0]] + + // region 1 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[TASK_ID_2]], + // CHESK-SAME: parallel_id=[[PARALLEL_ID_2:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_2:[0-9]+]], task_id=[[TASK_ID_3:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=3 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_2]] task_id=[[TASK_ID_3]] + + // check hierarchy now + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=3 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_2]] task_id=[[TASK_ID_3]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=1 id=2 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_2]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=2 id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_1]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=3 id=0 task_type=ompt_task_initial=1 parallel_id=[[PARALLEL_ID_0]] task_id=[[TASK_ID_0]] + + // region 1 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=3 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_2]] task_id=[[TASK_ID_3]] + + // task 0 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=2 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_2]] + + // region 0 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_1]] + + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=0 task_type=ompt_task_initial=1 parallel_id=[[PARALLEL_ID_0]] task_id=[[TASK_ID_0]] + + return 0; +} \ No newline at end of file diff --git a/openmp/runtime/test/ompt/tasks/nested_lwts_if0_info.c b/openmp/runtime/test/ompt/tasks/nested_lwts_if0_info.c new file mode 100644 --- /dev/null +++ b/openmp/runtime/test/ompt/tasks/nested_lwts_if0_info.c @@ -0,0 +1,241 @@ +// RUN: %libomp-compile-and-run | FileCheck %s +// REQUIRES: ompt + +#include "callback.h" +#include + + +__attribute__ ((noinline)) // workaround for bug in icc +void print_task_info_at(int ancestor_level, int id) +{ +#pragma omp critical + { + int task_type; + char buffer[2048]; + ompt_data_t *parallel_data; + ompt_data_t *task_data; + ompt_get_task_info(ancestor_level, &task_type, &task_data, NULL, ¶llel_data, NULL); + format_task_type(task_type, buffer); + printf("%" PRIu64 ": ancestor_level=%d id=%d task_type=%s=%d " + "parallel_id=%" PRIu64 " task_id=%" PRIu64 "\n", + ompt_get_thread_data()->value, ancestor_level, id, buffer, + task_type, parallel_data->value, task_data->value); + } +}; + +int main() +{ + //initial task + print_task_info_at(0, 0); + +#pragma omp parallel if(0) + { + // region 0 + // outermost lwt + print_task_info_at(0, 1); + +#pragma omp parallel if(0) + { + // region 1 + print_task_info_at(0, 2); + +#pragma omp parallel if(0) + { + // region 2 + print_task_info_at(0, 3); + +#pragma omp task if(0) + { + // task 0 + print_task_info_at(0, 4); + +#pragma omp task if(0) + { + // task 1 + print_task_info_at(0, 5); + +#pragma omp task if(0) + { + // task 2 + print_task_info_at(0, 6); + + print_task_info_at(0, 6); + print_task_info_at(1, 5); + print_task_info_at(2, 4); + print_task_info_at(3, 3); + print_task_info_at(4, 2); + print_task_info_at(5, 1); + print_task_info_at(6, 0); + +#pragma omp parallel if(0) + { + // region 3 + print_task_info_at(0, 7); + +#pragma omp parallel if(0) + { + // region 4 + print_task_info_at(0, 8); + +#pragma omp parallel if(0) + { + // region 5 + print_task_info_at(0, 9); + + print_task_info_at(0, 9); + print_task_info_at(1, 8); + print_task_info_at(2, 7); + print_task_info_at(3, 6); + print_task_info_at(4, 5); + print_task_info_at(5, 4); + print_task_info_at(6, 3); + print_task_info_at(7, 2); + print_task_info_at(8, 1); + print_task_info_at(9, 0); + + print_task_info_at(0, 9); + } + + print_task_info_at(0, 8); + } + + print_task_info_at(0, 7); + } + + print_task_info_at(0, 6); + }; + + print_task_info_at(0, 5); + }; + + print_task_info_at(0, 4); + }; + + print_task_info_at(0, 3); + + } + print_task_info_at(0, 2); + + } + print_task_info_at(0, 1); + + } + + print_task_info_at(0, 0); + + // Check if libomp supports the callbacks for this test. + // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create' + // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task' + + + // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]] + // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_initial_task_begin: parallel_id=[[PARALLEL_ID_0:[0-9]+]], task_id=[[TASK_ID_0:[0-9]+]], actual_parallelism=1, index=1, flags=1 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=0 task_type=ompt_task_initial=1 parallel_id=[[PARALLEL_ID_0]] task_id=[[TASK_ID_0]] + + // region 0 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[TASK_ID_0]], + // CHECK-SAME: parallel_id=[[PARALLEL_ID_1:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_1]], task_id=[[TASK_ID_1:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_1]] + + // region 1 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[TASK_ID_1]], + // CHECK-SAME: parallel_id=[[PARALLEL_ID_2:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_2]], task_id=[[TASK_ID_2:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=2 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_2]] task_id=[[TASK_ID_2]] + + // region 2 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[TASK_ID_2]], + // CHECK-SAME: parallel_id=[[PARALLEL_ID_3:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_3]], task_id=[[TASK_ID_3:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=3 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_3]] + + // task 0 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[TASK_ID_3]] + // CHECK-SAME: new_task_id=[[TASK_ID_4:[0-9]+]] + // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_undeferred=134217732 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=4 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_4]] + + // task 1 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[TASK_ID_4]] + // CHECK-SAME: new_task_id=[[TASK_ID_5:[0-9]+]] + // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_undeferred=134217732 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=5 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_5]] + + // task 2 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[TASK_ID_5]] + // CHECK-SAME: new_task_id=[[TASK_ID_6:[0-9]+]] + // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_undeferred=134217732 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=6 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_6]] + + // check hierarchy + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=6 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_6]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=1 id=5 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_5]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=2 id=4 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_4]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=3 id=3 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_3]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=4 id=2 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_2]] task_id=[[TASK_ID_2]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=5 id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_1]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=6 id=0 task_type=ompt_task_initial=1 parallel_id=[[PARALLEL_ID_0]] task_id=[[TASK_ID_0]] + + // region 3 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[TASK_ID_6]] + // CHECK-SAME: parallel_id=[[PARALLEL_ID_4:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_4]], task_id=[[TASK_ID_7:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=7 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_4]] task_id=[[TASK_ID_7]] + + // region 4 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[TASK_ID_7]] + // CHECK-SAME: parallel_id=[[PARALLEL_ID_5:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_5]], task_id=[[TASK_ID_8:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=8 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_5]] task_id=[[TASK_ID_8]] + + // region 5 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[TASK_ID_8]] + // CHECK-SAME: parallel_id=[[PARALLEL_ID_6:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_6]], task_id=[[TASK_ID_9:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=9 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_6]] task_id=[[TASK_ID_9]] + + // check hierarchy + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=9 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_6]] task_id=[[TASK_ID_9]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=1 id=8 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_5]] task_id=[[TASK_ID_8]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=2 id=7 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_4]] task_id=[[TASK_ID_7]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=3 id=6 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_6]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=4 id=5 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_5]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=5 id=4 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_4]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=6 id=3 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_3]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=7 id=2 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_2]] task_id=[[TASK_ID_2]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=8 id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_1]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=9 id=0 task_type=ompt_task_initial=1 parallel_id=[[PARALLEL_ID_0]] task_id=[[TASK_ID_0]] + + // region 5 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=9 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_6]] task_id=[[TASK_ID_9]] + + // region 4 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=8 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_5]] task_id=[[TASK_ID_8]] + + // region 3 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=7 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_4]] task_id=[[TASK_ID_7]] + + // task 2 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=6 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_6]] + + // task 1 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=5 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_5]] + + // task 0 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=4 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_4]] + + // region 2 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=3 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_3]] + + // region 1 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=2 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_2]] task_id=[[TASK_ID_2]] + + // region 0 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_1]] + + // initial task + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=0 task_type=ompt_task_initial=1 parallel_id=[[PARALLEL_ID_0]] task_id=[[TASK_ID_0]] + + return 0; +} \ No newline at end of file diff --git a/openmp/runtime/test/ompt/tasks/nested_lwts_info.c b/openmp/runtime/test/ompt/tasks/nested_lwts_info.c new file mode 100644 --- /dev/null +++ b/openmp/runtime/test/ompt/tasks/nested_lwts_info.c @@ -0,0 +1,241 @@ +// RUN: %libomp-compile-and-run | FileCheck %s +// REQUIRES: ompt + +#include "callback.h" +#include + + +__attribute__ ((noinline)) // workaround for bug in icc +void print_task_info_at(int ancestor_level, int id) +{ +#pragma omp critical + { + int task_type; + char buffer[2048]; + ompt_data_t *parallel_data; + ompt_data_t *task_data; + ompt_get_task_info(ancestor_level, &task_type, &task_data, NULL, ¶llel_data, NULL); + format_task_type(task_type, buffer); + printf("%" PRIu64 ": ancestor_level=%d id=%d task_type=%s=%d " + "parallel_id=%" PRIu64 " task_id=%" PRIu64 "\n", + ompt_get_thread_data()->value, ancestor_level, id, buffer, + task_type, parallel_data->value, task_data->value); + } +}; + +int main() +{ + //initial task + print_task_info_at(0, 0); + +#pragma omp parallel num_threads(1) + { + // region 0 + // outermost lwt + print_task_info_at(0, 1); + +#pragma omp parallel num_threads(1) + { + // region 1 + print_task_info_at(0, 2); + +#pragma omp parallel num_threads(1) + { + // region 2 + print_task_info_at(0, 3); + +#pragma omp task + { + // task 0 + print_task_info_at(0, 4); + +#pragma omp task + { + // task 1 + print_task_info_at(0, 5); + +#pragma omp task + { + // task 2 + print_task_info_at(0, 6); + + print_task_info_at(0, 6); + print_task_info_at(1, 5); + print_task_info_at(2, 4); + print_task_info_at(3, 3); + print_task_info_at(4, 2); + print_task_info_at(5, 1); + print_task_info_at(6, 0); + +#pragma omp parallel num_threads(1) + { + // region 3 + print_task_info_at(0, 7); + +#pragma omp parallel num_threads(1) + { + // region 4 + print_task_info_at(0, 8); + +#pragma omp parallel num_threads(1) + { + // region 5 + print_task_info_at(0, 9); + + print_task_info_at(0, 9); + print_task_info_at(1, 8); + print_task_info_at(2, 7); + print_task_info_at(3, 6); + print_task_info_at(4, 5); + print_task_info_at(5, 4); + print_task_info_at(6, 3); + print_task_info_at(7, 2); + print_task_info_at(8, 1); + print_task_info_at(9, 0); + + print_task_info_at(0, 9); + } + + print_task_info_at(0, 8); + } + + print_task_info_at(0, 7); + } + + print_task_info_at(0, 6); + }; + + print_task_info_at(0, 5); + }; + + print_task_info_at(0, 4); + }; + + print_task_info_at(0, 3); + + } + print_task_info_at(0, 2); + + } + print_task_info_at(0, 1); + + } + + print_task_info_at(0, 0); + + // Check if libomp supports the callbacks for this test. + // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create' + // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task' + + + // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]] + // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_initial_task_begin: parallel_id=[[PARALLEL_ID_0:[0-9]+]], task_id=[[TASK_ID_0:[0-9]+]], actual_parallelism=1, index=1, flags=1 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=0 task_type=ompt_task_initial=1 parallel_id=[[PARALLEL_ID_0]] task_id=[[TASK_ID_0]] + + // region 0 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[TASK_ID_0]], + // CHECK-SAME: parallel_id=[[PARALLEL_ID_1:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_1]], task_id=[[TASK_ID_1:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_1]] + + // region 1 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[TASK_ID_1]], + // CHECK-SAME: parallel_id=[[PARALLEL_ID_2:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_2]], task_id=[[TASK_ID_2:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=2 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_2]] task_id=[[TASK_ID_2]] + + // region 2 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[TASK_ID_2]], + // CHECK-SAME: parallel_id=[[PARALLEL_ID_3:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_3]], task_id=[[TASK_ID_3:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=3 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_3]] + + // task 0 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[TASK_ID_3]] + // CHECK-SAME: new_task_id=[[TASK_ID_4:[0-9]+]] + // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_undeferred=134217732 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=4 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_4]] + + // task 1 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[TASK_ID_4]] + // CHECK-SAME: new_task_id=[[TASK_ID_5:[0-9]+]] + // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_undeferred=134217732 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=5 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_5]] + + // task 2 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[TASK_ID_5]] + // CHECK-SAME: new_task_id=[[TASK_ID_6:[0-9]+]] + // CHECK-SAME: task_type=ompt_task_explicit|ompt_task_undeferred=134217732 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=6 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_6]] + + // check hierarchy + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=6 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_6]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=1 id=5 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_5]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=2 id=4 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_4]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=3 id=3 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_3]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=4 id=2 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_2]] task_id=[[TASK_ID_2]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=5 id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_1]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=6 id=0 task_type=ompt_task_initial=1 parallel_id=[[PARALLEL_ID_0]] task_id=[[TASK_ID_0]] + + // region 3 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[TASK_ID_6]] + // CHECK-SAME: parallel_id=[[PARALLEL_ID_4:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_4]], task_id=[[TASK_ID_7:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=7 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_4]] task_id=[[TASK_ID_7]] + + // region 4 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[TASK_ID_7]] + // CHECK-SAME: parallel_id=[[PARALLEL_ID_5:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_5]], task_id=[[TASK_ID_8:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=8 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_5]] task_id=[[TASK_ID_8]] + + // region 5 + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[TASK_ID_8]] + // CHECK-SAME: parallel_id=[[PARALLEL_ID_6:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_6]], task_id=[[TASK_ID_9:[0-9]+]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=9 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_6]] task_id=[[TASK_ID_9]] + + // check hierarchy + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=9 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_6]] task_id=[[TASK_ID_9]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=1 id=8 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_5]] task_id=[[TASK_ID_8]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=2 id=7 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_4]] task_id=[[TASK_ID_7]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=3 id=6 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_6]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=4 id=5 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_5]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=5 id=4 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_4]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=6 id=3 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_3]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=7 id=2 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_2]] task_id=[[TASK_ID_2]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=8 id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_1]] + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=9 id=0 task_type=ompt_task_initial=1 parallel_id=[[PARALLEL_ID_0]] task_id=[[TASK_ID_0]] + + // region 5 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=9 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_6]] task_id=[[TASK_ID_9]] + + // region 4 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=8 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_5]] task_id=[[TASK_ID_8]] + + // region 3 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=7 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_4]] task_id=[[TASK_ID_7]] + + // task 2 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=6 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_6]] + + // task 1 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=5 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_5]] + + // task 0 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=4 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_4]] + + // region 2 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=3 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_3]] task_id=[[TASK_ID_3]] + + // region 1 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=2 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_2]] task_id=[[TASK_ID_2]] + + // region 0 + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 parallel_id=[[PARALLEL_ID_1]] task_id=[[TASK_ID_1]] + + // initial task + // CHECK: {{^}}[[MASTER_ID]]: ancestor_level=0 id=0 task_type=ompt_task_initial=1 parallel_id=[[PARALLEL_ID_0]] task_id=[[TASK_ID_0]] + + return 0; +} \ No newline at end of file