summaryrefslogtreecommitdiffstats
path: root/openmp
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2015-10-09 17:38:05 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2015-10-09 17:38:05 +0000
commitb401db6d739987508854ee26d674a66ca8cda673 (patch)
treecdf27fc0d9109f6c9301c15b1fba6e98236d0471 /openmp
parent21a7f23666e7717fe2a1164de79b45dca4a443ef (diff)
downloadbcm5719-llvm-b401db6d739987508854ee26d674a66ca8cda673.tar.gz
bcm5719-llvm-b401db6d739987508854ee26d674a66ca8cda673.zip
[OMPT] Initialize task fields only if needed
Because __kmp_task_init_ompt is called for every initial task in each thread and always generated task ids, this was a big performance issue on bigger systems even without any tool attached. After changing the initialization interface to ompt_tool, we can now rely on already knowing whether a tool is attached and OMPT is enabled at this point. Patch by Jonas Hahnfeld Differential Revision: http://reviews.llvm.org/D13494 llvm-svn: 249855
Diffstat (limited to 'openmp')
-rw-r--r--openmp/runtime/src/kmp.h3
-rw-r--r--openmp/runtime/src/kmp_tasking.c29
2 files changed, 12 insertions, 20 deletions
diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index 4538191226c..cd9c0b65163 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -3150,9 +3150,6 @@ extern void __kmp_pop_current_task_from_thread( kmp_info_t *this_thr );
extern kmp_task_t* __kmp_task_alloc( ident_t *loc_ref, kmp_int32 gtid,
kmp_tasking_flags_t *flags, size_t sizeof_kmp_task_t, size_t sizeof_shareds,
kmp_routine_entry_t task_entry );
-#if OMPT_SUPPORT
-extern void __kmp_task_init_ompt( kmp_taskdata_t * task, int tid );
-#endif
extern void __kmp_init_implicit_task( ident_t *loc_ref, kmp_info_t *this_thr,
kmp_team_t *team, int tid, int set_curr_task );
diff --git a/openmp/runtime/src/kmp_tasking.c b/openmp/runtime/src/kmp_tasking.c
index 3a363c13398..9d8c06474b7 100644
--- a/openmp/runtime/src/kmp_tasking.c
+++ b/openmp/runtime/src/kmp_tasking.c
@@ -750,18 +750,18 @@ __kmpc_omp_task_complete( ident_t *loc_ref, kmp_int32 gtid, kmp_task_t *task )
#if OMPT_SUPPORT
//----------------------------------------------------------------------------------------------------
// __kmp_task_init_ompt:
-// Initialize OMPT fields maintained by a task. Since the serial task is initialized before
-// ompt_initialize is called, at the point the serial task is initialized we don't know whether
-// OMPT will be used or not when the serial task is initialized. This function provides the support
-// needed to initialize OMPT for the serial task after the fact.
+// Initialize OMPT fields maintained by a task. This will only be called after
+// ompt_tool, so we already know whether ompt is enabled or not.
-void
-__kmp_task_init_ompt( kmp_taskdata_t * task, int tid )
+static inline void
+__kmp_task_init_ompt( kmp_taskdata_t * task, int tid, void * function )
{
- task->ompt_task_info.task_id = __ompt_task_id_new(tid);
- task->ompt_task_info.function = NULL;
- task->ompt_task_info.frame.exit_runtime_frame = NULL;
- task->ompt_task_info.frame.reenter_runtime_frame = NULL;
+ if (ompt_enabled) {
+ task->ompt_task_info.task_id = __ompt_task_id_new(tid);
+ task->ompt_task_info.function = function;
+ task->ompt_task_info.frame.exit_runtime_frame = NULL;
+ task->ompt_task_info.frame.reenter_runtime_frame = NULL;
+ }
}
#endif
@@ -827,7 +827,7 @@ __kmp_init_implicit_task( ident_t *loc_ref, kmp_info_t *this_thr, kmp_team_t *te
}
#if OMPT_SUPPORT
- __kmp_task_init_ompt(task, tid);
+ __kmp_task_init_ompt(task, tid, NULL);
#endif
KF_TRACE(10, ("__kmp_init_implicit_task(exit): T#:%d team=%p task=%p\n",
@@ -1032,12 +1032,7 @@ __kmp_task_alloc( ident_t *loc_ref, kmp_int32 gtid, kmp_tasking_flags_t *flags,
gtid, taskdata, taskdata->td_parent) );
#if OMPT_SUPPORT
- if (ompt_enabled) {
- taskdata->ompt_task_info.task_id = __ompt_task_id_new(gtid);
- taskdata->ompt_task_info.function = (void*) task_entry;
- taskdata->ompt_task_info.frame.exit_runtime_frame = NULL;
- taskdata->ompt_task_info.frame.reenter_runtime_frame = NULL;
- }
+ __kmp_task_init_ompt(taskdata, gtid, (void*) task_entry);
#endif
return task;
OpenPOWER on IntegriCloud