static void __kmp_invoke_task(kmp_int32 gtid, kmp_task_t *task,
kmp_taskdata_t *current_task) {
kmp_taskdata_t *taskdata = KMP_TASK_TO_TASKDATA(task);
+ kmp_info_t *thread;
#if OMP_40_ENABLED
int discard = 0 /* false */;
#endif
}
#endif
-#if USE_ITT_BUILD && USE_ITT_NOTIFY
- kmp_uint64 cur_time;
- if (__kmp_forkjoin_frames_mode == 3) {
- // Get the current time stamp to measure task execution time to correct
- // barrier imbalance time
- cur_time = __itt_get_timestamp();
- }
-#endif
-
#if OMPT_SUPPORT
// For untied tasks, the first task executed only calls __kmpc_omp_task and
// does not execute code.
ompt_thread_info_t oldInfo;
- kmp_info_t *thread;
if (UNLIKELY(ompt_enabled.enabled)) {
// Store the threads states and restore them after the task
thread = __kmp_threads[gtid];
// TODO: check if this sequence can be hoisted above __kmp_task_start
// if cancellation has been enabled for this run ...
if (__kmp_omp_cancellation) {
- kmp_info_t *this_thr = __kmp_threads[gtid];
- kmp_team_t *this_team = this_thr->th.th_team;
+ thread = __kmp_threads[gtid];
+ kmp_team_t *this_team = thread->th.th_team;
kmp_taskgroup_t *taskgroup = taskdata->td_taskgroup;
if ((taskgroup && taskgroup->cancel_request) ||
(this_team->t.t_cancel_request == cancel_parallel)) {
__ompt_task_start(task, current_task, gtid);
#endif
+#if USE_ITT_BUILD && USE_ITT_NOTIFY
+ kmp_uint64 cur_time;
+ kmp_int32 kmp_itt_count_task =
+ __kmp_forkjoin_frames_mode == 3 && !taskdata->td_flags.task_serial &&
+ current_task->td_flags.tasktype == TASK_IMPLICIT;
+ if (kmp_itt_count_task) {
+ thread = __kmp_threads[gtid];
+ // Time outer level explicit task on barrier for adjusting imbalance time
+ if (thread->th.th_bar_arrive_time)
+ cur_time = __itt_get_timestamp();
+ else
+ kmp_itt_count_task = 0; // thread is not on a barrier - skip timing
+ }
+#endif
+
#ifdef KMP_GOMP_COMPAT
if (taskdata->td_flags.native) {
((void (*)(void *))(*(task->routine)))(task->shareds);
}
KMP_POP_PARTITIONED_TIMER();
+#if USE_ITT_BUILD && USE_ITT_NOTIFY
+ if (kmp_itt_count_task) {
+ // Barrier imbalance - adjust arrive time with the task duration
+ thread->th.th_bar_arrive_time += (__itt_get_timestamp() - cur_time);
+ }
+#endif
+
#if OMP_40_ENABLED
}
#endif // OMP_40_ENABLED
}
#endif
-#if USE_ITT_BUILD && USE_ITT_NOTIFY
- // Barrier imbalance - correct arrive time after the task finished
- if (__kmp_forkjoin_frames_mode == 3) {
- kmp_info_t *this_thr = __kmp_threads[gtid];
- if (this_thr->th.th_bar_arrive_time) {
- this_thr->th.th_bar_arrive_time += (__itt_get_timestamp() - cur_time);
- }
- }
-#endif
KA_TRACE(
30,
("__kmp_invoke_task(exit): T#%d completed task %p, resuming task %p\n",