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