From patchwork Fri Sep 18 08:11:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 519169 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5735D14016A for ; Fri, 18 Sep 2015 18:11:47 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=BXCidJpb; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=PwlX4dVEuoi5WgWP iE9oAIFov3vMDYzCynPjD5ZyO/G74wQ2HedsO3kmPOD6YmrOD4G3/0fFTLmJEwqI brkRXcBE7vPJBuyrqXw2ozic+mxI3a/VPdc5IzjmVl4UPyesOjR3d5wBHl343kZj M6BSYI6a6INTfB8u5DIUzGO7AGA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=8egNtzIBwdkSLSBDR64LNc n8Y0Y=; b=BXCidJpbO0FtlaFUAS2XhCHPloYpNw0LZWQ4wTvdr+9BfQqGHjWA0A lHMQZixNY5DNaDma6WAb1YZZ/V+fRjP6JKmZx1U+iQ54y+UwzhdfoBxUcpdchsGo ImDPLmtLsiWJu9+1JjBepdE+eSC3j2sX3UcPi+DQSLZKV7RRmVsYk= Received: (qmail 130783 invoked by alias); 18 Sep 2015 08:11:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 130738 invoked by uid 89); 18 Sep 2015 08:11:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 18 Sep 2015 08:11:37 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZcqlZ-0000rx-0w from Thomas_Schwinge@mentor.com ; Fri, 18 Sep 2015 01:11:33 -0700 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Fri, 18 Sep 2015 09:11:31 +0100 From: Thomas Schwinge To: Cesar Philippidis CC: "gcc-patches@gcc.gnu.org" , Nathan Sidwell , Jakub Jelinek Subject: Re: [gomp4] OpenACC reduction tests In-Reply-To: <55A945E7.2050005@codesourcery.com> References: <55A945A1.4090109@codesourcery.com> <55A945E7.2050005@codesourcery.com> User-Agent: Notmuch/0.9-125-g4686d11 (http://notmuchmail.org) Emacs/24.5.1 (i586-pc-linux-gnu) Date: Fri, 18 Sep 2015 10:11:25 +0200 Message-ID: <8737yc2lle.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Hi Cesar! Great progress with your OpenACC reductions work! On Fri, 17 Jul 2015 11:13:59 -0700, Cesar Philippidis 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: '' 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: '' 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: '' 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 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(-) > -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 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 + + * testsuite/libgomp.oacc-fortran/reduction-5.f90: Extend. XFAIL + execution test for -O0. + 2015-09-15 Nathan Sidwell * 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)