1 // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s 2 // REQUIRES: ompt 3 4 // taskwait with depend clause was introduced with gcc-9 5 // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7, gcc-8 6 7 // clang does not yet support taskwait with depend clause 8 // clang-12 introduced parsing, but no codegen 9 // update expected result when codegen in clang was added 10 // XFAIL: clang 11 12 #include "callback.h" 13 #include <omp.h> 14 15 int main() { 16 int x = 0; 17 #pragma omp parallel num_threads(2) 18 { 19 #pragma omp master 20 { 21 print_ids(0); 22 printf("%" PRIu64 ": address of x: %p\n", ompt_get_thread_data()->value, 23 &x); 24 #pragma omp task depend(out : x) 25 { x++; } 26 print_fuzzy_address(1); 27 #pragma omp taskwait depend(in: x) 28 print_fuzzy_address(2); 29 } 30 } 31 32 return 0; 33 } 34 35 // Check if libomp supports the callbacks for this test. 36 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create' 37 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_dependences' 38 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_depende 39 40 // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]] 41 42 // make sure initial data pointers are null 43 // CHECK-NOT: 0: new_task_data initially not null 44 45 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_implicit_task_begin: 46 // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-9]+]], 47 // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID:[0-9]+]] 48 49 // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], 50 // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT:0x[0-f]+]], 51 // CHECK-SAME: reenter_frame=[[NULL]] 52 53 // CHECK: {{^}}[[MASTER_ID]]: address of x: [[ADDRX:0x[0-f]+]] 54 55 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: 56 // CHECK-SAME: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[EXIT]], 57 // CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}}, 58 // CHECK-SAME: new_task_id=[[FIRST_TASK:[0-f]+]], 59 // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}, 60 // CHECK-SAME: task_type=ompt_task_explicit=4, has_dependences=yes 61 62 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_dependences: 63 // CHECK-SAME: task_id=[[FIRST_TASK]], deps=[([[ADDRX]], 64 // CHECK-SAME: ompt_dependence_type_inout)], ndeps=1 65 66 // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]] 67 68 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: 69 // CHECK-SAME: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[EXIT]], 70 // CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}}, 71 // CHECK-SAME: new_task_id=[[SECOND_TASK:[0-f]+]], 72 // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}, 73 // CHECK-SAME: task_type=ompt_task_taskwait|ompt_task_undeferred| 74 // CHECK-SAME: ompt_task_mergeable=1207959568, has_dependences=yes 75 76 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_dependences: 77 // CHECK-SAME: task_id=[[SECOND_TASK]], deps=[([[ADDRX]], 78 // CHECK-SAME: ompt_dependence_type_in)], ndeps=1 79 80 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_end: task_id=[[SECOND_TASK]] 81 82 // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]] 83