1 | // RUN: %libomp-compile && env OMP_NUM_THREADS='3' \ |
2 | // RUN: %libomp-run | %sort-threads | FileCheck %s |
3 | // REQUIRES: ompt |
4 | |
5 | // Checked gcc 10.1 still does not support detach clause on task construct. |
6 | // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7, gcc-8, gcc-9, gcc-10 |
7 | // gcc 11 introduced detach clause, but gomp interface in libomp has no support |
8 | // XFAIL: gcc-11, gcc-12 |
9 | // clang supports detach clause since version 11. |
10 | // UNSUPPORTED: clang-10, clang-9, clang-8, clang-7 |
11 | // icc compiler does not support detach clause. |
12 | // UNSUPPORTED: icc |
13 | |
14 | #include "callback.h" |
15 | #include <omp.h> |
16 | |
17 | int main() { |
18 | #pragma omp parallel |
19 | #pragma omp master |
20 | { |
21 | omp_event_handle_t event; |
22 | omp_event_handle_t *f_event; |
23 | #pragma omp task detach(event) depend(out : f_event) shared(f_event) if (0) |
24 | { |
25 | printf("task 1\n" ); |
26 | f_event = &event; |
27 | } |
28 | #pragma omp task depend(in : f_event) |
29 | { printf("task 2\n" ); } |
30 | printf("calling omp_fulfill_event\n" ); |
31 | omp_fulfill_event(event: *f_event); |
32 | #pragma omp taskwait |
33 | } |
34 | return 0; |
35 | } |
36 | |
37 | // Check if libomp supports the callbacks for this test. |
38 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create' |
39 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_schedule' |
40 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_begin' |
41 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_end' |
42 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task' |
43 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquire' |
44 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired' |
45 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released' |
46 | |
47 | // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]] |
48 | |
49 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: |
50 | // CHECK-SAME: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], |
51 | // CHECK-SAME: parent_task_frame.exit=[[NULL]], |
52 | // CHECK-SAME: parent_task_frame.reenter=0x{{[0-f]+}}, |
53 | // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-9]+]], |
54 | // CHECK-SAME: requested_team_size=3, |
55 | |
56 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: |
57 | // CHECK-SAME: parallel_id=[[PARALLEL_ID]], |
58 | // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID:[0-9]+]] |
59 | |
60 | // The following is to match the taskwait task created in __kmpc_omp_wait_deps |
61 | // this should go away, once codegen for "detached if(0)" is fixed |
62 | |
63 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: |
64 | // CHECK-SAME: parent_task_id=[[IMPLICIT_TASK_ID]], |
65 | // CHECK-SAME: has_dependences=yes |
66 | |
67 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: |
68 | // CHECK-SAME: parent_task_id=[[IMPLICIT_TASK_ID]], |
69 | // CHECK-SAME: parent_task_frame.exit=0x{{[0-f]+}}, |
70 | // CHECK-SAME: parent_task_frame.reenter=0x{{[0-f]+}}, |
71 | // CHECK-SAME: new_task_id=[[TASK_ID:[0-9]+]], |
72 | |
73 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_task_schedule: |
74 | // CHECK-SAME: first_task_id=[[IMPLICIT_TASK_ID]], |
75 | // CHECK-SAME: second_task_id=[[TASK_ID]], |
76 | // CHECK-SAME: prior_task_status=ompt_task_switch=7 |
77 | |
78 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_task_schedule: |
79 | // CHECK-SAME: first_task_id=[[TASK_ID]], |
80 | // CHECK-SAME: second_task_id=[[IMPLICIT_TASK_ID]], |
81 | // CHECK-SAME: prior_task_status=ompt_task_detach=4 |
82 | |
83 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_task_schedule: |
84 | // CHECK-SAME: first_task_id=[[TASK_ID]], |
85 | // CHECK-SAME: second_task_id=18446744073709551615, |
86 | // CHECK-SAME: prior_task_status=ompt_task_late_fulfill=6 |
87 | |