public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][libgomp, nvptx] Add spinlock test-cases
@ 2022-02-10  9:18 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2022-02-10  9:18 UTC (permalink / raw)
  To: gcc-patches; +Cc: Thomas Schwinge

Hi,

Add spinlock test-cases for nvptx.

Strictly speaking, these are invalid openACC, because they're not guaranteed
to terminate.

But I've tested these without problems on cards from nvidia architectures
Kepler, Maxwell, Pascal and Turing (though on Turing, that's what you expect
given that it's explicitly supported).

These have been submitted separately, to make reverting easy in case of
problems.

Tested on x86_64 with nvptx accelerator.

Thomas, OK for the unusual openACC aspect of it?

Thanks,
- Tom

[libgomp, nvptx] Add spinlock test-cases

libgomp/ChangeLog:

2022-02-02  Tom de Vries  <tdevries@suse.de>

	* testsuite/libgomp.oacc-c/spin-lock-global-2.c: New test.
	* testsuite/libgomp.oacc-c/spin-lock-global-3.c: New test.
	* testsuite/libgomp.oacc-c/spin-lock-shared-2.c: New test.
	* testsuite/libgomp.oacc-c/spin-lock-shared-3.c: New test.

---
 libgomp/testsuite/libgomp.oacc-c/spin-lock-global-2.c | 8 ++++++++
 libgomp/testsuite/libgomp.oacc-c/spin-lock-global-3.c | 7 +++++++
 libgomp/testsuite/libgomp.oacc-c/spin-lock-shared-2.c | 8 ++++++++
 libgomp/testsuite/libgomp.oacc-c/spin-lock-shared-3.c | 7 +++++++
 4 files changed, 30 insertions(+)

diff --git a/libgomp/testsuite/libgomp.oacc-c/spin-lock-global-2.c b/libgomp/testsuite/libgomp.oacc-c/spin-lock-global-2.c
new file mode 100644
index 00000000000..b6a8728cb42
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c/spin-lock-global-2.c
@@ -0,0 +1,8 @@
+/* { dg-do run { target openacc_nvidia_accel_selected } } */
+
+/* Define to 0 to have a regular spinlock.
+   Makes the test-case invalid OpenACC: there's nothing that guarantees that
+   the program will terminate.  So, we only do this for nvptx.  */
+#define SPIN_CNT_MAX 0
+
+#include "spin-lock-global.c"
diff --git a/libgomp/testsuite/libgomp.oacc-c/spin-lock-global-3.c b/libgomp/testsuite/libgomp.oacc-c/spin-lock-global-3.c
new file mode 100644
index 00000000000..157384e4cb4
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c/spin-lock-global-3.c
@@ -0,0 +1,7 @@
+/* As in spin-lock-global-2.c.  */
+/* { dg-do run { target openacc_nvidia_accel_selected } } */
+
+/* Also test without JIT optimization.  */
+/* { dg-set-target-env-var GOMP_NVPTX_JIT "-O0" } */
+
+#include "spin-lock-global-2.c"
diff --git a/libgomp/testsuite/libgomp.oacc-c/spin-lock-shared-2.c b/libgomp/testsuite/libgomp.oacc-c/spin-lock-shared-2.c
new file mode 100644
index 00000000000..43e4686b841
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c/spin-lock-shared-2.c
@@ -0,0 +1,8 @@
+/* { dg-do run { target openacc_nvidia_accel_selected } } */
+
+/* Define to 0 to have a regular spinlock.
+   Makes the test-case invalid OpenACC: there's nothing that guarantees that
+   the program will terminate.  So, we only do this for nvptx.  */
+#define SPIN_CNT_MAX 0
+
+#include "spin-lock-shared.c"
diff --git a/libgomp/testsuite/libgomp.oacc-c/spin-lock-shared-3.c b/libgomp/testsuite/libgomp.oacc-c/spin-lock-shared-3.c
new file mode 100644
index 00000000000..79f22f7ec4e
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c/spin-lock-shared-3.c
@@ -0,0 +1,7 @@
+/* As in spin-lock-global-2.c.  */
+/* { dg-do run { target openacc_nvidia_accel_selected } } */
+
+/* Also test without JIT optimization.  */
+/* { dg-set-target-env-var GOMP_NVPTX_JIT "-O0" } */
+
+#include "spin-lock-shared-2.c"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-10  9:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10  9:18 [PATCH][libgomp, nvptx] Add spinlock test-cases Tom de Vries

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).