From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 124259 invoked by alias); 7 Apr 2016 09:57:17 -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 124247 invoked by uid 89); 7 Apr 2016 09:57:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=importantly X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 07 Apr 2016 09:57:06 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BA79E80F6C; Thu, 7 Apr 2016 09:57:04 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-113-22.phx2.redhat.com [10.3.113.22]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u379v216001349 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 7 Apr 2016 05:57:03 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u379uxJp025642; Thu, 7 Apr 2016 11:57:00 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u379uvOr025641; Thu, 7 Apr 2016 11:56:57 +0200 Date: Thu, 07 Apr 2016 09:57:00 -0000 From: Jakub Jelinek To: Cesar Philippidis Cc: "gcc-patches@gcc.gnu.org" , Nathan Sidwell Subject: Re: openacc reference reductions Message-ID: <20160407095657.GD19207@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <56BA0257.6050607@codesourcery.com> <56BA06C3.90606@acm.org> <56BA10FC.90705@codesourcery.com> <56CB2A76.3090809@codesourcery.com> <57046C2B.6080002@codesourcery.com> <20160406142340.GZ19207@tucnak.redhat.com> <57056FCA.7040602@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <57056FCA.7040602@codesourcery.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg00329.txt.bz2 On Wed, Apr 06, 2016 at 01:21:30PM -0700, Cesar Philippidis wrote: > That's a good idea. I went ahead and combined this patch with the data > map reduction fix for PR70289 that I posted on Monday, > , because I'm > already scanning for parallel reduction data clauses in there. As you > suggested, I introduced an OMP_CLAUSE_MAP_IN_REDUCTION macro to the data > clauses associated with acc parallel reductions. > > Is this patch OK for trunk? It fixes PR70289, PR70348, PR70373, PR70533, > PR70535 and PR70537. > 2016-04-06 Cesar Philippidis > > PR lto/70289 Then please use PR lto/70289 PR ipa/70348 PR tree-optimization/70373 PR middle-end/70533 PR middle-end/70535 PR70537 sounds like a typo to me, did you mean some other PR? > gcc/ > * gimplify.c (gimplify_adjust_acc_parallel_reductions): New function. ... > * gcc/tree.h (OMP_CLAUSE_MAP_IN_REDUCTION): New macro. No gcc/ prefix please. > * testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Increate test > coverage. Increase? > * testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Likewise. > * testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Likewise. > * testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Likewise. > * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise. > * testsuite/libgomp.oacc-c-c++-common/reduction-6.c: New test. > * testsuite/libgomp.oacc-c-c++-common/reduction.h: New test. > * testsuite/libgomp.oacc-fortran/parallel-reduction.f90: New test. > * testsuite/libgomp.oacc-fortran/pr70289.f90: New test. > * testsuite/libgomp.oacc-fortran/reduction-1.f90: Increate test Ditto. > + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_PRIVATE > + || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE) > + { > + error_at (OMP_CLAUSE_LOCATION (c), "invalid private reduction " > + "on %qE", DECL_NAME (decl)); This looks wrongly formatted, "on is not below OMP. > + /* Scan 3: Add a present_or_copy clause for any reduction variable which > + doens't have a data clause already. */ doesn't > + for (hash_set::iterator iter = reduction_decls->begin (); > + iter != reduction_decls->end (); ++iter) > + { > + tree decl = *iter; > + > + tree nc = build_omp_clause (UNKNOWN_LOCATION, OMP_CLAUSE_MAP); > + OMP_CLAUSE_SET_MAP_KIND (nc, GOMP_MAP_TOFROM); > + OMP_CLAUSE_DECL (nc) = decl; > + if (!POINTER_TYPE_P (TREE_TYPE (decl))) > + OMP_CLAUSE_MAP_IN_REDUCTION (nc) = 1; > + TREE_CHAIN (nc) = list; > + list = nc; > + } > + > + cleanup: > + delete reduction_decls; > + delete pointer_decls; > + > + return list; > +} But more importantly, do you really have to do this separately? I admit I haven't stepped through your testcases in the debugger, so correct me if I'm missing something: I mean, gimplify_scan_omp_clauses should omp_add_variable for the OMP_CLAUSE_REDUCTION with GOVD_REDUCTION | GOVD_SEEN | GOVD_EXPLICIT and OMP_CLAUSE_MAP with GOVD_MAP | GOVD_EXPLICIT or so, similarly GOVD_PRIVATE and/or GOVD_FIRSTPRIVATE flags from OMP_CLAUSE_PRIVATE/OMP_CLAUSE_FIRSTPRIVATE. So I believe you should have all the info you need in (gimplify_adjust_omp_clauses) , you have the CODE of the construct this is on (so check OACC_PARALLEL or whatever you need), and you should be able to check if there is explicit map/private/firstprivate clause together with OMP_CLAUSE_REDUCTION or not, and then you can add the extra implicit clause and set OMP_CLAUSE_MAP_IN_REDUCTION on it as appropriate. Jakub