示例#1
0
static void
goacc_wait (int async, int num_waits, va_list ap)
{
  struct goacc_thread *thr = goacc_thread ();
  struct gomp_device_descr *acc_dev = thr->dev;
  int i;

  assert (num_waits >= 0);

  if (async == acc_async_sync && num_waits == 0)
    {
      acc_wait_all ();
      return;
    }

  if (async == acc_async_sync && num_waits)
    {
      for (i = 0; i < num_waits; i++)
        {
          int qid = va_arg (ap, int);

          if (acc_async_test (qid))
            continue;

          acc_wait (qid);
        }
      return;
    }

  if (async == acc_async_noval && num_waits == 0)
    {
      acc_dev->openacc.async_wait_all_async_func (acc_async_noval);
      return;
    }

  for (i = 0; i < num_waits; i++)
    {
      int qid = va_arg (ap, int);

      if (acc_async_test (qid))
	continue;

      /* If we're waiting on the same asynchronous queue as we're launching on,
         the queue itself will order work as required, so there's no need to
	 wait explicitly.  */
      if (qid != async)
	acc_dev->openacc.async_wait_async_func (qid, async);
    }
}
示例#2
0
文件: oacc-parallel.c 项目: pjump/gcc
void
GOACC_wait (int async, int num_waits, ...)
{
  if (num_waits)
    {
      va_list ap;

      va_start (ap, num_waits);
      goacc_wait (async, num_waits, &ap);
      va_end (ap);
    }
  else if (async == acc_async_sync)
    acc_wait_all ();
  else if (async == acc_async_noval)
    goacc_thread ()->dev->openacc.async_wait_all_async_func (acc_async_noval);
}