summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src/kmp_runtime.c
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2015-09-21 18:11:22 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2015-09-21 18:11:22 +0000
commitb68a85d1f68203ce2d51c83bc43657a1cd21491a (patch)
tree7eac31f92d23430f516ec9a28c060997a13adc6b /openmp/runtime/src/kmp_runtime.c
parentbe58ff82325e8892dc8199f2ca0acba887507895 (diff)
downloadbcm5719-llvm-b68a85d1f68203ce2d51c83bc43657a1cd21491a.tar.gz
bcm5719-llvm-b68a85d1f68203ce2d51c83bc43657a1cd21491a.zip
[OMPT] Simplify control variable logic for OMPT
Prior to this change, OMPT had a status flag ompt_status, which could take several values. This was due to an earlier OMPT design that had several levels of enablement (ready, disabled, tracking state, tracking callbacks). The current OMPT design has OMPT support either on or off. This revision replaces ompt_status with a boolean flag ompt_enabled, which simplifies the runtime logic for OMPT. Patch by John Mellor-Crummey Differential Revision: http://reviews.llvm.org/D12999 llvm-svn: 248189
Diffstat (limited to 'openmp/runtime/src/kmp_runtime.c')
-rw-r--r--openmp/runtime/src/kmp_runtime.c81
1 files changed, 35 insertions, 46 deletions
diff --git a/openmp/runtime/src/kmp_runtime.c b/openmp/runtime/src/kmp_runtime.c
index e02f5051fe4..4c75808735b 100644
--- a/openmp/runtime/src/kmp_runtime.c
+++ b/openmp/runtime/src/kmp_runtime.c
@@ -765,7 +765,7 @@ __kmp_parallel_dxo( int *gtid_ref, int *cid_ref, ident_t *loc_ref )
team->t.t_ordered.dt.t_value = ((tid + 1) % team->t.t_nproc );
#if OMPT_SUPPORT && OMPT_BLAME
- if ((ompt_status == ompt_status_track_callback) &&
+ if (ompt_enabled &&
ompt_callbacks.ompt_callback(ompt_event_release_ordered)) {
/* accept blame for "ordered" waiting */
kmp_info_t *this_thread = __kmp_threads[gtid];
@@ -1511,7 +1511,7 @@ __kmp_fork_call(
ompt_task_id_t my_task_id;
ompt_parallel_id_t my_parallel_id;
- if (ompt_status & ompt_status_track) {
+ if (ompt_enabled) {
ompt_parallel_id = __ompt_parallel_id_new(gtid);
ompt_task_id = __ompt_get_task_id_internal(0);
ompt_frame = __ompt_get_task_frame_internal(0);
@@ -1535,7 +1535,7 @@ __kmp_fork_call(
#endif
#if OMPT_SUPPORT
- if ((ompt_status == ompt_status_track_callback) &&
+ if (ompt_enabled &&
ompt_callbacks.ompt_callback(ompt_event_parallel_begin)) {
int team_size = master_set_numthreads;
@@ -1577,7 +1577,7 @@ __kmp_fork_call(
ompt_lw_taskteam_t lw_taskteam;
- if (ompt_status & ompt_status_track) {
+ if (ompt_enabled) {
__ompt_lw_taskteam_init(&lw_taskteam, master_th, gtid,
unwrapped_task, ompt_parallel_id);
lw_taskteam.ompt_task_info.task_id = __ompt_task_id_new(gtid);
@@ -1589,8 +1589,7 @@ __kmp_fork_call(
/* OMPT implicit task begin */
my_task_id = lw_taskteam.ompt_task_info.task_id;
my_parallel_id = parent_team->t.ompt_team_info.parallel_id;
- if ((ompt_status == ompt_status_track_callback) &&
- ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) {
+ if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) {
ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)(
my_parallel_id, my_task_id);
}
@@ -1613,12 +1612,11 @@ __kmp_fork_call(
}
#if OMPT_SUPPORT
- if (ompt_status & ompt_status_track) {
+ if (ompt_enabled) {
#if OMPT_TRACE
lw_taskteam.ompt_task_info.frame.exit_runtime_frame = 0;
- if ((ompt_status == ompt_status_track_callback) &&
- ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
+ if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)(
ompt_parallel_id, ompt_task_id);
}
@@ -1628,8 +1626,7 @@ __kmp_fork_call(
lw_taskteam.ompt_task_info.task_id = ompt_task_id_none;
#endif
- if ((ompt_status == ompt_status_track_callback) &&
- ompt_callbacks.ompt_callback(ompt_event_parallel_end)) {
+ if (ompt_callbacks.ompt_callback(ompt_event_parallel_end)) {
ompt_callbacks.ompt_callback(ompt_event_parallel_end)(
ompt_parallel_id, ompt_task_id,
OMPT_INVOKER(call_context));
@@ -1778,7 +1775,7 @@ __kmp_fork_call(
ompt_lw_taskteam_t lw_taskteam;
- if (ompt_status & ompt_status_track) {
+ if (ompt_enabled) {
__ompt_lw_taskteam_init(&lw_taskteam, master_th, gtid,
unwrapped_task, ompt_parallel_id);
lw_taskteam.ompt_task_info.task_id = __ompt_task_id_new(gtid);
@@ -1788,8 +1785,7 @@ __kmp_fork_call(
#if OMPT_TRACE
my_task_id = lw_taskteam.ompt_task_info.task_id;
- if ((ompt_status == ompt_status_track_callback) &&
- ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) {
+ if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) {
ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)(
ompt_parallel_id, my_task_id);
}
@@ -1812,12 +1808,11 @@ __kmp_fork_call(
}
#if OMPT_SUPPORT
- if (ompt_status & ompt_status_track) {
+ if (ompt_enabled) {
lw_taskteam.ompt_task_info.frame.exit_runtime_frame = 0;
#if OMPT_TRACE
- if ((ompt_status == ompt_status_track_callback) &&
- ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
+ if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)(
ompt_parallel_id, ompt_task_id);
}
@@ -1827,8 +1822,7 @@ __kmp_fork_call(
// reset clear the task id only after unlinking the task
lw_taskteam.ompt_task_info.task_id = ompt_task_id_none;
- if ((ompt_status == ompt_status_track_callback) &&
- ompt_callbacks.ompt_callback(ompt_event_parallel_end)) {
+ if (ompt_callbacks.ompt_callback(ompt_event_parallel_end)) {
ompt_callbacks.ompt_callback(ompt_event_parallel_end)(
ompt_parallel_id, ompt_task_id,
OMPT_INVOKER(call_context));
@@ -1883,7 +1877,7 @@ __kmp_fork_call(
ompt_lw_taskteam_t lw_taskteam;
- if (ompt_status & ompt_status_track) {
+ if (ompt_enabled) {
__ompt_lw_taskteam_init(&lw_taskteam, master_th, gtid,
unwrapped_task, ompt_parallel_id);
lw_taskteam.ompt_task_info.task_id = __ompt_task_id_new(gtid);
@@ -1895,8 +1889,7 @@ __kmp_fork_call(
/* OMPT implicit task begin */
my_task_id = lw_taskteam.ompt_task_info.task_id;
my_parallel_id = ompt_parallel_id;
- if ((ompt_status == ompt_status_track_callback) &&
- ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) {
+ if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) {
ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)(
my_parallel_id, my_task_id);
}
@@ -1919,12 +1912,11 @@ __kmp_fork_call(
}
#if OMPT_SUPPORT
- if (ompt_status & ompt_status_track) {
+ if (ompt_enabled) {
#if OMPT_TRACE
lw_taskteam.ompt_task_info.frame.exit_runtime_frame = 0;
- if ((ompt_status == ompt_status_track_callback) &&
- ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
+ if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)(
my_parallel_id, my_task_id);
}
@@ -1934,8 +1926,7 @@ __kmp_fork_call(
// reset clear the task id only after unlinking the task
lw_taskteam.ompt_task_info.task_id = ompt_task_id_none;
- if ((ompt_status == ompt_status_track_callback) &&
- ompt_callbacks.ompt_callback(ompt_event_parallel_end)) {
+ if (ompt_callbacks.ompt_callback(ompt_event_parallel_end)) {
ompt_callbacks.ompt_callback(ompt_event_parallel_end)(
ompt_parallel_id, ompt_task_id,
OMPT_INVOKER(call_context));
@@ -2245,7 +2236,7 @@ __kmp_fork_call(
KA_TRACE( 20, ("__kmp_fork_call: parallel exit T#%d\n", gtid ));
#if OMPT_SUPPORT
- if (ompt_status & ompt_status_track) {
+ if (ompt_enabled) {
master_th->th.ompt_thread_info.state = ompt_state_overhead;
}
#endif
@@ -2310,7 +2301,7 @@ __kmp_join_call(ident_t *loc, int gtid
master_th->th.th_ident = loc;
#if OMPT_SUPPORT
- if (ompt_status & ompt_status_track) {
+ if (ompt_enabled) {
master_th->th.ompt_thread_info.state = ompt_state_overhead;
}
#endif
@@ -2344,7 +2335,7 @@ __kmp_join_call(ident_t *loc, int gtid
__kmpc_end_serialized_parallel( loc, gtid );
#if OMPT_SUPPORT
- if (ompt_status == ompt_status_track_callback) {
+ if (ompt_enabled) {
__kmp_join_restore_state(master_th, parent_team);
}
#endif
@@ -2444,7 +2435,7 @@ __kmp_join_call(ident_t *loc, int gtid
}
#if OMPT_SUPPORT
- if (ompt_status == ompt_status_track_callback) {
+ if (ompt_enabled) {
__kmp_join_ompt(master_th, parent_team, parallel_id, fork_context);
}
#endif
@@ -2535,7 +2526,7 @@ __kmp_join_call(ident_t *loc, int gtid
__kmp_release_bootstrap_lock( &__kmp_forkjoin_lock );
#if OMPT_SUPPORT
- if (ompt_status == ompt_status_track_callback) {
+ if (ompt_enabled) {
__kmp_join_ompt(master_th, parent_team, parallel_id, fork_context);
}
#endif
@@ -3940,7 +3931,7 @@ __kmp_reset_root(int gtid, kmp_root_t *root)
#endif /* KMP_OS_WINDOWS */
#if OMPT_SUPPORT
- if ((ompt_status == ompt_status_track_callback) &&
+ if (ompt_enabled &&
ompt_callbacks.ompt_callback(ompt_event_thread_end)) {
int gtid = __kmp_get_gtid();
__ompt_thread_end(ompt_thread_initial, gtid);
@@ -5540,12 +5531,11 @@ __kmp_launch_thread( kmp_info_t *this_thr )
}
#if OMPT_SUPPORT
- if (ompt_status & ompt_status_track) {
+ if (ompt_enabled) {
this_thr->th.ompt_thread_info.state = ompt_state_overhead;
this_thr->th.ompt_thread_info.wait_id = 0;
this_thr->th.ompt_thread_info.idle_frame = __builtin_frame_address(0);
- if ((ompt_status == ompt_status_track_callback) &&
- ompt_callbacks.ompt_callback(ompt_event_thread_begin)) {
+ if (ompt_callbacks.ompt_callback(ompt_event_thread_begin)) {
__ompt_thread_begin(ompt_thread_worker, gtid);
}
}
@@ -5560,7 +5550,7 @@ __kmp_launch_thread( kmp_info_t *this_thr )
KA_TRACE( 20, ("__kmp_launch_thread: T#%d waiting for work\n", gtid ));
#if OMPT_SUPPORT
- if (ompt_status & ompt_status_track) {
+ if (ompt_enabled) {
this_thr->th.ompt_thread_info.state = ompt_state_idle;
}
#endif
@@ -5569,7 +5559,7 @@ __kmp_launch_thread( kmp_info_t *this_thr )
__kmp_fork_barrier( gtid, KMP_GTID_DNE );
#if OMPT_SUPPORT
- if (ompt_status & ompt_status_track) {
+ if (ompt_enabled) {
this_thr->th.ompt_thread_info.state = ompt_state_overhead;
}
#endif
@@ -5587,7 +5577,7 @@ __kmp_launch_thread( kmp_info_t *this_thr )
updateHWFPControl (*pteam);
#if OMPT_SUPPORT
- if (ompt_status & ompt_status_track) {
+ if (ompt_enabled) {
this_thr->th.ompt_thread_info.state = ompt_state_work_parallel;
// Initialize OMPT task id for implicit task.
int tid = __kmp_tid_from_gtid(gtid);
@@ -5605,7 +5595,7 @@ __kmp_launch_thread( kmp_info_t *this_thr )
KMP_ASSERT( rc );
#if OMPT_SUPPORT
- if (ompt_status & ompt_status_track) {
+ if (ompt_enabled) {
/* no frame set while outside task */
int tid = __kmp_tid_from_gtid(gtid);
(*pteam)->t.t_implicit_task_taskdata[tid].ompt_task_info.frame.exit_runtime_frame = 0;
@@ -5624,7 +5614,7 @@ __kmp_launch_thread( kmp_info_t *this_thr )
TCR_SYNC_PTR((intptr_t)__kmp_global.g.g_done);
#if OMPT_SUPPORT
- if ((ompt_status == ompt_status_track_callback) &&
+ if (ompt_enabled &&
ompt_callbacks.ompt_callback(ompt_event_thread_end)) {
__ompt_thread_end(ompt_thread_worker, gtid);
}
@@ -6910,7 +6900,7 @@ __kmp_invoke_task_func( int gtid )
ompt_task_id_t my_task_id;
ompt_parallel_id_t my_parallel_id;
- if (ompt_status & ompt_status_track) {
+ if (ompt_enabled) {
exit_runtime_p = &(team->t.t_implicit_task_taskdata[tid].
ompt_task_info.frame.exit_runtime_frame);
} else {
@@ -6920,7 +6910,7 @@ __kmp_invoke_task_func( int gtid )
#if OMPT_TRACE
my_task_id = team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id;
my_parallel_id = team->t.ompt_team_info.parallel_id;
- if ((ompt_status == ompt_status_track_callback) &&
+ if (ompt_enabled &&
ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) {
ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)(
my_parallel_id, my_task_id);
@@ -6939,9 +6929,8 @@ __kmp_invoke_task_func( int gtid )
}
#if OMPT_SUPPORT && OMPT_TRACE
- if (ompt_status & ompt_status_track) {
- if ((ompt_status == ompt_status_track_callback) &&
- ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
+ if (ompt_enabled) {
+ if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)(
my_parallel_id, my_task_id);
}
OpenPOWER on IntegriCloud