From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100635 invoked by alias); 29 Sep 2015 09:48:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 100623 invoked by uid 89); 29 Sep 2015 09:48:36 -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; Tue, 29 Sep 2015 09:48:34 +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 1ZgrWR-0004fD-0k from Thomas_Schwinge@mentor.com for gcc-patches@gcc.gnu.org; Tue, 29 Sep 2015 02:48:31 -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; Tue, 29 Sep 2015 10:48:29 +0100 From: Thomas Schwinge To: Cesar Philippidis CC: "gcc-patches@gcc.gnu.org" Subject: Re: [gomp4] error on acc loops not associated with offloaded acc regions In-Reply-To: <56097412.4080600@codesourcery.com> References: <56097412.4080600@codesourcery.com> User-Agent: Notmuch/0.9-125-g4686d11 (http://notmuchmail.org) Emacs/24.5.1 (i586-pc-linux-gnu) Date: Tue, 29 Sep 2015 10:16:00 -0000 Message-ID: <87mvw5tv2y.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-SW-Source: 2015-09/txt/msg02176.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 3079 Hi Cesar! On Mon, 28 Sep 2015 10:08:34 -0700, Cesar Philippidis wrote: > I've applied this patch to gomp-4_0-branch which teaches omplower how to > error when it detects acc loops which aren't nested inside an acc > parallel or kernels region or located within a function marked as an acc > routine. A couple of test cases needed to be updated. >=20 > The error message is kind of long. Let me know if it should be revised. > gcc/testsuite/ > * c-c++-common/goacc/non-routine.c: New test. > * c-c++-common/goacc-gomp/nesting-1.c: Add checks for invalid loop > nesting. > * c-c++-common/goacc-gomp/nesting-fail-1.c: Likewise. > * c-c++-common/goacc/clauses-fail.c: Likewise. > * c-c++-common/goacc/sb-1.c: Likewise. > * c-c++-common/goacc/sb-3.c: Likewise. > * gcc.dg/goacc/sb-1.c: Likewise. > * gcc.dg/goacc/sb-3.c: Likewise. What about any Fortran test cases? > --- a/gcc/omp-low.c > +++ b/gcc/omp-low.c > @@ -2901,6 +2901,14 @@ check_omp_nesting_restrictions (gimple *stmt, omp_= context *ctx) > } > return true; > } > + if (is_gimple_omp_oacc (stmt) && ctx =3D=3D NULL > + && get_oacc_fn_attrib (current_function_decl) =3D=3D NULL) > + { > + error_at (gimple_location (stmt), > + "acc loops must be associated with an acc region or " > + "routine"); > + return false; > + } > /* FALLTHRU */ > case GIMPLE_CALL: > if (is_gimple_call (stmt) I see that the error reporting doesn't really use a consistent style currently, but what about something like "loop directive must be associated with compute region" (where "compute region" is the language used by OpenACC 2.0a to mean the structured block associated with a compute construct as well as routine directive)? > --- a/gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c > +++ b/gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c > @@ -20,6 +20,7 @@ f_acc_kernels (void) > } > } >=20=20 > +#pragma acc routine > void > f_acc_loop (void) > { OK, but... > --- a/gcc/testsuite/c-c++-common/goacc-gomp/nesting-fail-1.c > +++ b/gcc/testsuite/c-c++-common/goacc-gomp/nesting-fail-1.c > @@ -361,72 +361,72 @@ f_acc_data (void) > void > f_acc_loop (void) > { > -#pragma acc loop > +#pragma acc loop /* { dg-error "acc loops must be associated with an acc= region or routine" } */ > for (i =3D 0; i < 2; ++i) > { > -#pragma omp parallel /* { dg-error "non-OpenACC construct inside of Open= ACC region" } */ > +#pragma omp parallel > ; > } ... here you're changing what this is meant to be testing, so please restore the original meaning (by adding "#pragma acc routine" to this function, I suppose), and then perhaps add whichever additional test cases you deem necessary. > --- /dev/null > +++ b/gcc/testsuite/c-c++-common/goacc/non-routine.c > @@ -0,0 +1,16 @@ > +/* This program validates the behavior of acc loops which are > + not associated with a parallel or kernles region or routine. */ :-) Thanks for adding such a comment -- this is missing in too many test cases. Gr=C3=BC=C3=9Fe, Thomas --=-=-= Content-Type: application/pgp-signature; name="signature.asc" Content-length: 472 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJWCl5lAAoJEK3/DN1sMFFt8rAH/1dBItPDCT1ylFZXjuuQ5Q5P nCXbEHD6nE+GQy4Ks6H6Ysn+Zhn1Rf5vmKilryl6+jAlmyvRGp2oBmW6t+kMNNji Fv2b8Ehs8ooFNTVuhNpYdKXYDyFbAXE014cKUzLPHDxOJdMSnH82MMt5VhDAHwhp SCq2wdRwrpM3nptTuLsV2cm+5IpML7Udk4rNqtCMHX9Xa3HQ6QzMKXab/uP8WUPV fmB4kqL7wntp9Oh8FUpjAXrrViPchhstY5WVZEKiLkwH43RnNZgMRQJ4XqSy4rjZ 8VnlpN58CEDWDZ+7S7M+31clYTtIY7aKEOZfw6hhMIBfg/NwIQAUflvmCaGwabk= =vq4H -----END PGP SIGNATURE----- --=-=-=--