Changeset View
Changeset View
Standalone View
Standalone View
openmp/runtime/src/kmp_taskdeps.cpp
Show First 20 Lines • Show All 534 Lines • ▼ Show 20 Lines | #if OMPT_SUPPORT | ||||
} | } | ||||
#if OMPT_OPTIONAL | #if OMPT_OPTIONAL | ||||
/* OMPT grab all dependences if requested by the tool */ | /* OMPT grab all dependences if requested by the tool */ | ||||
if (ndeps + ndeps_noalias > 0 && | if (ndeps + ndeps_noalias > 0 && | ||||
ompt_enabled.ompt_callback_dependences) { | ompt_enabled.ompt_callback_dependences) { | ||||
kmp_int32 i; | kmp_int32 i; | ||||
new_taskdata->ompt_task_info.ndeps = ndeps + ndeps_noalias; | int ompt_ndeps = ndeps + ndeps_noalias; | ||||
hbae: Can we remove `ndeps` and `deps` from `ompt_task_info_t` if they are not used any more? | |||||
new_taskdata->ompt_task_info.deps = | ompt_dependence_t *ompt_deps = (ompt_dependence_t *)KMP_OMPT_DEPS_ALLOC( | ||||
(ompt_dependence_t *)KMP_OMPT_DEPS_ALLOC( | |||||
thread, (ndeps + ndeps_noalias) * sizeof(ompt_dependence_t)); | thread, (ndeps + ndeps_noalias) * sizeof(ompt_dependence_t)); | ||||
KMP_ASSERT(new_taskdata->ompt_task_info.deps != NULL); | KMP_ASSERT(ompt_deps != NULL); | ||||
for (i = 0; i < ndeps; i++) { | for (i = 0; i < ndeps; i++) { | ||||
new_taskdata->ompt_task_info.deps[i].variable.ptr = | ompt_deps[i].variable.ptr = (void *)dep_list[i].base_addr; | ||||
(void *)dep_list[i].base_addr; | |||||
if (dep_list[i].flags.in && dep_list[i].flags.out) | if (dep_list[i].flags.in && dep_list[i].flags.out) | ||||
new_taskdata->ompt_task_info.deps[i].dependence_type = | ompt_deps[i].dependence_type = ompt_dependence_type_inout; | ||||
ompt_dependence_type_inout; | |||||
else if (dep_list[i].flags.out) | else if (dep_list[i].flags.out) | ||||
new_taskdata->ompt_task_info.deps[i].dependence_type = | ompt_deps[i].dependence_type = ompt_dependence_type_out; | ||||
ompt_dependence_type_out; | |||||
else if (dep_list[i].flags.in) | else if (dep_list[i].flags.in) | ||||
new_taskdata->ompt_task_info.deps[i].dependence_type = | ompt_deps[i].dependence_type = ompt_dependence_type_in; | ||||
ompt_dependence_type_in; | else if (dep_list[i].flags.mtx) | ||||
ompt_deps[i].dependence_type = ompt_dependence_type_mutexinoutset; | |||||
} | } | ||||
for (i = 0; i < ndeps_noalias; i++) { | for (i = 0; i < ndeps_noalias; i++) { | ||||
new_taskdata->ompt_task_info.deps[ndeps + i].variable.ptr = | ompt_deps[ndeps + i].variable.ptr = (void *)noalias_dep_list[i].base_addr; | ||||
(void *)noalias_dep_list[i].base_addr; | |||||
if (noalias_dep_list[i].flags.in && noalias_dep_list[i].flags.out) | if (noalias_dep_list[i].flags.in && noalias_dep_list[i].flags.out) | ||||
new_taskdata->ompt_task_info.deps[ndeps + i].dependence_type = | ompt_deps[ndeps + i].dependence_type = ompt_dependence_type_inout; | ||||
ompt_dependence_type_inout; | |||||
else if (noalias_dep_list[i].flags.out) | else if (noalias_dep_list[i].flags.out) | ||||
new_taskdata->ompt_task_info.deps[ndeps + i].dependence_type = | ompt_deps[ndeps + i].dependence_type = ompt_dependence_type_out; | ||||
ompt_dependence_type_out; | |||||
else if (noalias_dep_list[i].flags.in) | else if (noalias_dep_list[i].flags.in) | ||||
new_taskdata->ompt_task_info.deps[ndeps + i].dependence_type = | ompt_deps[ndeps + i].dependence_type = ompt_dependence_type_in; | ||||
ompt_dependence_type_in; | else if (noalias_dep_list[i].flags.mtx) | ||||
ompt_deps[ndeps + i].dependence_type = | |||||
ompt_dependence_type_mutexinoutset; | |||||
} | } | ||||
ompt_callbacks.ompt_callback(ompt_callback_dependences)( | ompt_callbacks.ompt_callback(ompt_callback_dependences)( | ||||
&(new_taskdata->ompt_task_info.task_data), | &(new_taskdata->ompt_task_info.task_data), ompt_deps, ompt_ndeps); | ||||
new_taskdata->ompt_task_info.deps, new_taskdata->ompt_task_info.ndeps); | |||||
/* We can now free the allocated memory for the dependencies */ | /* We can now free the allocated memory for the dependencies */ | ||||
/* For OMPD we might want to delay the free until task_end */ | /* For OMPD we might want to delay the free until end of this function */ | ||||
KMP_OMPT_DEPS_FREE(thread, new_taskdata->ompt_task_info.deps); | KMP_OMPT_DEPS_FREE(thread, ompt_deps); | ||||
new_taskdata->ompt_task_info.deps = NULL; | |||||
new_taskdata->ompt_task_info.ndeps = 0; | |||||
} | } | ||||
#endif /* OMPT_OPTIONAL */ | #endif /* OMPT_OPTIONAL */ | ||||
#endif /* OMPT_SUPPORT */ | #endif /* OMPT_SUPPORT */ | ||||
bool serial = current_task->td_flags.team_serial || | bool serial = current_task->td_flags.team_serial || | ||||
current_task->td_flags.tasking_ser || | current_task->td_flags.tasking_ser || | ||||
current_task->td_flags.final; | current_task->td_flags.final; | ||||
kmp_task_team_t *task_team = thread->th.th_task_team; | kmp_task_team_t *task_team = thread->th.th_task_team; | ||||
▲ Show 20 Lines • Show All 119 Lines • Show Last 20 Lines |
Can we remove ndeps and deps from ompt_task_info_t if they are not used any more?