On 03/02/2018 06:51 PM, Cesar Philippidis wrote:
This patch teaches the nvptx BE how to process vector reductions with large vector lengths.
Committed test-case exercising large vector length with reductions. Thanks, - Tom
[openacc] Add vector-length-128-10.c 2018-04-05 Tom de Vries <t...@codesourcery.com> * testsuite/libgomp.oacc-c-c++-common/vector-length-128-10.c: New test. --- .../vector-length-128-10.c | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/vector-length-128-10.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/vector-length-128-10.c new file mode 100644 index 0000000..e46b5cf --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/vector-length-128-10.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ + +#include <stdlib.h> + +#define N 1024 + +unsigned int a[N]; +unsigned int b[N]; +unsigned int c[N]; +unsigned int n = N; + +int +main (void) +{ + for (unsigned int i = 0; i < n; ++i) + { + a[i] = i % 3; + b[i] = i % 5; + } + + unsigned int res = 1; + unsigned long long res2 = 1; +#pragma acc parallel vector_length (128) copyin (a,b) reduction (+:res, res2) copy (res, res2) + { +#pragma acc loop vector reduction (+:res, res2) + for (unsigned int i = 0; i < n; i++) + { + res += ((a[i] + b[i]) % 2); + res2 += ((a[i] + b[i]) % 2); + } + } + + if (res != 478) + abort (); + if (res2 != 478) + abort (); + + return 0; +} +/* { dg-prune-output "using vector_length \\(32\\), ignoring 128" } */