Changeset View
Changeset View
Standalone View
Standalone View
openmp/trunk/runtime/src/kmp_taskdeps.cpp
Show First 20 Lines • Show All 362 Lines • ▼ Show 20 Lines | |||||
void | void | ||||
__kmp_release_deps ( kmp_int32 gtid, kmp_taskdata_t *task ) | __kmp_release_deps ( kmp_int32 gtid, kmp_taskdata_t *task ) | ||||
{ | { | ||||
kmp_info_t *thread = __kmp_threads[ gtid ]; | kmp_info_t *thread = __kmp_threads[ gtid ]; | ||||
kmp_depnode_t *node = task->td_depnode; | kmp_depnode_t *node = task->td_depnode; | ||||
if ( task->td_dephash ) { | if ( task->td_dephash ) { | ||||
KA_TRACE(40, ("__kmp_realease_deps: T#%d freeing dependencies hash of task %p.\n", gtid, task ) ); | KA_TRACE(40, ("__kmp_release_deps: T#%d freeing dependencies hash of task %p.\n", gtid, task ) ); | ||||
__kmp_dephash_free(thread,task->td_dephash); | __kmp_dephash_free(thread,task->td_dephash); | ||||
} | } | ||||
if ( !node ) return; | if ( !node ) return; | ||||
KA_TRACE(20, ("__kmp_realease_deps: T#%d notifying succesors of task %p.\n", gtid, task ) ); | KA_TRACE(20, ("__kmp_release_deps: T#%d notifying successors of task %p.\n", gtid, task ) ); | ||||
KMP_ACQUIRE_DEPNODE(gtid,node); | KMP_ACQUIRE_DEPNODE(gtid,node); | ||||
node->dn.task = NULL; // mark this task as finished, so no new dependencies are generated | node->dn.task = NULL; // mark this task as finished, so no new dependencies are generated | ||||
KMP_RELEASE_DEPNODE(gtid,node); | KMP_RELEASE_DEPNODE(gtid,node); | ||||
kmp_depnode_list_t *next; | kmp_depnode_list_t *next; | ||||
for ( kmp_depnode_list_t *p = node->dn.successors; p; p = next ) { | for ( kmp_depnode_list_t *p = node->dn.successors; p; p = next ) { | ||||
kmp_depnode_t *successor = p->node; | kmp_depnode_t *successor = p->node; | ||||
kmp_int32 npredecessors = KMP_TEST_THEN_DEC32(&successor->dn.npredecessors) - 1; | kmp_int32 npredecessors = KMP_TEST_THEN_DEC32(&successor->dn.npredecessors) - 1; | ||||
// successor task can be NULL for wait_depends or because deps are still being processed | // successor task can be NULL for wait_depends or because deps are still being processed | ||||
if ( npredecessors == 0 ) { | if ( npredecessors == 0 ) { | ||||
KMP_MB(); | KMP_MB(); | ||||
if ( successor->dn.task ) { | if ( successor->dn.task ) { | ||||
KA_TRACE(20, ("__kmp_realease_deps: T#%d successor %p of %p scheduled for execution.\n", gtid, successor->dn.task, task ) ); | KA_TRACE(20, ("__kmp_release_deps: T#%d successor %p of %p scheduled for execution.\n", gtid, successor->dn.task, task ) ); | ||||
__kmp_omp_task(gtid,successor->dn.task,false); | __kmp_omp_task(gtid,successor->dn.task,false); | ||||
} | } | ||||
} | } | ||||
next = p->next; | next = p->next; | ||||
__kmp_node_deref(thread,p->node); | __kmp_node_deref(thread,p->node); | ||||
#if USE_FAST_MEMORY | #if USE_FAST_MEMORY | ||||
__kmp_fast_free(thread,p); | __kmp_fast_free(thread,p); | ||||
#else | #else | ||||
__kmp_thread_free(thread,p); | __kmp_thread_free(thread,p); | ||||
#endif | #endif | ||||
} | } | ||||
__kmp_node_deref(thread,node); | __kmp_node_deref(thread,node); | ||||
KA_TRACE(20, ("__kmp_realease_deps: T#%d all successors of %p notified of completation\n", gtid, task ) ); | KA_TRACE(20, ("__kmp_release_deps: T#%d all successors of %p notified of completion\n", gtid, task ) ); | ||||
} | } | ||||
/*! | /*! | ||||
@ingroup TASKING | @ingroup TASKING | ||||
@param loc_ref location of the original task directive | @param loc_ref location of the original task directive | ||||
@param gtid Global Thread ID of encountering thread | @param gtid Global Thread ID of encountering thread | ||||
@param new_task task thunk allocated by __kmp_omp_task_alloc() for the ''new task'' | @param new_task task thunk allocated by __kmp_omp_task_alloc() for the ''new task'' | ||||
@param ndeps Number of depend items with possible aliasing | @param ndeps Number of depend items with possible aliasing | ||||
▲ Show 20 Lines • Show All 168 Lines • Show Last 20 Lines |