public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libgomp/97212] [OpenMP] 'depend' clause with 'target nowait' (!) + 'task' does not work
Date: Mon, 05 Oct 2020 12:51:37 +0000	[thread overview]
Message-ID: <bug-97212-4-bIs6aufWSD@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97212-4@http.gcc.gnu.org/bugzilla/>

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	other threads:[~2020-10-05 12:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-26 11:38 [Bug libgomp/97212] New: " burnus at gcc dot gnu.org
2020-10-05 12:51 ` burnus at gcc dot gnu.org [this message]
2020-10-08 17:47 ` [Bug libgomp/97212] " jakub at gcc dot gnu.org
2020-10-08 18:40 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-97212-4-bIs6aufWSD@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).