This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [og7] vector_length extension part 3: reductions
- From: Tom de Vries <Tom_deVries at mentor dot com>
- To: Cesar Philippidis <cesar at codesourcery dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 5 Apr 2018 16:07:51 +0200
- Subject: Re: [og7] vector_length extension part 3: reductions
- References: <d6642c62-6d01-10ce-dda2-f5fa453ed971@codesourcery.com> <d00ad9ed-18c4-d8b2-603e-1e1993ccf07b@codesourcery.com>
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 <tom@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" } */