public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/96932] [nvptx] atomic_exchange missing barrier
Date: Tue, 08 Sep 2020 08:09:35 +0000	[thread overview]
Message-ID: <bug-96932-4-QscVkt33I2@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96932-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
FWIW, I've tried this test-case to trigger the problem, but it runs fine:
...
$ cat libgomp/testsuite/libgomp.oacc-c-c++-common/test.c  
/* { dg-do run } */

#include <stdlib.h>
#include <openacc.h>

#define assert(COND) \
  do { \
    if (!(COND)) \
      abort ();  \
  } while (0) 

int c;
#pragma acc declare copyin (c)

int
main (void)
{
  int *p = acc_malloc (4);

#pragma acc parallel num_gangs (1) deviceptr (p)
  {
    *p = 0;
  }

#pragma acc parallel num_gangs (100) deviceptr (p)
  {
    int i;
    for (i = 0; i < 10000; ++i)
      {
        int res;
        while (1)
          {
            res = __sync_lock_test_and_set (p, 1);
            if (res == 1)
              continue;
            break;
          }
        assert (res == 0);
        assert (*p == 1);

        assert (c == 0);
        c += 1;
        assert (c == 1);
        c -= 1;
        assert (c == 0);

        __sync_lock_release (p);
      }
  }
  return 0;
}
...

  reply	other threads:[~2020-09-08  8:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04  8:29 [Bug target/96932] New: " vries at gcc dot gnu.org
2020-09-08  8:09 ` vries at gcc dot gnu.org [this message]
2020-09-12  6:13 ` [Bug target/96932] " vries at gcc dot gnu.org
2021-05-12 11:30 ` burnus at gcc dot gnu.org
2021-05-12 12:07 ` vries at gcc dot gnu.org
2021-05-14  7:12 ` vries at gcc dot gnu.org
2021-05-17 18:24 ` vries 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-96932-4-QscVkt33I2@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).