Lines Matching refs:async

47 validate_async_val (int async)  in validate_async_val()  argument
49 if (!async_valid_p (async)) in validate_async_val()
50 gomp_fatal ("invalid async-argument: %d", async); in validate_async_val()
52 if (async == acc_async_sync) in validate_async_val()
55 if (async == acc_async_noval) in validate_async_val()
58 if (async >= 0) in validate_async_val()
61 return 1 + async; in validate_async_val()
74 lookup_goacc_asyncqueue (struct goacc_thread *thr, bool create, int async) in lookup_goacc_asyncqueue() argument
76 async = validate_async_val (async); in lookup_goacc_asyncqueue()
77 if (async < 0) in lookup_goacc_asyncqueue()
83 gomp_mutex_lock (&dev->openacc.async.lock); in lookup_goacc_asyncqueue()
86 && (async >= dev->openacc.async.nasyncqueue in lookup_goacc_asyncqueue()
87 || !dev->openacc.async.asyncqueue[async])) in lookup_goacc_asyncqueue()
90 if (async >= dev->openacc.async.nasyncqueue) in lookup_goacc_asyncqueue()
92 int diff = async + 1 - dev->openacc.async.nasyncqueue; in lookup_goacc_asyncqueue()
93 dev->openacc.async.asyncqueue in lookup_goacc_asyncqueue()
94 = gomp_realloc (dev->openacc.async.asyncqueue, in lookup_goacc_asyncqueue()
95 sizeof (goacc_aq) * (async + 1)); in lookup_goacc_asyncqueue()
96 memset (dev->openacc.async.asyncqueue + dev->openacc.async.nasyncqueue, in lookup_goacc_asyncqueue()
98 dev->openacc.async.nasyncqueue = async + 1; in lookup_goacc_asyncqueue()
101 if (!dev->openacc.async.asyncqueue[async]) in lookup_goacc_asyncqueue()
103 dev->openacc.async.asyncqueue[async] in lookup_goacc_asyncqueue()
104 = dev->openacc.async.construct_func (dev->target_id); in lookup_goacc_asyncqueue()
106 if (!dev->openacc.async.asyncqueue[async]) in lookup_goacc_asyncqueue()
108 gomp_mutex_unlock (&dev->openacc.async.lock); in lookup_goacc_asyncqueue()
109 gomp_fatal ("async %d creation failed", async); in lookup_goacc_asyncqueue()
114 n->aq = dev->openacc.async.asyncqueue[async]; in lookup_goacc_asyncqueue()
115 n->next = dev->openacc.async.active; in lookup_goacc_asyncqueue()
116 dev->openacc.async.active = n; in lookup_goacc_asyncqueue()
119 ret_aq = dev->openacc.async.asyncqueue[async]; in lookup_goacc_asyncqueue()
122 gomp_mutex_unlock (&dev->openacc.async.lock); in lookup_goacc_asyncqueue()
131 get_goacc_asyncqueue (int async) in get_goacc_asyncqueue() argument
134 return lookup_goacc_asyncqueue (thr, true, async); in get_goacc_asyncqueue()
138 acc_async_test (int async) in acc_async_test() argument
145 goacc_aq aq = lookup_goacc_asyncqueue (thr, false, async); in acc_async_test()
154 prof_info.async = async; in acc_async_test()
155 prof_info.async_queue = prof_info.async; in acc_async_test()
158 int res = thr->dev->openacc.async.test_func (aq); in acc_async_test()
179 gomp_mutex_lock (&thr->dev->openacc.async.lock); in acc_async_test_all()
180 for (goacc_aq_list l = thr->dev->openacc.async.active; l; l = l->next) in acc_async_test_all()
181 if (!thr->dev->openacc.async.test_func (l->aq)) in acc_async_test_all()
186 gomp_mutex_unlock (&thr->dev->openacc.async.lock); in acc_async_test_all()
198 acc_wait (int async) in acc_wait() argument
202 goacc_aq aq = lookup_goacc_asyncqueue (thr, false, async); in acc_wait()
211 prof_info.async = async; in acc_wait()
212 prof_info.async_queue = prof_info.async; in acc_wait()
215 if (!thr->dev->openacc.async.synchronize_func (aq)) in acc_wait()
216 gomp_fatal ("wait on %d failed", async); in acc_wait()
230 acc_async_wait (int async) in strong_alias()
232 acc_wait (async); in strong_alias()
252 prof_info.async = async2;
253 prof_info.async_queue = prof_info.async;
263 if (!thr->dev->openacc.async.serialize_func (aq1, aq2))
270 if (!thr->dev->openacc.async.synchronize_func (aq1))
292 gomp_mutex_lock (&thr->dev->openacc.async.lock); in acc_wait_all()
293 for (goacc_aq_list l = thr->dev->openacc.async.active; l; l = l->next) in acc_wait_all()
294 ret &= thr->dev->openacc.async.synchronize_func (l->aq); in acc_wait_all()
295 gomp_mutex_unlock (&thr->dev->openacc.async.lock); in acc_wait_all()
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, ...) in GOACC_wait() argument
372 prof_info.async = async; in GOACC_wait()
373 prof_info.async_queue = prof_info.async; in GOACC_wait()
381 goacc_wait (async, num_waits, &ap); in GOACC_wait()
384 else if (async == acc_async_sync) in GOACC_wait()
387 acc_wait_all_async (async); in GOACC_wait()
397 goacc_wait (int async, int num_waits, va_list *ap) in goacc_wait() argument
406 if (async == acc_async_sync) in goacc_wait()
409 acc_wait_all_async (async); in goacc_wait()
416 if (async == acc_async_sync) in goacc_wait()
418 else if (qid == async) in goacc_wait()
424 acc_wait_async (qid, async); in goacc_wait()
435 devicep->openacc.async.queue_callback_func (aq, free, ptr); in goacc_async_free()
445 devicep->openacc.async.nasyncqueue = 0; in goacc_init_asyncqueues()
446 devicep->openacc.async.asyncqueue = NULL; in goacc_init_asyncqueues()
447 devicep->openacc.async.active = NULL; in goacc_init_asyncqueues()
448 gomp_mutex_init (&devicep->openacc.async.lock); in goacc_init_asyncqueues()
458 gomp_mutex_lock (&devicep->openacc.async.lock); in goacc_fini_asyncqueues()
459 if (devicep->openacc.async.nasyncqueue > 0) in goacc_fini_asyncqueues()
462 for (goacc_aq_list l = devicep->openacc.async.active; l; l = next) in goacc_fini_asyncqueues()
464 ret &= devicep->openacc.async.destruct_func (l->aq); in goacc_fini_asyncqueues()
468 free (devicep->openacc.async.asyncqueue); in goacc_fini_asyncqueues()
469 devicep->openacc.async.nasyncqueue = 0; in goacc_fini_asyncqueues()
470 devicep->openacc.async.asyncqueue = NULL; in goacc_fini_asyncqueues()
471 devicep->openacc.async.active = NULL; in goacc_fini_asyncqueues()
473 gomp_mutex_unlock (&devicep->openacc.async.lock); in goacc_fini_asyncqueues()
474 gomp_mutex_destroy (&devicep->openacc.async.lock); in goacc_fini_asyncqueues()