1*c46ccb85SJoachim Protze // RUN: %libomp-compile && env OMP_NUM_THREADS='3' \
210995c77SJoachim Protze // RUN: %libomp-run | %sort-threads | FileCheck %s
3617787eaSAndreyChurbanov // REQUIRES: ompt
410995c77SJoachim Protze
56d9626d2SJoachim Protze // Checked gcc 10.1 still does not support detach clause on task construct.
66d9626d2SJoachim Protze // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7, gcc-8, gcc-9, gcc-10
7*c46ccb85SJoachim Protze // gcc 11 introduced detach clause, but gomp interface in libomp has no support
8*c46ccb85SJoachim Protze // XFAIL: gcc-11, gcc-12
910995c77SJoachim Protze // clang supports detach clause since version 11.
1010995c77SJoachim Protze // UNSUPPORTED: clang-10, clang-9, clang-8, clang-7
1110995c77SJoachim Protze // icc compiler does not support detach clause.
1210995c77SJoachim Protze // UNSUPPORTED: icc
1310995c77SJoachim Protze
1410995c77SJoachim Protze #include "callback.h"
1510995c77SJoachim Protze #include <omp.h>
1610995c77SJoachim Protze
main()1710995c77SJoachim Protze int main() {
1810995c77SJoachim Protze #pragma omp parallel
1910995c77SJoachim Protze #pragma omp master
2010995c77SJoachim Protze {
2110995c77SJoachim Protze omp_event_handle_t event;
2210995c77SJoachim Protze #pragma omp task detach(event) if (0)
2310995c77SJoachim Protze { omp_fulfill_event(event); }
2410995c77SJoachim Protze #pragma omp taskwait
2510995c77SJoachim Protze }
2610995c77SJoachim Protze return 0;
2710995c77SJoachim Protze }
2810995c77SJoachim Protze
2910995c77SJoachim Protze // Check if libomp supports the callbacks for this test.
3010995c77SJoachim Protze // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create'
3110995c77SJoachim Protze // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_schedule'
3210995c77SJoachim Protze // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_begin'
3310995c77SJoachim Protze // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_end'
3410995c77SJoachim Protze // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task'
3510995c77SJoachim Protze // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquire'
3610995c77SJoachim Protze // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired'
3710995c77SJoachim Protze // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released'
3810995c77SJoachim Protze
3910995c77SJoachim Protze // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
4010995c77SJoachim Protze
4110995c77SJoachim Protze // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin:
4210995c77SJoachim Protze // CHECK-SAME: parent_task_id=[[PARENT_TASK_ID:[0-9]+]],
4310995c77SJoachim Protze // CHECK-SAME: parent_task_frame.exit=[[NULL]],
4410995c77SJoachim Protze // CHECK-SAME: parent_task_frame.reenter=0x{{[0-f]+}},
4510995c77SJoachim Protze // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-9]+]],
4610995c77SJoachim Protze // CHECK-SAME: requested_team_size=3,
4710995c77SJoachim Protze
4810995c77SJoachim Protze // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin:
4910995c77SJoachim Protze // CHECK-SAME: parallel_id=[[PARALLEL_ID]],
5010995c77SJoachim Protze // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
5110995c77SJoachim Protze
5210995c77SJoachim Protze // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create:
5310995c77SJoachim Protze // CHECK-SAME: parent_task_id=[[IMPLICIT_TASK_ID]],
5410995c77SJoachim Protze // CHECK-SAME: parent_task_frame.exit=0x{{[0-f]+}},
5510995c77SJoachim Protze // CHECK-SAME: parent_task_frame.reenter=0x{{[0-f]+}},
5610995c77SJoachim Protze // CHECK-SAME: new_task_id=[[TASK_ID:[0-9]+]],
5710995c77SJoachim Protze
5810995c77SJoachim Protze // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_task_schedule:
5910995c77SJoachim Protze // CHECK-SAME: first_task_id=[[IMPLICIT_TASK_ID]],
6010995c77SJoachim Protze // CHECK-SAME: second_task_id=[[TASK_ID]],
6110995c77SJoachim Protze // CHECK-SAME: prior_task_status=ompt_task_switch=7
6210995c77SJoachim Protze
6310995c77SJoachim Protze // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_task_schedule:
6410995c77SJoachim Protze // CHECK-SAME: first_task_id=[[TASK_ID]],
6510995c77SJoachim Protze // CHECK-SAME: second_task_id=18446744073709551615,
6610995c77SJoachim Protze // CHECK-SAME: prior_task_status=ompt_task_early_fulfill=5
6710995c77SJoachim Protze
6810995c77SJoachim Protze // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_task_schedule:
6910995c77SJoachim Protze // CHECK-SAME: first_task_id=[[TASK_ID]],
7010995c77SJoachim Protze // CHECK-SAME: second_task_id=[[IMPLICIT_TASK_ID]],
7110995c77SJoachim Protze // CHECK-SAME: prior_task_status=ompt_task_complete=1
72