https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97212

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The testcase has:
  #pragma omp target map(tofrom: a, sum) depend(out: a) nowait
  #pragma omp task depend(in: a) shared(a)

and calls:
  __builtin_GOMP_target_ext
  __builtin_GOMP_task


The libgomp code has for "GOMP_task":

  if (!if_clause || team == NULL
      || (thr->task && thr->task->final_task)
      || team->task_count > 64 * team->nthreads)
...
      if ((flags & GOMP_TASK_FLAG_DEPEND)
          && thr->task && thr->task->depend_hash)
        gomp_task_maybe_wait_for_dependencies (depend);
...
  else
...
      if (depend_size)
        {
          gomp_task_handle_depend (task, parent, depend);
          if (task->num_dependees)
            {
              /* Tasks that depend on other tasks are not put into the
                 various waiting queues, so we are done for now.  Said
                 tasks are instead put into the queues via
                 gomp_task_run_post_handle_dependers() after their
                 dependencies have been satisfied.  After which, they
                 can be picked up by the various scheduling
                 points.  */
              gomp_mutex_unlock (&team->task_lock);
              return;
            }
        }


For the attached code, we run into the else branch, i.e. the dependency is
analyzed – a dependency is detected but then the code just returns.

There is no call to gomp_task_run_post_handle_dependers (which is only called
by  gomp_task_run_post_handle_depend which in turn is only called by
(gomp_barrier_handle_tasks and GOMP_taskwait).

The latter are "task synchronization point = A taskwait, taskgroup, or a
barrier construct." (OpenMP glossary)

Thus, the question is whether
* either the if branch should be called instead of the else branch
* or whether some task synchronization should be done after the task.

Reply via email to