From 56314b772f0867d81a4f7c7850d460e395563dff Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Sat, 12 Jan 2019 22:18:50 +0000 Subject: [PATCH] [nvptx] Force vl32 if calling vector-partitionable routines -- test-cases Add test-cases for "[nvptx] Force vl32 if calling vector-partitionable routines". 2019-01-12 Tom de Vries PR target/85486 * testsuite/libgomp.oacc-c-c++-common/pr85486-3.c: New test. * testsuite/libgomp.oacc-c-c++-common/pr85486.c: New test. From-SVN: r267894 --- libgomp/ChangeLog | 6 +++ .../libgomp.oacc-c-c++-common/pr85486-3.c | 54 +++++++++++++++++++ .../libgomp.oacc-c-c++-common/pr85486.c | 51 ++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/pr85486-3.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/pr85486.c diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 7d56831e36a..e6b14609171 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,9 @@ +2019-01-12 Tom de Vries + + PR target/85486 + * testsuite/libgomp.oacc-c-c++-common/pr85486-3.c: New test. + * testsuite/libgomp.oacc-c-c++-common/pr85486.c: New test. + 2019-01-12 Tom de Vries PR target/85381 diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/pr85486-3.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr85486-3.c new file mode 100644 index 00000000000..a959b90c29a --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr85486-3.c @@ -0,0 +1,54 @@ +/* { dg-do run { target openacc_nvidia_accel_selected } } */ +/* { dg-set-target-env-var "GOMP_OPENACC_DIM" "::128" } */ + +/* Minimized from ref-1.C. */ + +#include + +#pragma acc routine vector +void __attribute__((noinline, noclone)) +Vector (int *ptr, int n, const int inc) +{ + #pragma acc loop vector + for (unsigned ix = 0; ix < n; ix++) + ptr[ix] += inc; +} + +int +main (void) +{ + const int n = 32, m=32; + + int ary[m][n]; + unsigned ix, iy; + + for (ix = m; ix--;) + for (iy = n; iy--;) + ary[ix][iy] = (1 << 16) + (ix << 8) + iy; + + int err = 0; + +#pragma acc parallel copy (ary) + { + Vector (&ary[0][0], m * n, (1 << 24) - (1 << 16)); + } + + for (ix = m; ix--;) + for (iy = n; iy--;) + if (ary[ix][iy] != ((1 << 24) + (ix << 8) + iy)) + { + printf ("ary[%u][%u] = %x expected %x\n", + ix, iy, ary[ix][iy], ((1 << 24) + (ix << 8) + iy)); + err++; + } + + if (err) + { + printf ("%d failed\n", err); + return 1; + } + + return 0; +} + +/* { dg-prune-output "using vector_length \\(32\\), ignoring runtime setting" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/pr85486.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr85486.c new file mode 100644 index 00000000000..99c08059d37 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr85486.c @@ -0,0 +1,51 @@ +/* { dg-do run { target openacc_nvidia_accel_selected } } */ + +/* Minimized from ref-1.C. */ + +#include + +#pragma acc routine vector +void __attribute__((noinline, noclone)) +Vector (int *ptr, int n, const int inc) +{ + #pragma acc loop vector + for (unsigned ix = 0; ix < n; ix++) + ptr[ix] += inc; +} + +int +main (void) +{ + const int n = 32, m=32; + + int ary[m][n]; + unsigned ix, iy; + + for (ix = m; ix--;) + for (iy = n; iy--;) + ary[ix][iy] = (1 << 16) + (ix << 8) + iy; + + int err = 0; + +#pragma acc parallel copy (ary) vector_length (128) /* { dg-warning "using vector_length \\(32\\) due to call to vector-partitionable routine, ignoring 128" } */ + { + Vector (&ary[0][0], m * n, (1 << 24) - (1 << 16)); + } + + for (ix = m; ix--;) + for (iy = n; iy--;) + if (ary[ix][iy] != ((1 << 24) + (ix << 8) + iy)) + { + printf ("ary[%u][%u] = %x expected %x\n", + ix, iy, ary[ix][iy], ((1 << 24) + (ix << 8) + iy)); + err++; + } + + if (err) + { + printf ("%d failed\n", err); + return 1; + } + + return 0; +} -- 2.30.2