Hi Cesar! Great progress with your OpenACC reductions work!
On Fri, 17 Jul 2015 11:13:59 -0700, Cesar Philippidis <ce...@codesourcery.com> wrote: > This patch updates the libgomp OpenACC reduction test cases [...] > --- a/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90 > +++ b/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90 > @@ -4,9 +4,12 @@ > > program reduction > integer, parameter :: n = 40, c = 10 > - integer :: i, vsum, sum > + integer :: i, vsum, gs, ws, vs, cs > > - call redsub (sum, n, c) > + call redsub_gang (gs, n, c) > + call redsub_worker (gs, n, c) > + call redsub_vector (vs, n, c) > + call redsub_combined (cs, n, c) > > vsum = 0 > > @@ -15,10 +18,11 @@ program reduction > vsum = vsum + c > end do > > - if (sum.ne.vsum) call abort () > + if (gs .ne. vsum) call abort () > + if (vs .ne. vsum) call abort () > end program reduction This looks incomplete to me, so I extended it as follows. With -O0, I frequently see this test FAIL (thus XFAILed), both for nvptx offloading and host-fallback execution. Adding a few printfs, I observe redsub_gang compute "random" results. Given the following -Wuninitialized/-Wmaybe-uninitialized warnings (for -O1, for example), maybe there's some initialization of (internal) variables missing? (These user-visible warnings about compiler internals need to be addressed regardless.) Would you please have a look at that? source-gcc/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90: In function 'redsub_combined_._omp_fn.0': source-gcc/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90:73:0: warning: '<anonymous>' is used uninitialized in this function [-Wuninitialized] !$acc loop reduction(+:sum) gang worker vector ^ source-gcc/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90: In function 'redsub_vector_._omp_fn.1': source-gcc/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90:60:0: warning: '<anonymous>' is used uninitialized in this function [-Wuninitialized] !$acc loop reduction(+:sum) vector ^ source-gcc/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90: In function 'redsub_worker_._omp_fn.2': source-gcc/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90:47:0: warning: '<anonymous>' is used uninitialized in this function [-Wuninitialized] !$acc loop reduction(+:sum) worker ^ source-gcc/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90: In function 'redsub_gang_._omp_fn.3': source-gcc/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90:34:0: warning: 'sum.43' may be used uninitialized in this function [-Wmaybe-uninitialized] !$acc loop reduction(+:sum) gang ^ Committed to gomp-4_0-branch in r227897: commit 0a1cca2cc3c1d1e2310c6438299e63a7bd99396b Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Fri Sep 18 08:07:47 2015 +0000 Extend OpenACC reduction test case, XFAIL for -O0 libgomp/ * testsuite/libgomp.oacc-fortran/reduction-5.f90: Extend. XFAIL execution test for -O0. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@227897 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgomp/ChangeLog.gomp | 5 +++++ libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90 | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp index 63bc7dc..0c0e697 100644 --- libgomp/ChangeLog.gomp +++ libgomp/ChangeLog.gomp @@ -1,3 +1,8 @@ +2015-09-18 Thomas Schwinge <tho...@codesourcery.com> + + * testsuite/libgomp.oacc-fortran/reduction-5.f90: Extend. XFAIL + execution test for -O0. + 2015-09-15 Nathan Sidwell <nat...@codesourcery.com> * oacc-parallel.c (GOACC_parallel_keyed): Use GOMP_DIM constants. diff --git libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90 libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90 index 304fe7f..f787e7d 100644 --- libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90 +++ libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90 @@ -1,4 +1,5 @@ ! { dg-do run } +! { dg-xfail-run-if "TODO" { *-*-* } { "-O0" } } ! subroutine reduction @@ -7,7 +8,7 @@ program reduction integer :: i, vsum, gs, ws, vs, cs call redsub_gang (gs, n, c) - call redsub_worker (gs, n, c) + call redsub_worker (ws, n, c) call redsub_vector (vs, n, c) call redsub_combined (cs, n, c) @@ -19,7 +20,9 @@ program reduction end do if (gs .ne. vsum) call abort () + if (ws .ne. vsum) call abort () if (vs .ne. vsum) call abort () + if (cs .ne. vsum) call abort () end program reduction subroutine redsub_gang(sum, n, c) > -subroutine redsub(sum, n, c) > +subroutine redsub_gang(sum, n, c) > integer :: sum, n, c > > sum = 0 > @@ -29,4 +33,43 @@ subroutine redsub(sum, n, c) > sum = sum + c > end do > !$acc end parallel > -end subroutine redsub > +end subroutine redsub_gang > + > +subroutine redsub_worker(sum, n, c) > + integer :: sum, n, c > + > + sum = 0 > + > + !$acc parallel copyin (n, c) num_workers(4) vector_length (32) copy(sum) > + !$acc loop reduction(+:sum) worker > + do i = 1, n > + sum = sum + c > + end do > + !$acc end parallel > +end subroutine redsub_worker > + > +subroutine redsub_vector(sum, n, c) > + integer :: sum, n, c > + > + sum = 0 > + > + !$acc parallel copyin (n, c) vector_length(32) copy(sum) > + !$acc loop reduction(+:sum) vector > + do i = 1, n > + sum = sum + c > + end do > + !$acc end parallel > +end subroutine redsub_vector > + > +subroutine redsub_combined(sum, n, c) > + integer :: sum, n, c > + > + sum = 0 > + > + !$acc parallel num_gangs (8) num_workers (4) vector_length(32) copy(sum) > + !$acc loop reduction(+:sum) gang worker vector > + do i = 1, n > + sum = sum + c > + end do > + !$acc end parallel > +end subroutine redsub_combined Grüße, Thomas
signature.asc
Description: PGP signature