summaryrefslogtreecommitdiff
path: root/libgomp/taskloop.c
diff options
context:
space:
mode:
authorVladimir Makarov <vmakarov@gcc.gnu.org>2019-12-12 20:46:39 +0000
committerVladimir Makarov <vmakarov@gcc.gnu.org>2019-12-12 20:46:39 +0000
commit3a8c69ecd95f708f5d489d92ff12dfbe2a93b00b (patch)
tree1596316424f3ab3df4c378a866d87ddca07e342f /libgomp/taskloop.c
parent3fceb4462a7484503f3048a2c402e7996c72cc7c (diff)
parentbdaf8be1b2e3514b8bbcdd1042136e7d91b3c3f3 (diff)
Merged latest trunk changes to ira-select.devel/ira-select
From-SVN: r279316
Diffstat (limited to 'libgomp/taskloop.c')
-rw-r--r--libgomp/taskloop.c57
1 files changed, 43 insertions, 14 deletions
diff --git a/libgomp/taskloop.c b/libgomp/taskloop.c
index 5515b355f00..5d3f810a8f2 100644
--- a/libgomp/taskloop.c
+++ b/libgomp/taskloop.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2015-2019 Free Software Foundation, Inc.
Contributed by Jakub Jelinek <jakub@redhat.com>.
This file is part of the GNU Offloading and Multi Processing Library
@@ -149,11 +149,28 @@ GOMP_taskloop (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
if (flags & GOMP_TASK_FLAG_NOGROUP)
{
- if (thr->task && thr->task->taskgroup && thr->task->taskgroup->cancelled)
- return;
+ if (__builtin_expect (gomp_cancel_var, 0)
+ && thr->task
+ && thr->task->taskgroup)
+ {
+ if (thr->task->taskgroup->cancelled)
+ return;
+ if (thr->task->taskgroup->workshare
+ && thr->task->taskgroup->prev
+ && thr->task->taskgroup->prev->cancelled)
+ return;
+ }
}
else
- ialias_call (GOMP_taskgroup_start) ();
+ {
+ ialias_call (GOMP_taskgroup_start) ();
+ if (flags & GOMP_TASK_FLAG_REDUCTION)
+ {
+ struct gomp_data_head { TYPE t1, t2; uintptr_t *ptr; };
+ uintptr_t *ptr = ((struct gomp_data_head *) data)->ptr;
+ ialias_call (GOMP_taskgroup_reduction_register) (ptr);
+ }
+ }
if (priority > gomp_max_task_priority_var)
priority = gomp_max_task_priority_var;
@@ -284,19 +301,31 @@ GOMP_taskloop (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
gomp_mutex_lock (&team->task_lock);
/* If parallel or taskgroup has been cancelled, don't start new
tasks. */
- if (__builtin_expect ((gomp_team_barrier_cancelled (&team->barrier)
- || (taskgroup && taskgroup->cancelled))
- && cpyfn == NULL, 0))
+ if (__builtin_expect (gomp_cancel_var, 0)
+ && cpyfn == NULL)
{
- gomp_mutex_unlock (&team->task_lock);
- for (i = 0; i < num_tasks; i++)
+ if (gomp_team_barrier_cancelled (&team->barrier))
+ {
+ do_cancel:
+ gomp_mutex_unlock (&team->task_lock);
+ for (i = 0; i < num_tasks; i++)
+ {
+ gomp_finish_task (tasks[i]);
+ free (tasks[i]);
+ }
+ if ((flags & GOMP_TASK_FLAG_NOGROUP) == 0)
+ ialias_call (GOMP_taskgroup_end) ();
+ return;
+ }
+ if (taskgroup)
{
- gomp_finish_task (tasks[i]);
- free (tasks[i]);
+ if (taskgroup->cancelled)
+ goto do_cancel;
+ if (taskgroup->workshare
+ && taskgroup->prev
+ && taskgroup->prev->cancelled)
+ goto do_cancel;
}
- if ((flags & GOMP_TASK_FLAG_NOGROUP) == 0)
- ialias_call (GOMP_taskgroup_end) ();
- return;
}
if (taskgroup)
taskgroup->num_children += num_tasks;