@@ -715,12 +715,13 @@ __kmpc_barrier(ident_t *loc, kmp_int32 global_tid)
715
715
__kmp_check_barrier ( global_tid, ct_barrier, loc );
716
716
}
717
717
718
- #if OMPT_SUPPORT && OMPT_OPTIONAL
718
+ #if OMPT_SUPPORT
719
719
ompt_frame_t * ompt_frame;
720
720
if (ompt_enabled ) {
721
721
__ompt_get_task_info_internal (0 , NULL , NULL , &ompt_frame, NULL , NULL );
722
722
if ( ompt_frame->reenter_runtime_frame == NULL )
723
723
ompt_frame->reenter_runtime_frame = OMPT_GET_FRAME_ADDRESS (1 );
724
+ OMPT_STORE_KMP_RETURN_ADDRESS (global_tid);
724
725
}
725
726
#endif
726
727
__kmp_threads[ global_tid ]->th .th_ident = loc;
@@ -1528,10 +1529,24 @@ __kmpc_barrier_master(ident_t *loc, kmp_int32 global_tid)
1528
1529
if ( __kmp_env_consistency_check )
1529
1530
__kmp_check_barrier ( global_tid, ct_barrier, loc );
1530
1531
1532
+ #if OMPT_SUPPORT
1533
+ ompt_frame_t * ompt_frame;
1534
+ if (ompt_enabled ) {
1535
+ __ompt_get_task_info_internal (0 , NULL , NULL , &ompt_frame, NULL , NULL );
1536
+ if ( ompt_frame->reenter_runtime_frame == NULL )
1537
+ ompt_frame->reenter_runtime_frame = OMPT_GET_FRAME_ADDRESS (1 );
1538
+ OMPT_STORE_KMP_RETURN_ADDRESS (global_tid);
1539
+ }
1540
+ #endif
1531
1541
#if USE_ITT_NOTIFY
1532
1542
__kmp_threads[global_tid]->th .th_ident = loc;
1533
1543
#endif
1534
1544
status = __kmp_barrier ( bs_plain_barrier, global_tid, TRUE , 0 , NULL , NULL );
1545
+ #if OMPT_SUPPORT && OMPT_OPTIONAL
1546
+ if (ompt_enabled ) {
1547
+ ompt_frame->reenter_runtime_frame = NULL ;
1548
+ }
1549
+ #endif
1535
1550
1536
1551
return (status != 0 ) ? 0 : 1 ;
1537
1552
}
@@ -1580,10 +1595,24 @@ __kmpc_barrier_master_nowait( ident_t * loc, kmp_int32 global_tid )
1580
1595
__kmp_check_barrier ( global_tid, ct_barrier, loc );
1581
1596
}
1582
1597
1598
+ #if OMPT_SUPPORT
1599
+ ompt_frame_t * ompt_frame;
1600
+ if (ompt_enabled ) {
1601
+ __ompt_get_task_info_internal (0 , NULL , NULL , &ompt_frame, NULL , NULL );
1602
+ if ( ompt_frame->reenter_runtime_frame == NULL )
1603
+ ompt_frame->reenter_runtime_frame = OMPT_GET_FRAME_ADDRESS (1 );
1604
+ OMPT_STORE_KMP_RETURN_ADDRESS (global_tid);
1605
+ }
1606
+ #endif
1583
1607
#if USE_ITT_NOTIFY
1584
1608
__kmp_threads[global_tid]->th .th_ident = loc;
1585
1609
#endif
1586
1610
__kmp_barrier ( bs_plain_barrier, global_tid, FALSE , 0 , NULL , NULL );
1611
+ #if OMPT_SUPPORT && OMPT_OPTIONAL
1612
+ if (ompt_enabled ) {
1613
+ ompt_frame->reenter_runtime_frame = NULL ;
1614
+ }
1615
+ #endif
1587
1616
1588
1617
ret = __kmpc_master (loc, global_tid);
1589
1618
@@ -1953,6 +1982,15 @@ __kmpc_copyprivate( ident_t *loc, kmp_int32 gtid, size_t cpy_size, void *cpy_dat
1953
1982
1954
1983
if (didit) *data_ptr = cpy_data;
1955
1984
1985
+ #if OMPT_SUPPORT
1986
+ ompt_frame_t * ompt_frame;
1987
+ if (ompt_enabled ) {
1988
+ __ompt_get_task_info_internal (0 , NULL , NULL , &ompt_frame, NULL , NULL );
1989
+ if ( ompt_frame->reenter_runtime_frame == NULL )
1990
+ ompt_frame->reenter_runtime_frame = OMPT_GET_FRAME_ADDRESS (1 );
1991
+ OMPT_STORE_KMP_RETURN_ADDRESS (gtid);
1992
+ }
1993
+ #endif
1956
1994
/* This barrier is not a barrier region boundary */
1957
1995
#if USE_ITT_NOTIFY
1958
1996
__kmp_threads[gtid]->th .th_ident = loc;
@@ -1964,10 +2002,20 @@ __kmpc_copyprivate( ident_t *loc, kmp_int32 gtid, size_t cpy_size, void *cpy_dat
1964
2002
/* Consider next barrier the user-visible barrier for barrier region boundaries */
1965
2003
/* Nesting checks are already handled by the single construct checks */
1966
2004
2005
+ #if OMPT_SUPPORT
2006
+ if (ompt_enabled ) {
2007
+ OMPT_STORE_KMP_RETURN_ADDRESS (gtid);
2008
+ }
2009
+ #endif
1967
2010
#if USE_ITT_NOTIFY
1968
2011
__kmp_threads[gtid]->th .th_ident = loc; // TODO: check if it is needed (e.g. tasks can overwrite the location)
1969
2012
#endif
1970
2013
__kmp_barrier ( bs_plain_barrier, gtid, FALSE , 0 , NULL , NULL );
2014
+ #if OMPT_SUPPORT && OMPT_OPTIONAL
2015
+ if (ompt_enabled ) {
2016
+ ompt_frame->reenter_runtime_frame = NULL ;
2017
+ }
2018
+ #endif
1971
2019
}
1972
2020
1973
2021
/* -------------------------------------------------------------------------- */
@@ -3271,11 +3319,28 @@ __kmpc_reduce_nowait(
3271
3319
3272
3320
// this barrier should be invisible to a customer and to the threading profile tool
3273
3321
// (it's neither a terminating barrier nor customer's code, it's used for an internal purpose)
3322
+ #if OMPT_SUPPORT
3323
+ // JP: can this barrier potentially leed to task scheduling?
3324
+ // JP: as long as there is a barrier in the implementation, OMPT should and will provide the barrier events
3325
+ // so we set-up the necessary frame/return addresses.
3326
+ ompt_frame_t * ompt_frame;
3327
+ if (ompt_enabled ) {
3328
+ __ompt_get_task_info_internal (0 , NULL , NULL , &ompt_frame, NULL , NULL );
3329
+ if ( ompt_frame->reenter_runtime_frame == NULL )
3330
+ ompt_frame->reenter_runtime_frame = OMPT_GET_FRAME_ADDRESS (1 );
3331
+ OMPT_STORE_KMP_RETURN_ADDRESS (global_tid);
3332
+ }
3333
+ #endif
3274
3334
#if USE_ITT_NOTIFY
3275
3335
__kmp_threads[global_tid]->th .th_ident = loc;
3276
3336
#endif
3277
3337
retval = __kmp_barrier ( UNPACK_REDUCTION_BARRIER ( packed_reduction_method ), global_tid, FALSE , reduce_size, reduce_data, reduce_func );
3278
3338
retval = ( retval != 0 ) ? ( 0 ) : ( 1 );
3339
+ #if OMPT_SUPPORT && OMPT_OPTIONAL
3340
+ if (ompt_enabled ) {
3341
+ ompt_frame->reenter_runtime_frame = NULL ;
3342
+ }
3343
+ #endif
3279
3344
3280
3345
// all other workers except master should do this pop here
3281
3346
// ( none of other workers will get to __kmpc_end_reduce_nowait() )
@@ -3424,11 +3489,25 @@ __kmpc_reduce(
3424
3489
// case tree_reduce_block:
3425
3490
// this barrier should be visible to a customer and to the threading profile tool
3426
3491
// (it's a terminating barrier on constructs if NOWAIT not specified)
3492
+ #if OMPT_SUPPORT
3493
+ ompt_frame_t * ompt_frame;
3494
+ if (ompt_enabled ) {
3495
+ __ompt_get_task_info_internal (0 , NULL , NULL , &ompt_frame, NULL , NULL );
3496
+ if ( ompt_frame->reenter_runtime_frame == NULL )
3497
+ ompt_frame->reenter_runtime_frame = OMPT_GET_FRAME_ADDRESS (1 );
3498
+ OMPT_STORE_KMP_RETURN_ADDRESS (global_tid);
3499
+ }
3500
+ #endif
3427
3501
#if USE_ITT_NOTIFY
3428
3502
__kmp_threads[global_tid]->th .th_ident = loc; // needed for correct notification of frames
3429
3503
#endif
3430
3504
retval = __kmp_barrier ( UNPACK_REDUCTION_BARRIER ( packed_reduction_method ), global_tid, TRUE , reduce_size, reduce_data, reduce_func );
3431
3505
retval = ( retval != 0 ) ? ( 0 ) : ( 1 );
3506
+ #if OMPT_SUPPORT && OMPT_OPTIONAL
3507
+ if (ompt_enabled ) {
3508
+ ompt_frame->reenter_runtime_frame = NULL ;
3509
+ }
3510
+ #endif
3432
3511
3433
3512
// all other workers except master should do this pop here
3434
3513
// ( none of other workers except master will enter __kmpc_end_reduce() )
@@ -3476,28 +3555,70 @@ __kmpc_end_reduce( ident_t *loc, kmp_int32 global_tid, kmp_critical_name *lck )
3476
3555
__kmp_end_critical_section_reduce_block ( loc, global_tid, lck );
3477
3556
3478
3557
// TODO: implicit barrier: should be exposed
3558
+ #if OMPT_SUPPORT
3559
+ ompt_frame_t * ompt_frame;
3560
+ if (ompt_enabled ) {
3561
+ __ompt_get_task_info_internal (0 , NULL , NULL , &ompt_frame, NULL , NULL );
3562
+ if ( ompt_frame->reenter_runtime_frame == NULL )
3563
+ ompt_frame->reenter_runtime_frame = OMPT_GET_FRAME_ADDRESS (1 );
3564
+ OMPT_STORE_KMP_RETURN_ADDRESS (global_tid);
3565
+ }
3566
+ #endif
3479
3567
#if USE_ITT_NOTIFY
3480
3568
__kmp_threads[global_tid]->th .th_ident = loc;
3481
3569
#endif
3482
3570
__kmp_barrier ( bs_plain_barrier, global_tid, FALSE , 0 , NULL , NULL );
3571
+ #if OMPT_SUPPORT && OMPT_OPTIONAL
3572
+ if (ompt_enabled ) {
3573
+ ompt_frame->reenter_runtime_frame = NULL ;
3574
+ }
3575
+ #endif
3483
3576
3484
3577
} else if ( packed_reduction_method == empty_reduce_block ) {
3485
3578
3486
3579
// usage: if team size == 1, no synchronization is required ( Intel platforms only )
3487
3580
3488
3581
// TODO: implicit barrier: should be exposed
3582
+ #if OMPT_SUPPORT
3583
+ ompt_frame_t * ompt_frame;
3584
+ if (ompt_enabled ) {
3585
+ __ompt_get_task_info_internal (0 , NULL , NULL , &ompt_frame, NULL , NULL );
3586
+ if ( ompt_frame->reenter_runtime_frame == NULL )
3587
+ ompt_frame->reenter_runtime_frame = OMPT_GET_FRAME_ADDRESS (1 );
3588
+ OMPT_STORE_KMP_RETURN_ADDRESS (global_tid);
3589
+ }
3590
+ #endif
3489
3591
#if USE_ITT_NOTIFY
3490
3592
__kmp_threads[global_tid]->th .th_ident = loc;
3491
3593
#endif
3492
3594
__kmp_barrier ( bs_plain_barrier, global_tid, FALSE , 0 , NULL , NULL );
3595
+ #if OMPT_SUPPORT && OMPT_OPTIONAL
3596
+ if (ompt_enabled ) {
3597
+ ompt_frame->reenter_runtime_frame = NULL ;
3598
+ }
3599
+ #endif
3493
3600
3494
3601
} else if ( packed_reduction_method == atomic_reduce_block ) {
3495
3602
3603
+ #if OMPT_SUPPORT
3604
+ ompt_frame_t * ompt_frame;
3605
+ if (ompt_enabled ) {
3606
+ __ompt_get_task_info_internal (0 , NULL , NULL , &ompt_frame, NULL , NULL );
3607
+ if ( ompt_frame->reenter_runtime_frame == NULL )
3608
+ ompt_frame->reenter_runtime_frame = OMPT_GET_FRAME_ADDRESS (1 );
3609
+ OMPT_STORE_KMP_RETURN_ADDRESS (global_tid);
3610
+ }
3611
+ #endif
3496
3612
// TODO: implicit barrier: should be exposed
3497
3613
#if USE_ITT_NOTIFY
3498
3614
__kmp_threads[global_tid]->th .th_ident = loc;
3499
3615
#endif
3500
3616
__kmp_barrier ( bs_plain_barrier, global_tid, FALSE , 0 , NULL , NULL );
3617
+ #if OMPT_SUPPORT && OMPT_OPTIONAL
3618
+ if (ompt_enabled ) {
3619
+ ompt_frame->reenter_runtime_frame = NULL ;
3620
+ }
3621
+ #endif
3501
3622
3502
3623
} else if ( TEST_REDUCTION_METHOD ( packed_reduction_method, tree_reduce_block ) ) {
3503
3624
0 commit comments