Lines Matching refs:async
47 validate_async_val (int async)
49 if (!async_valid_p (async))
50 gomp_fatal ("invalid async-argument: %d", async);
52 if (async == acc_async_sync)
55 if (async == acc_async_noval)
58 if (async >= 0)
61 return 1 + async;
66 /* Return the asyncqueue to be used for OpenACC async-argument ASYNC. This
74 lookup_goacc_asyncqueue (struct goacc_thread *thr, bool create, int async)
76 async = validate_async_val (async);
77 if (async < 0)
83 gomp_mutex_lock (&dev->openacc.async.lock);
86 && (async >= dev->openacc.async.nasyncqueue
87 || !dev->openacc.async.asyncqueue[async]))
90 if (async >= dev->openacc.async.nasyncqueue)
92 int diff = async + 1 - dev->openacc.async.nasyncqueue;
93 dev->openacc.async.asyncqueue
94 = gomp_realloc (dev->openacc.async.asyncqueue,
95 sizeof (goacc_aq) * (async + 1));
96 memset (dev->openacc.async.asyncqueue + dev->openacc.async.nasyncqueue,
98 dev->openacc.async.nasyncqueue = async + 1;
101 if (!dev->openacc.async.asyncqueue[async])
103 dev->openacc.async.asyncqueue[async]
104 = dev->openacc.async.construct_func (dev->target_id);
106 if (!dev->openacc.async.asyncqueue[async])
108 gomp_mutex_unlock (&dev->openacc.async.lock);
109 gomp_fatal ("async %d creation failed", async);
112 /* Link new async queue into active list. */
114 n->aq = dev->openacc.async.asyncqueue[async];
115 n->next = dev->openacc.async.active;
116 dev->openacc.async.active = n;
119 ret_aq = dev->openacc.async.asyncqueue[async];
122 gomp_mutex_unlock (&dev->openacc.async.lock);
126 /* Return the asyncqueue to be used for OpenACC async-argument ASYNC. This
131 get_goacc_asyncqueue (int async)
134 return lookup_goacc_asyncqueue (thr, true, async);
138 acc_async_test (int async)
145 goacc_aq aq = lookup_goacc_asyncqueue (thr, false, async);
154 prof_info.async = async;
155 prof_info.async_queue = prof_info.async;
158 int res = thr->dev->openacc.async.test_func (aq);
179 gomp_mutex_lock (&thr->dev->openacc.async.lock);
180 for (goacc_aq_list l = thr->dev->openacc.async.active; l; l = l->next)
181 if (!thr->dev->openacc.async.test_func (l->aq))
186 gomp_mutex_unlock (&thr->dev->openacc.async.lock);
198 acc_wait (int async)
202 goacc_aq aq = lookup_goacc_asyncqueue (thr, false, async);
211 prof_info.async = async;
212 prof_info.async_queue = prof_info.async;
215 if (!thr->dev->openacc.async.synchronize_func (aq))
216 gomp_fatal ("wait on %d failed", async);
230 acc_async_wait (int async)
232 acc_wait (async);
252 prof_info.async = async2;
253 prof_info.async_queue = prof_info.async;
257 /* An async queue is always synchronized with itself. */
263 if (!thr->dev->openacc.async.serialize_func (aq1, aq2))
264 gomp_fatal ("ordering of async ids %d and %d failed", async1, async2);
270 if (!thr->dev->openacc.async.synchronize_func (aq1))
292 gomp_mutex_lock (&thr->dev->openacc.async.lock);
293 for (goacc_aq_list l = thr->dev->openacc.async.active; l; l = l->next)
294 ret &= thr->dev->openacc.async.synchronize_func (l->aq);
295 gomp_mutex_unlock (&thr->dev->openacc.async.lock);
319 acc_wait_all_async (int async)
328 prof_info.async = async;
329 prof_info.async_queue = prof_info.async;
332 goacc_aq waiting_queue = lookup_goacc_asyncqueue (thr, true, async);
335 gomp_mutex_lock (&thr->dev->openacc.async.lock);
336 for (goacc_aq_list l = thr->dev->openacc.async.active; l; l = l->next)
339 ret &= thr->dev->openacc.async.serialize_func (l->aq, waiting_queue);
343 ret &= thr->dev->openacc.async.synchronize_func (l->aq);
345 gomp_mutex_unlock (&thr->dev->openacc.async.lock);
354 gomp_fatal ("wait all async(%d) failed", async);
358 GOACC_wait (int async, int num_waits, ...)
372 prof_info.async = async;
373 prof_info.async_queue = prof_info.async;
381 goacc_wait (async, num_waits, &ap);
384 else if (async == acc_async_sync)
387 acc_wait_all_async (async);
397 goacc_wait (int async, int num_waits, va_list *ap)
406 if (async == acc_async_sync)
409 acc_wait_all_async (async);
416 if (async == acc_async_sync)
418 else if (qid == async)
424 acc_wait_async (qid, async);
435 devicep->openacc.async.queue_callback_func (aq, free, ptr);
445 devicep->openacc.async.nasyncqueue = 0;
446 devicep->openacc.async.asyncqueue = NULL;
447 devicep->openacc.async.active = NULL;
448 gomp_mutex_init (&devicep->openacc.async.lock);
458 gomp_mutex_lock (&devicep->openacc.async.lock);
459 if (devicep->openacc.async.nasyncqueue > 0)
462 for (goacc_aq_list l = devicep->openacc.async.active; l; l = next)
464 ret &= devicep->openacc.async.destruct_func (l->aq);
468 free (devicep->openacc.async.asyncqueue);
469 devicep->openacc.async.nasyncqueue = 0;
470 devicep->openacc.async.asyncqueue = NULL;
471 devicep->openacc.async.active = NULL;
473 gomp_mutex_unlock (&devicep->openacc.async.lock);
474 gomp_mutex_destroy (&devicep->openacc.async.lock);