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 <tdevr...@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"