diff options
author | Tom de Vries <tdevries@suse.de> | 2022-02-24 11:26:27 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2022-02-24 11:41:03 +0100 |
commit | 59b8ade88774b4dcf1691a8f650cdbb86cc30862 (patch) | |
tree | 3f4080ebd41ffe9883329374e2acace2a37a4b2d | |
parent | a046033ea0ba97314265933bc48124574db2d62a (diff) | |
download | gcc-59b8ade88774b4dcf1691a8f650cdbb86cc30862.zip gcc-59b8ade88774b4dcf1691a8f650cdbb86cc30862.tar.gz gcc-59b8ade88774b4dcf1691a8f650cdbb86cc30862.tar.bz2 |
[libgomp, testsuite, nvptx] Add libgomp.c/declare-variant-3-sm*.c
Add openmp test-cases that test the omp declare variant construct:
...
#pragma omp declare variant (f30) match (device={isa("sm_30")})
...
using the available nvptx isas.
Only the one for sm_30 is a dg-do run test-case, the other ones are dg-do
link.
Tested on x86_64 with nvptx accelerator.
libgomp/ChangeLog:
2022-02-24 Tom de Vries <tdevries@suse.de>
* testsuite/libgomp.c/declare-variant-3-sm30.c: New test.
* testsuite/libgomp.c/declare-variant-3-sm35.c: New test.
* testsuite/libgomp.c/declare-variant-3-sm53.c: New test.
* testsuite/libgomp.c/declare-variant-3-sm70.c: New test.
* testsuite/libgomp.c/declare-variant-3-sm75.c: New test.
* testsuite/libgomp.c/declare-variant-3-sm80.c: New test.
* testsuite/libgomp.c/declare-variant-3.h: New header file.
7 files changed, 108 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-3-sm30.c b/libgomp/testsuite/libgomp.c/declare-variant-3-sm30.c new file mode 100644 index 0000000..ad1602c --- /dev/null +++ b/libgomp/testsuite/libgomp.c/declare-variant-3-sm30.c @@ -0,0 +1,7 @@ +/* { dg-do run { target { offload_target_nvptx } } } */ +/* { dg-additional-options "-foffload=-misa=sm_30" } */ +/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */ + +#include "declare-variant-3.h" + +/* { dg-final { scan-offload-tree-dump "= f30 \\(\\);" "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.c/declare-variant-3-sm35.c b/libgomp/testsuite/libgomp.c/declare-variant-3-sm35.c new file mode 100644 index 0000000..1a7cda2 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/declare-variant-3-sm35.c @@ -0,0 +1,7 @@ +/* { dg-do link { target { offload_target_nvptx } } } */ +/* { dg-additional-options "-foffload=-misa=sm_35" } */ +/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */ + +#include "declare-variant-3.h" + +/* { dg-final { scan-offload-tree-dump "= f35 \\(\\);" "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.c/declare-variant-3-sm53.c b/libgomp/testsuite/libgomp.c/declare-variant-3-sm53.c new file mode 100644 index 0000000..a37b5fd --- /dev/null +++ b/libgomp/testsuite/libgomp.c/declare-variant-3-sm53.c @@ -0,0 +1,7 @@ +/* { dg-do link { target { offload_target_nvptx } } } */ +/* { dg-additional-options "-foffload=-misa=sm_53" } */ +/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */ + +#include "declare-variant-3.h" + +/* { dg-final { scan-offload-tree-dump "= f53 \\(\\);" "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.c/declare-variant-3-sm70.c b/libgomp/testsuite/libgomp.c/declare-variant-3-sm70.c new file mode 100644 index 0000000..ab022cd --- /dev/null +++ b/libgomp/testsuite/libgomp.c/declare-variant-3-sm70.c @@ -0,0 +1,7 @@ +/* { dg-do link { target { offload_target_nvptx } } } */ +/* { dg-additional-options "-foffload=-misa=sm_70" } */ +/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */ + +#include "declare-variant-3.h" + +/* { dg-final { scan-offload-tree-dump "= f70 \\(\\);" "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.c/declare-variant-3-sm75.c b/libgomp/testsuite/libgomp.c/declare-variant-3-sm75.c new file mode 100644 index 0000000..7d09195 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/declare-variant-3-sm75.c @@ -0,0 +1,7 @@ +/* { dg-do link { target { offload_target_nvptx } } } */ +/* { dg-additional-options "-foffload=-misa=sm_75" } */ +/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */ + +#include "declare-variant-3.h" + +/* { dg-final { scan-offload-tree-dump "= f75 \\(\\);" "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.c/declare-variant-3-sm80.c b/libgomp/testsuite/libgomp.c/declare-variant-3-sm80.c new file mode 100644 index 0000000..898ae6e --- /dev/null +++ b/libgomp/testsuite/libgomp.c/declare-variant-3-sm80.c @@ -0,0 +1,7 @@ +/* { dg-do link { target { offload_target_nvptx } } } */ +/* { dg-additional-options "-foffload=-misa=sm_80" } */ +/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */ + +#include "declare-variant-3.h" + +/* { dg-final { scan-offload-tree-dump "= f80 \\(\\);" "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.c/declare-variant-3.h b/libgomp/testsuite/libgomp.c/declare-variant-3.h new file mode 100644 index 0000000..772fc20 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/declare-variant-3.h @@ -0,0 +1,66 @@ +#pragma omp declare target +int +f30 (void) +{ + return 30; +} + +int +f35 (void) +{ + return 35; +} + +int +f53 (void) +{ + return 53; +} + +int +f70 (void) +{ + return 70; +} + +int +f75 (void) +{ + return 75; +} + +int +f80 (void) +{ + return 80; +} + +#pragma omp declare variant (f30) match (device={isa("sm_30")}) +#pragma omp declare variant (f35) match (device={isa("sm_35")}) +#pragma omp declare variant (f53) match (device={isa("sm_53")}) +#pragma omp declare variant (f70) match (device={isa("sm_70")}) +#pragma omp declare variant (f75) match (device={isa("sm_75")}) +#pragma omp declare variant (f80) match (device={isa("sm_80")}) +int +f (void) +{ + return 0; +} + +#pragma omp end declare target + +int +main (void) +{ + int v = 0; + + #pragma omp target map(from:v) + v = f (); + + if (v == 0) + __builtin_abort (); + + __builtin_printf ("Nvptx accelerator: sm_%d\n", v); + + return 0; +} |