Revert "Updating implementation of OMPT as specified in OpenMP 5.0 Preview 2 (TR6)"
This reverts commit r317339 which discarded some recent commits.
llvm-svn: 317346
diff --git a/openmp/runtime/src/kmp_tasking.cpp b/openmp/runtime/src/kmp_tasking.cpp
index 748f36a..154a9f9 100644
--- a/openmp/runtime/src/kmp_tasking.cpp
+++ b/openmp/runtime/src/kmp_tasking.cpp
@@ -536,7 +536,6 @@
taskdata->td_flags.task_serial =
1; // Execute this task immediately, not deferred.
-
__kmp_task_start(gtid, task, current_task);
#if OMPT_SUPPORT
@@ -567,8 +566,8 @@
kmp_task_t *task,
void *frame_address,
void *return_address) {
- return __kmpc_omp_task_begin_if0_template<true>(
- loc_ref, gtid, task, frame_address, return_address);
+ __kmpc_omp_task_begin_if0_template<true>(loc_ref, gtid, task, frame_address,
+ return_address);
}
#endif // OMPT_SUPPORT
@@ -589,8 +588,7 @@
return;
}
#endif
- return __kmpc_omp_task_begin_if0_template<false>(loc_ref, gtid, task, NULL,
- NULL);
+ __kmpc_omp_task_begin_if0_template<false>(loc_ref, gtid, task, NULL, NULL);
}
#ifdef TASK_UNUSED
@@ -845,7 +843,6 @@
kmp_task_t *task) {
KA_TRACE(10, ("__kmpc_omp_task_complete_if0(enter): T#%d loc=%p task=%p\n",
gtid, loc_ref, KMP_TASK_TO_TASKDATA(task)));
-
// this routine will provide task to resume
__kmp_task_finish(gtid, task, NULL);
@@ -968,7 +965,7 @@
}
#if OMPT_SUPPORT
- if (__builtin_expect(ompt_enabled.enabled, 0))
+ if (UNLIKELY(ompt_enabled.enabled))
__ompt_task_init(task, tid);
#endif
@@ -1214,7 +1211,7 @@
ANNOTATE_HAPPENS_BEFORE(task);
#if OMPT_SUPPORT
- if (__builtin_expect(ompt_enabled.enabled, 0))
+ if (UNLIKELY(ompt_enabled.enabled))
__ompt_task_init(taskdata, gtid);
#endif
@@ -1309,7 +1306,7 @@
#if OMPT_SUPPORT
ompt_thread_info_t oldInfo;
kmp_info_t *thread;
- if (__builtin_expect(ompt_enabled.enabled, 0)) {
+ if (UNLIKELY(ompt_enabled.enabled)) {
// Store the threads states and restore them after the task
thread = __kmp_threads[gtid];
oldInfo = thread->th.ompt_thread_info;
@@ -1333,7 +1330,7 @@
(this_team->t.t_cancel_request == cancel_parallel)) {
#if OMPT_SUPPORT && OMPT_OPTIONAL
ompt_data_t *task_data;
- if (__builtin_expect(ompt_enabled.ompt_callback_cancel, 0)) {
+ if (UNLIKELY(ompt_enabled.ompt_callback_cancel)) {
__ompt_get_task_info_internal(0, NULL, &task_data, NULL, NULL, NULL);
ompt_callbacks.ompt_callback(ompt_callback_cancel)(
task_data,
@@ -1379,7 +1376,7 @@
// OMPT task begin
#if OMPT_SUPPORT
- if (__builtin_expect(ompt_enabled.enabled, 0))
+ if (UNLIKELY(ompt_enabled.enabled))
__ompt_task_start(task, current_task, gtid);
#endif
@@ -1394,7 +1391,7 @@
KMP_POP_PARTITIONED_TIMER();
#if OMPT_SUPPORT
- if (__builtin_expect(ompt_enabled.enabled, 0))
+ if (UNLIKELY(ompt_enabled.enabled))
__ompt_task_finish(task, current_task);
#endif
#if OMP_40_ENABLED
@@ -1402,7 +1399,7 @@
#endif // OMP_40_ENABLED
#if OMPT_SUPPORT
- if (__builtin_expect(ompt_enabled.enabled, 0)) {
+ if (UNLIKELY(ompt_enabled.enabled)) {
thread->th.ompt_thread_info = oldInfo;
taskdata->ompt_task_info.frame.exit_frame = NULL;
}
@@ -1453,7 +1450,7 @@
#if OMPT_SUPPORT
kmp_taskdata_t *parent;
- if (__builtin_expect(ompt_enabled.enabled, 0)) {
+ if (UNLIKELY(ompt_enabled.enabled)) {
parent = new_taskdata->td_parent;
if (ompt_enabled.ompt_callback_task_create) {
ompt_data_t task_data = ompt_data_none;
@@ -1484,7 +1481,7 @@
ANNOTATE_HAPPENS_BEFORE(new_task);
#if OMPT_SUPPORT
- if (__builtin_expect(ompt_enabled.enabled, 0)) {
+ if (UNLIKELY(ompt_enabled.enabled)) {
parent->ompt_task_info.frame.enter_frame = NULL;
}
#endif
@@ -1550,8 +1547,7 @@
#if OMPT_SUPPORT
kmp_taskdata_t *parent = NULL;
- if (__builtin_expect(ompt_enabled.enabled && !new_taskdata->td_flags.started,
- 0)) {
+ if (UNLIKELY(ompt_enabled.enabled && !new_taskdata->td_flags.started)) {
OMPT_STORE_RETURN_ADDRESS(gtid);
parent = new_taskdata->td_parent;
if (!parent->ompt_task_info.frame.enter_frame)
@@ -1574,7 +1570,7 @@
"TASK_CURRENT_NOT_QUEUED: loc=%p task=%p\n",
gtid, loc_ref, new_taskdata));
#if OMPT_SUPPORT
- if (__builtin_expect(ompt_enabled.enabled && parent != NULL, 0)) {
+ if (UNLIKELY(ompt_enabled.enabled && parent != NULL)) {
parent->ompt_task_info.frame.enter_frame = NULL;
}
#endif
@@ -1703,9 +1699,8 @@
#if OMPT_SUPPORT && OMPT_OPTIONAL
if (UNLIKELY(ompt_enabled.enabled)) {
OMPT_STORE_RETURN_ADDRESS(gtid);
- return __kmpc_omp_taskwait_template<true>(loc_ref, gtid,
- OMPT_GET_FRAME_ADDRESS(1),
- OMPT_LOAD_RETURN_ADDRESS(gtid));
+ return __kmpc_omp_taskwait_ompt(loc_ref, gtid, OMPT_GET_FRAME_ADDRESS(1),
+ OMPT_LOAD_RETURN_ADDRESS(gtid));
}
#endif
return __kmpc_omp_taskwait_template<false>(loc_ref, gtid, NULL, NULL);
@@ -1746,7 +1741,7 @@
if (task_team != NULL) {
if (KMP_TASKING_ENABLED(task_team)) {
#if OMPT_SUPPORT
- if (__builtin_expect(ompt_enabled.enabled, 0))
+ if (UNLIKELY(ompt_enabled.enabled))
thread->th.ompt_thread_info.ompt_task_yielded = 1;
#endif
__kmp_execute_tasks_32(
@@ -1754,7 +1749,7 @@
&thread_finished USE_ITT_BUILD_ARG(itt_sync_obj),
__kmp_task_stealing_constraint);
#if OMPT_SUPPORT
- if (__builtin_expect(ompt_enabled.enabled, 0))
+ if (UNLIKELY(ompt_enabled.enabled))
thread->th.ompt_thread_info.ompt_task_yielded = 0;
#endif
}
@@ -1989,7 +1984,7 @@
taskdata->td_taskgroup = tg_new;
#if OMPT_SUPPORT && OMPT_OPTIONAL
- if (__builtin_expect(ompt_enabled.ompt_callback_sync_region, 0)) {
+ if (UNLIKELY(ompt_enabled.ompt_callback_sync_region)) {
void *codeptr = OMPT_LOAD_RETURN_ADDRESS(gtid);
if (!codeptr)
codeptr = OMPT_GET_RETURN_ADDRESS(0);
@@ -2018,7 +2013,7 @@
ompt_data_t my_task_data;
ompt_data_t my_parallel_data;
void *codeptr;
- if (__builtin_expect(ompt_enabled.enabled, 0)) {
+ if (UNLIKELY(ompt_enabled.enabled)) {
team = thread->th.th_team;
my_task_data = taskdata->ompt_task_info.task_data;
// FIXME: I think this is wrong for lwt!
@@ -2043,7 +2038,7 @@
#endif /* USE_ITT_BUILD */
#if OMPT_SUPPORT && OMPT_OPTIONAL
- if (__builtin_expect(ompt_enabled.ompt_callback_sync_region_wait, 0)) {
+ if (UNLIKELY(ompt_enabled.ompt_callback_sync_region_wait)) {
ompt_callbacks.ompt_callback(ompt_callback_sync_region_wait)(
ompt_sync_region_taskgroup, ompt_scope_begin, &(my_parallel_data),
&(my_task_data), codeptr);
@@ -2067,7 +2062,7 @@
}
#if OMPT_SUPPORT && OMPT_OPTIONAL
- if (__builtin_expect(ompt_enabled.ompt_callback_sync_region_wait, 0)) {
+ if (UNLIKELY(ompt_enabled.ompt_callback_sync_region_wait)) {
ompt_callbacks.ompt_callback(ompt_callback_sync_region_wait)(
ompt_sync_region_taskgroup, ompt_scope_end, &(my_parallel_data),
&(my_task_data), codeptr);
@@ -2095,7 +2090,7 @@
ANNOTATE_HAPPENS_AFTER(taskdata);
#if OMPT_SUPPORT && OMPT_OPTIONAL
- if (__builtin_expect(ompt_enabled.ompt_callback_sync_region, 0)) {
+ if (UNLIKELY(ompt_enabled.ompt_callback_sync_region)) {
ompt_callbacks.ompt_callback(ompt_callback_sync_region)(
ompt_sync_region_taskgroup, ompt_scope_end, &(my_parallel_data),
&(my_task_data), codeptr);
@@ -3489,7 +3484,7 @@
("__kmp_task_dup_alloc(exit): Th %p, created task %p, parent=%p\n",
thread, taskdata, taskdata->td_parent));
#if OMPT_SUPPORT
- if (__builtin_expect(ompt_enabled.enabled, 0))
+ if (UNLIKELY(ompt_enabled.enabled))
__ompt_task_init(taskdata, thread->th.th_info.ds.ds_gtid);
#endif
return task;