re PR libgomp/51376 (libgomp taskwait failure)
PR libgomp/51376 PR libgomp/56073 * task.c (GOMP_task): Revert 2011-12-09 change. (GOMP_taskwait): Likewise. Instead use atomic load with acquire barrier to read task->children.. (gomp_barrier_handle_tasks): ..and matching atomic store with release barrier here when setting parent->children to NULL. From-SVN: r195370
This commit is contained in:
parent
e18600419e
commit
9a64728823
|
@ -1,3 +1,13 @@
|
||||||
|
2013-01-22 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
PR libgomp/51376
|
||||||
|
PR libgomp/56073
|
||||||
|
* task.c (GOMP_task): Revert 2011-12-09 change.
|
||||||
|
(GOMP_taskwait): Likewise. Instead use atomic load with acquire
|
||||||
|
barrier to read task->children..
|
||||||
|
(gomp_barrier_handle_tasks): ..and matching atomic store with
|
||||||
|
release barrier here when setting parent->children to NULL.
|
||||||
|
|
||||||
2013-01-16 Jakub Jelinek <jakub@redhat.com>
|
2013-01-16 Jakub Jelinek <jakub@redhat.com>
|
||||||
Tobias Burnus <burnus@net-b.de>
|
Tobias Burnus <burnus@net-b.de>
|
||||||
|
|
||||||
|
|
|
@ -116,11 +116,10 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fn (data);
|
fn (data);
|
||||||
if (team != NULL)
|
if (task.children != NULL)
|
||||||
{
|
{
|
||||||
gomp_mutex_lock (&team->task_lock);
|
gomp_mutex_lock (&team->task_lock);
|
||||||
if (task.children != NULL)
|
gomp_clear_parent (task.children);
|
||||||
gomp_clear_parent (task.children);
|
|
||||||
gomp_mutex_unlock (&team->task_lock);
|
gomp_mutex_unlock (&team->task_lock);
|
||||||
}
|
}
|
||||||
gomp_end_task ();
|
gomp_end_task ();
|
||||||
|
@ -258,7 +257,13 @@ gomp_barrier_handle_tasks (gomp_barrier_state_t state)
|
||||||
parent->children = child_task->next_child;
|
parent->children = child_task->next_child;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
parent->children = NULL;
|
/* We access task->children in GOMP_taskwait
|
||||||
|
outside of the task lock mutex region, so
|
||||||
|
need a release barrier here to ensure memory
|
||||||
|
written by child_task->fn above is flushed
|
||||||
|
before the NULL is written. */
|
||||||
|
__atomic_store_n (&parent->children, NULL,
|
||||||
|
MEMMODEL_RELEASE);
|
||||||
if (parent->in_taskwait)
|
if (parent->in_taskwait)
|
||||||
gomp_sem_post (&parent->taskwait_sem);
|
gomp_sem_post (&parent->taskwait_sem);
|
||||||
}
|
}
|
||||||
|
@ -291,7 +296,8 @@ GOMP_taskwait (void)
|
||||||
struct gomp_task *child_task = NULL;
|
struct gomp_task *child_task = NULL;
|
||||||
struct gomp_task *to_free = NULL;
|
struct gomp_task *to_free = NULL;
|
||||||
|
|
||||||
if (task == NULL || team == NULL)
|
if (task == NULL
|
||||||
|
|| __atomic_load_n (&task->children, MEMMODEL_ACQUIRE) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gomp_mutex_lock (&team->task_lock);
|
gomp_mutex_lock (&team->task_lock);
|
||||||
|
|
Loading…
Reference in New Issue