Re: [patch] various OpenACC reduction enhancements - test cases
On Tue, 4 Dec 2018 13:59:33 +0100 Jakub Jelinek wrote: > On Fri, Jun 29, 2018 at 11:23:21AM -0700, Cesar Philippidis wrote: > > Attached are the updated reductions tests cases. Again, these have > > been bootstrapped and regression tested cleanly for x86_64 with > > nvptx offloading. Is it OK for trunk? > > If Thomas is ok with this, it is ok for trunk. Here's a new version to go with the FE patch posted here: https://gcc.gnu.org/ml/gcc-patches/2018-12/msg00930.html Thanks, Julian ChangeLog 2018-xx-xx Cesar Philippidis Nathan Sidwell Julian Brown gcc/testsuite/ * c-c++-common/goacc/orphan-reductions-1.c: New test. * c-c++-common/goacc/reduction-7.c: New test. * c-c++-common/goacc/routine-4.c: Update. * g++.dg/goacc/reductions-1.C: New test. * gcc.dg/goacc/loop-processing-1.c: Update. * gfortran.dg/goacc/orphan-reductions-1.f90: New test. libgomp/ * libgomp.oacc-c-c++-common/par-reduction-3.c: New test. * libgomp.oacc-c-c++-common/reduction-cplx-flt-2.c: New test. * libgomp.oacc-fortran/reduction-9.f90: New test. commit 7d445a56d6db96696cec8359e58258d47fa7c9ae Author: Julian Brown Date: Wed Dec 12 11:11:03 2018 -0800 Various OpenACC reduction enhancements - test cases 2018-xx-xx Cesar Philippidis Nathan Sidwell Julian Brown gcc/testsuite/ * c-c++-common/goacc/orphan-reductions-1.c: New test. * c-c++-common/goacc/reduction-7.c: New test. * c-c++-common/goacc/routine-4.c: Update. * g++.dg/goacc/reductions-1.C: New test. * gcc.dg/goacc/loop-processing-1.c: Update. * gfortran.dg/goacc/orphan-reductions-1.f90: New test. libgomp/ * libgomp.oacc-c-c++-common/par-reduction-3.c: New test. * libgomp.oacc-c-c++-common/reduction-cplx-flt-2.c: New test. * libgomp.oacc-fortran/reduction-9.f90: New test. diff --git a/gcc/testsuite/c-c++-common/goacc/orphan-reductions-1.c b/gcc/testsuite/c-c++-common/goacc/orphan-reductions-1.c new file mode 100644 index 000..b0bd4a7 --- /dev/null +++ b/gcc/testsuite/c-c++-common/goacc/orphan-reductions-1.c @@ -0,0 +1,56 @@ +/* Test orphan reductions. */ + +#include + +#pragma acc routine seq +int +seq_reduction (int n) +{ + int i, sum = 0; +#pragma acc loop seq reduction(+:sum) + for (i = 0; i < n; i++) +sum = sum + 1; + + return sum; +} + +#pragma acc routine gang +int +gang_reduction (int n) +{ + int i, s1 = 0, s2 = 0; +#pragma acc loop gang reduction(+:s1) /* { dg-error "gang reduction on an orphan loop" } */ + for (i = 0; i < n; i++) +s1 = s1 + 2; + +#pragma acc loop gang reduction(+:s2) /* { dg-error "gang reduction on an orphan loop" } */ + for (i = 0; i < n; i++) +s2 = s2 + 2; + + + return s1 + s2; +} + +#pragma acc routine worker +int +worker_reduction (int n) +{ + int i, sum = 0; +#pragma acc loop worker reduction(+:sum) + for (i = 0; i < n; i++) +sum = sum + 3; + + return sum; +} + +#pragma acc routine vector +int +vector_reduction (int n) +{ + int i, sum = 0; +#pragma acc loop vector reduction(+:sum) + for (i = 0; i < n; i++) +sum = sum + 4; + + return sum; +} diff --git a/gcc/testsuite/c-c++-common/goacc/reduction-7.c b/gcc/testsuite/c-c++-common/goacc/reduction-7.c new file mode 100644 index 000..eba1d02 --- /dev/null +++ b/gcc/testsuite/c-c++-common/goacc/reduction-7.c @@ -0,0 +1,111 @@ +/* Exercise invalid reductions on array and struct members. */ + +void +test_parallel () +{ + struct { +int a; +float b[5]; + } s1, s2[10]; + + int i; + double z[100]; + +#pragma acc parallel reduction(+:s1.a) /* { dg-error "expected '\\\)' before '\\\.' token" } */ + for (i = 0; i < 10; i++) +s1.a += 1; + +#pragma acc parallel reduction(+:s1.b[3]) /* { dg-error "expected '\\\)' before '\\\.' token" } */ + for (i = 0; i < 10; i++) +s1.b[3] += 1; + +#pragma acc parallel reduction(+:s2[2].a) /* { dg-error "expected '\\\)' before '\\\[' token" } */ + for (i = 0; i < 10; i++) +s2[2].a += 1; + +#pragma acc parallel reduction(+:s2[3].b[4]) /* { dg-error "expected '\\\)' before '\\\[' token" } */ + for (i = 0; i < 10; i++) +s2[3].b[4] += 1; + +#pragma acc parallel reduction(+:z[5]) /* { dg-error "expected '\\\)' before '\\\[' token" } */ + for (i = 0; i < 10; i++) +z[5] += 1; +} + +void +test_combined () +{ + struct { +int a; +float b[5]; + } s1, s2[10]; + + int i; + double z[100]; + +#pragma acc parallel loop reduction(+:s1.a) /* { dg-error "expected '\\\)' before '\\\.' token" } */ + for (i = 0; i < 10; i++) +s1.a += 1; + +#pragma acc parallel loop reduction(+:s1.b[3]) /* { dg-error "expected '\\\)' before '\\\.' token" } */ + for (i = 0; i < 10; i++) +s1.b[3] += 1; + +#pragma acc parallel loop reduction(+:s2[2].a) /* { dg-error "expected '\\\)' before '\\\[' token" } */ + for (i = 0; i < 10; i++) +s2[2].a += 1; + +#pragma acc parallel loop
Re: [patch] various OpenACC reduction enhancements - test cases
On Fri, Jun 29, 2018 at 11:23:21AM -0700, Cesar Philippidis wrote: > Attached are the updated reductions tests cases. Again, these have been > bootstrapped and regression tested cleanly for x86_64 with nvptx > offloading. Is it OK for trunk? If Thomas is ok with this, it is ok for trunk. > 2018-06-29 Cesar Philippidis > Nathan Sidwell > > gcc/testsuite/ > * c-c++-common/goacc/orphan-reductions-1.c: New test. > * c-c++-common/goacc/reduction-7.c: New test. > * c-c++-common/goacc/routine-4.c: Update. > * g++.dg/goacc/reductions-1.C: New test. > * gcc.dg/goacc/loop-processing-1.c: Update. > * gfortran.dg/goacc/orphan-reductions-1.f90: New test. > > libgomp/ > * libgomp.oacc-c-c++-common/par-reduction-3.c: New test. > * libgomp.oacc-c-c++-common/reduction-cplx-flt-2.c: New test. > * libgomp.oacc-fortran/reduction-9.f90: New test. Jakub
Re: [patch] various OpenACC reduction enhancements - test cases
Attached are the updated reductions tests cases. Again, these have been bootstrapped and regression tested cleanly for x86_64 with nvptx offloading. Is it OK for trunk? Thanks, Cesar 2018-06-29 Cesar Philippidis Nathan Sidwell gcc/testsuite/ * c-c++-common/goacc/orphan-reductions-1.c: New test. * c-c++-common/goacc/reduction-7.c: New test. * c-c++-common/goacc/routine-4.c: Update. * g++.dg/goacc/reductions-1.C: New test. * gcc.dg/goacc/loop-processing-1.c: Update. * gfortran.dg/goacc/orphan-reductions-1.f90: New test. libgomp/ * libgomp.oacc-c-c++-common/par-reduction-3.c: New test. * libgomp.oacc-c-c++-common/reduction-cplx-flt-2.c: New test. * libgomp.oacc-fortran/reduction-9.f90: New test. From b128e80be7cd2c81171fbd9c8b23e786bb832633 Mon Sep 17 00:00:00 2001 From: Cesar Philippidis Date: Thu, 21 Jun 2018 11:37:56 -0700 Subject: [PATCH] Trunk reductions patches OG8 Reduction patches 4469fc4 [Fortran] Permit reductions in gfc_omp_clause_copy_ctor 704f1a2 [nxptx, OpenACC] vector reductions 8a35c89 [OpenACC] Fix a reduction bug involving GOMP_MAP_FIRSTPRIVATE_POINTER variables 16ead33 [OpenACC] Update error messages for c and c++ reductions 65dd9cf Make OpenACC orphan gang reductions errors 5d60102 [PR80547] Handle parallel reductions explicitly initialized by the user --- gcc/c/c-parser.c | 46 +- gcc/c/c-typeck.c | 8 + gcc/config/nvptx/nvptx.c | 233 +++- gcc/config/nvptx/nvptx.md | 7 + gcc/cp/parser.c | 27 +- gcc/cp/semantics.c| 8 + gcc/fortran/openmp.c | 12 + gcc/fortran/trans-openmp.c| 3 +- gcc/omp-general.h | 5 +- gcc/omp-low.c | 33 +- gcc/omp-offload.c | 18 + .../c-c++-common/goacc/orphan-reductions-1.c | 56 ++ .../c-c++-common/goacc/reduction-7.c | 111 gcc/testsuite/c-c++-common/goacc/routine-4.c | 8 +- gcc/testsuite/g++.dg/goacc/reductions-1.C | 548 ++ .../gcc.dg/goacc/loop-processing-1.c | 3 +- .../gfortran.dg/goacc/orphan-reductions-1.f90 | 204 +++ .../par-reduction-3.c | 29 + .../reduction-cplx-flt-2.c| 32 + .../libgomp.oacc-fortran/reduction-9.f90 | 54 ++ 20 files changed, 1396 insertions(+), 49 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/goacc/orphan-reductions-1.c create mode 100644 gcc/testsuite/c-c++-common/goacc/reduction-7.c create mode 100644 gcc/testsuite/g++.dg/goacc/reductions-1.C create mode 100644 gcc/testsuite/gfortran.dg/goacc/orphan-reductions-1.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-3.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-cplx-flt-2.c create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/reduction-9.f90 diff --git a/gcc/testsuite/c-c++-common/goacc/orphan-reductions-1.c b/gcc/testsuite/c-c++-common/goacc/orphan-reductions-1.c new file mode 100644 index 000..b0bd4a7de05 --- /dev/null +++ b/gcc/testsuite/c-c++-common/goacc/orphan-reductions-1.c @@ -0,0 +1,56 @@ +/* Test orphan reductions. */ + +#include + +#pragma acc routine seq +int +seq_reduction (int n) +{ + int i, sum = 0; +#pragma acc loop seq reduction(+:sum) + for (i = 0; i < n; i++) +sum = sum + 1; + + return sum; +} + +#pragma acc routine gang +int +gang_reduction (int n) +{ + int i, s1 = 0, s2 = 0; +#pragma acc loop gang reduction(+:s1) /* { dg-error "gang reduction on an orphan loop" } */ + for (i = 0; i < n; i++) +s1 = s1 + 2; + +#pragma acc loop gang reduction(+:s2) /* { dg-error "gang reduction on an orphan loop" } */ + for (i = 0; i < n; i++) +s2 = s2 + 2; + + + return s1 + s2; +} + +#pragma acc routine worker +int +worker_reduction (int n) +{ + int i, sum = 0; +#pragma acc loop worker reduction(+:sum) + for (i = 0; i < n; i++) +sum = sum + 3; + + return sum; +} + +#pragma acc routine vector +int +vector_reduction (int n) +{ + int i, sum = 0; +#pragma acc loop vector reduction(+:sum) + for (i = 0; i < n; i++) +sum = sum + 4; + + return sum; +} diff --git a/gcc/testsuite/c-c++-common/goacc/reduction-7.c b/gcc/testsuite/c-c++-common/goacc/reduction-7.c new file mode 100644 index 000..245c848d509 --- /dev/null +++ b/gcc/testsuite/c-c++-common/goacc/reduction-7.c @@ -0,0 +1,111 @@ +/* Exercise invalid reductions on array and struct members. */ + +void +test_parallel () +{ + struct { +int a; +float b[5]; + } s1, s2[10]; + + int i; + double z[100]; + +#pragma acc parallel reduction(+:s1.a) /* { dg-error "invalid reduction variable" } */ + for (i = 0; i < 10; i++) +s1.a += 1; + +#pragma acc parallel reduction(+:s1.b[3]) /* { dg-error "invalid reduction variable" } */ + for (i = 0; i < 10; i++)