Mercurial > hg > CbC > CbC_gcc
comparison libgomp/taskloop.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* Copyright (C) 2015-2018 Free Software Foundation, Inc. | 1 /* Copyright (C) 2015-2020 Free Software Foundation, Inc. |
2 Contributed by Jakub Jelinek <jakub@redhat.com>. | 2 Contributed by Jakub Jelinek <jakub@redhat.com>. |
3 | 3 |
4 This file is part of the GNU Offloading and Multi Processing Library | 4 This file is part of the GNU Offloading and Multi Processing Library |
5 (libgomp). | 5 (libgomp). |
6 | 6 |
147 } | 147 } |
148 } | 148 } |
149 | 149 |
150 if (flags & GOMP_TASK_FLAG_NOGROUP) | 150 if (flags & GOMP_TASK_FLAG_NOGROUP) |
151 { | 151 { |
152 if (thr->task && thr->task->taskgroup && thr->task->taskgroup->cancelled) | 152 if (__builtin_expect (gomp_cancel_var, 0) |
153 return; | 153 && thr->task |
154 } | 154 && thr->task->taskgroup) |
155 else | 155 { |
156 ialias_call (GOMP_taskgroup_start) (); | 156 if (thr->task->taskgroup->cancelled) |
157 return; | |
158 if (thr->task->taskgroup->workshare | |
159 && thr->task->taskgroup->prev | |
160 && thr->task->taskgroup->prev->cancelled) | |
161 return; | |
162 } | |
163 } | |
164 else | |
165 { | |
166 ialias_call (GOMP_taskgroup_start) (); | |
167 if (flags & GOMP_TASK_FLAG_REDUCTION) | |
168 { | |
169 struct gomp_data_head { TYPE t1, t2; uintptr_t *ptr; }; | |
170 uintptr_t *ptr = ((struct gomp_data_head *) data)->ptr; | |
171 ialias_call (GOMP_taskgroup_reduction_register) (ptr); | |
172 } | |
173 } | |
157 | 174 |
158 if (priority > gomp_max_task_priority_var) | 175 if (priority > gomp_max_task_priority_var) |
159 priority = gomp_max_task_priority_var; | 176 priority = gomp_max_task_priority_var; |
160 | 177 |
161 if ((flags & GOMP_TASK_FLAG_IF) == 0 || team == NULL | 178 if ((flags & GOMP_TASK_FLAG_IF) == 0 || team == NULL |
282 task->final_task = (flags & GOMP_TASK_FLAG_FINAL) >> 1; | 299 task->final_task = (flags & GOMP_TASK_FLAG_FINAL) >> 1; |
283 } | 300 } |
284 gomp_mutex_lock (&team->task_lock); | 301 gomp_mutex_lock (&team->task_lock); |
285 /* If parallel or taskgroup has been cancelled, don't start new | 302 /* If parallel or taskgroup has been cancelled, don't start new |
286 tasks. */ | 303 tasks. */ |
287 if (__builtin_expect ((gomp_team_barrier_cancelled (&team->barrier) | 304 if (__builtin_expect (gomp_cancel_var, 0) |
288 || (taskgroup && taskgroup->cancelled)) | 305 && cpyfn == NULL) |
289 && cpyfn == NULL, 0)) | 306 { |
290 { | 307 if (gomp_team_barrier_cancelled (&team->barrier)) |
291 gomp_mutex_unlock (&team->task_lock); | 308 { |
292 for (i = 0; i < num_tasks; i++) | 309 do_cancel: |
293 { | 310 gomp_mutex_unlock (&team->task_lock); |
294 gomp_finish_task (tasks[i]); | 311 for (i = 0; i < num_tasks; i++) |
295 free (tasks[i]); | 312 { |
296 } | 313 gomp_finish_task (tasks[i]); |
297 if ((flags & GOMP_TASK_FLAG_NOGROUP) == 0) | 314 free (tasks[i]); |
298 ialias_call (GOMP_taskgroup_end) (); | 315 } |
299 return; | 316 if ((flags & GOMP_TASK_FLAG_NOGROUP) == 0) |
317 ialias_call (GOMP_taskgroup_end) (); | |
318 return; | |
319 } | |
320 if (taskgroup) | |
321 { | |
322 if (taskgroup->cancelled) | |
323 goto do_cancel; | |
324 if (taskgroup->workshare | |
325 && taskgroup->prev | |
326 && taskgroup->prev->cancelled) | |
327 goto do_cancel; | |
328 } | |
300 } | 329 } |
301 if (taskgroup) | 330 if (taskgroup) |
302 taskgroup->num_children += num_tasks; | 331 taskgroup->num_children += num_tasks; |
303 for (i = 0; i < num_tasks; i++) | 332 for (i = 0; i < num_tasks; i++) |
304 { | 333 { |