From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115960 invoked by alias); 22 Feb 2017 08:17:19 -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 115951 invoked by uid 89); 22 Feb 2017 08:17:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-15.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy=Hx-languages-length:3633 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; Wed, 22 Feb 2017 08:17:16 +0000 Received: from svr-orw-fem-06.mgc.mentorg.com ([147.34.97.120]) by relay1.mentorg.com with esmtp id 1cgS6t-0002g4-3A from Thomas_Schwinge@mentor.com ; Wed, 22 Feb 2017 00:17:15 -0800 Received: from tftp-cs (147.34.91.1) by SVR-ORW-FEM-06.mgc.mentorg.com (147.34.97.120) with Microsoft SMTP Server id 14.3.224.2; Wed, 22 Feb 2017 00:17:14 -0800 Received: by tftp-cs (Postfix, from userid 49978) id 0C010C23F3; Wed, 22 Feb 2017 00:17:14 -0800 (PST) From: Thomas Schwinge To: Cesar Philippidis , "gcc-patches@gcc.gnu.org" CC: Martin Jambor , Jakub Jelinek Subject: Re: [gomp4] add -finform-parallelism In-Reply-To: References: User-Agent: Notmuch/0.9-125-g4686d11 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Wed, 22 Feb 2017 08:28:00 -0000 Message-ID: <87vas27i7u.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2017-02/txt/msg01366.txt.bz2 Hi Cesar! On Mon, 20 Feb 2017 20:42:59 -0800, Cesar Philippidis wrote: > This patch introduces a new -finform-parallelism flag to report any > detected parallelism encountered by the compiler. Initially, it's being > used to report how oaccdevlow partitions OpenACC loops. Currently, if > you want to extract this information, you need to compile the program > with -fdump-tree-oaccdevlow, then scan the tree dump for lines marked > Loop and decode the decimal bitmask that represents the parallelism. > This patch makes this process more user friendly by utilizing inform > messages to highlight the directives inside the source code, and clearly > print out the associated parallelism. E.g. given >=20 > !$acc parallel loop > do i =3D ... > !$acc parallel loop > do j =3D ... >=20 > -finform-parallelism reports (Actually that should report that an OpenACC parallel construct nested in another OpenACC parallel construct is not yet supported?) > inform-parallelism.f90: In function =E2=80=98MAIN__._omp_fn.0=E2=80=99: > inform-parallelism.f90:10:0: note: ACC LOOP GANG > !$acc parallel loop >=20 > inform-parallelism.f90:12:0: note: ACC LOOP WORKER VECTOR > !$acc loop Thanks! > Unfortunately, because this oaccdevlow runs so late, the offloaded > function name doesn't match the one specified by the user. It's still useful. We can later look into how to preserve the "original name". > While working on this, I noticed that the fortran FE wasn't recording > the location of combined loop directives properly, so I fixed that bug. That's a separate bug fix, please. > I also removed an unused variable inside trans-openmp.c. Also a separate bug fix, please. In , I asked you to fix that one. > This patch still isn't complete because I found a similar bug in the c++ > FE. Thomas, before I fix that bug Again, a separate bug fix, please. > do you think this patch is worth > pursuing for gomp-4_0-branch or maybe even trunk in general? Definitely! > Ideally, we > can extend these diagnostics to report any detected loops inside kernels > regions. Right. > --- a/gcc/doc/invoke.texi > +++ b/gcc/doc/invoke.texi > +@item -finform-parallelism > +@opindex finform-parallelism > +Report any parallelism detected by the compiler. Inside OpenACC > +offloaded regions, this includes the gang, worker and vector level > +parallelism associated with any @code{ACC LOOP}s. This option is disabl= ed > +by default. I know Fortran likes to use upper case, but the generic GCC code uses lower-case names. > --- a/gcc/omp-low.c > +++ b/gcc/omp-low.c > +/* Provide diagnostics on OpenACC loops LOOP, its siblings and its > + children. */ > + > +static void > +inform_oacc_loop (oacc_loop *loop) > +{ > + const char *seq =3D loop->mask =3D=3D 0 ? " SEQ" : ""; > + const char *gang =3D loop->mask & GOMP_DIM_MASK (GOMP_DIM_GANG) > + ? " GANG" : ""; > + const char *worker =3D loop->mask & GOMP_DIM_MASK (GOMP_DIM_WORKER) > + ? " WORKER" : ""; > + const char *vector =3D loop->mask & GOMP_DIM_MASK (GOMP_DIM_VECTOR) > + ? " VECTOR" : ""; > + > + inform (loop->loc, "ACC LOOP%s%s%s%s", seq, gang, worker, vector); Likewise. Per I'm suggesting this to be done a bit differently: instead of "inform", this would then use the appropriate "-fopt-info-note-omp" option group output. If that's not yet there, possibly there could be some new flag added for "-fopt-info" to display the "rich" location, which will also print the original source code? Gr=C3=BC=C3=9Fe Thomas