summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2015-10-09 17:42:52 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2015-10-09 17:42:52 +0000
commitf0344bb02b0f317ca6abe6a688547601def56ed9 (patch)
treec175e7126199235cba9d7f47551101b9545b650b /openmp/runtime/src
parentcca800207aac434f9de79123b1c8eedc30b1163a (diff)
downloadbcm5719-llvm-f0344bb02b0f317ca6abe6a688547601def56ed9.tar.gz
bcm5719-llvm-f0344bb02b0f317ca6abe6a688547601def56ed9.zip
[OMPT] Reduce overhead of OMPT
* Avoid computing state needed only by OMPT unless the ompt_enabled flag is set. * Properly handle a corner case in OMPT where team == NULL. Patch by John Mellor-Crummey Differential Revision: http://reviews.llvm.org/D13502 llvm-svn: 249857
Diffstat (limited to 'openmp/runtime/src')
-rw-r--r--openmp/runtime/src/kmp_csupport.c8
-rw-r--r--openmp/runtime/src/kmp_sched.cpp10
-rw-r--r--openmp/runtime/src/ompt-specific.c2
3 files changed, 14 insertions, 6 deletions
diff --git a/openmp/runtime/src/kmp_csupport.c b/openmp/runtime/src/kmp_csupport.c
index a9c74cc3340..385aa1dcc01 100644
--- a/openmp/runtime/src/kmp_csupport.c
+++ b/openmp/runtime/src/kmp_csupport.c
@@ -1485,12 +1485,12 @@ __kmpc_for_static_fini( ident_t *loc, kmp_int32 global_tid )
KE_TRACE( 10, ("__kmpc_for_static_fini called T#%d\n", global_tid));
#if OMPT_SUPPORT && OMPT_TRACE
- kmp_info_t *this_thr = __kmp_threads[ global_tid ];
- kmp_team_t *team = this_thr -> th.th_team;
- int tid = __kmp_tid_from_gtid( global_tid );
-
if (ompt_enabled &&
ompt_callbacks.ompt_callback(ompt_event_loop_end)) {
+ kmp_info_t *this_thr = __kmp_threads[ global_tid ];
+ kmp_team_t *team = this_thr -> th.th_team;
+ int tid = __kmp_tid_from_gtid( global_tid );
+
ompt_callbacks.ompt_callback(ompt_event_loop_end)(
team->t.ompt_team_info.parallel_id,
team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id);
diff --git a/openmp/runtime/src/kmp_sched.cpp b/openmp/runtime/src/kmp_sched.cpp
index a68c9af77d6..1977ca4d418 100644
--- a/openmp/runtime/src/kmp_sched.cpp
+++ b/openmp/runtime/src/kmp_sched.cpp
@@ -97,8 +97,14 @@ __kmp_for_static_init(
register kmp_info_t *th = __kmp_threads[ gtid ];
#if OMPT_SUPPORT && OMPT_TRACE
- ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
- ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
+ ompt_team_info_t *team_info = NULL;
+ ompt_task_info_t *task_info = NULL;
+
+ if (ompt_enabled) {
+ // Only fully initialize variables needed by OMPT if OMPT is enabled.
+ team_info = __ompt_get_teaminfo(0, NULL);
+ task_info = __ompt_get_taskinfo(0);
+ }
#endif
KMP_DEBUG_ASSERT( plastiter && plower && pupper && pstride );
diff --git a/openmp/runtime/src/ompt-specific.c b/openmp/runtime/src/ompt-specific.c
index d8d30dc5c01..c249e86beb1 100644
--- a/openmp/runtime/src/ompt-specific.c
+++ b/openmp/runtime/src/ompt-specific.c
@@ -50,6 +50,8 @@ __ompt_get_teaminfo(int depth, int *size)
if (thr) {
kmp_team *team = thr->th.th_team;
+ if (team == NULL) return NULL;
+
ompt_lw_taskteam_t *lwt = LWT_FROM_TEAM(team);
while(depth > 0) {
OpenPOWER on IntegriCloud