From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 83361 invoked by alias); 3 Jun 2016 07:15:15 -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 81107 invoked by uid 89); 3 Jun 2016 07:15:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2064 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; Fri, 03 Jun 2016 07:15:11 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (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 B280AC049E1D; Fri, 3 Jun 2016 07:15:10 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-51.ams2.redhat.com [10.36.116.51]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u537F9cc015786 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 3 Jun 2016 03:15:10 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u537F7Rt007454; Fri, 3 Jun 2016 09:15:07 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u537F6eu007453; Fri, 3 Jun 2016 09:15:06 +0200 Date: Fri, 03 Jun 2016 07:15:00 -0000 From: Jakub Jelinek To: Chung-Lin Tang Cc: Thomas Schwinge , Cesar Philippidis , gcc-patches Subject: Re: [PATCH, OpenACC] Make reduction arguments addressable Message-ID: <20160603071506.GD7387@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20160530165341.GS28550@tucnak.redhat.com> <878tyqsn32.fsf@kepler.schwinge.homeip.net> <3c5f38f7-ac02-6757-13bf-de48a1192048@codesourcery.com> <9b09bd96-cadc-538b-5341-6b2937ed78f5@codesourcery.com> <20160601133842.GQ28550@tucnak.redhat.com> <20160602140022.GJ28550@tucnak.redhat.com> <4d950359-d416-ca2e-f700-9f7cd5e41b13@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4d950359-d416-ca2e-f700-9f7cd5e41b13@codesourcery.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2016-06/txt/msg00243.txt.bz2 On Fri, Jun 03, 2016 at 03:13:40PM +0800, Chung-Lin Tang wrote: > On 2016/6/2 10:00 PM, Jakub Jelinek wrote: > > Wouldn't it be better to pass either a bool openacc_async flag, or > > whole clauses, down to gfc_trans_omp_reduction_list and handle it there > > instead of walking the list after the fact? > > You mean this style? (patch attached) > Tested again with no regressions. > > Thanks, > Chung-Lin > > * trans-openmp.c (gfc_trans_omp_reduction_list): Add mark_addressable > bool parameter, set reduction clause DECLs as addressable when true. > (gfc_trans_omp_clauses): Pass clauses->async to > gfc_trans_omp_reduction_list, add comment describing OpenACC situation. Yep, thanks (and the C/C++ patch is ok too). > Index: trans-openmp.c > =================================================================== > --- trans-openmp.c (revision 236845) > +++ trans-openmp.c (working copy) > @@ -1646,7 +1646,7 @@ gfc_trans_omp_array_reduction_or_udr (tree c, gfc_ > > static tree > gfc_trans_omp_reduction_list (gfc_omp_namelist *namelist, tree list, > - locus where) > + locus where, bool mark_addressable) > { > for (; namelist != NULL; namelist = namelist->next) > if (namelist->sym->attr.referenced) > @@ -1657,6 +1657,8 @@ gfc_trans_omp_reduction_list (gfc_omp_namelist *na > tree node = build_omp_clause (where.lb->location, > OMP_CLAUSE_REDUCTION); > OMP_CLAUSE_DECL (node) = t; > + if (mark_addressable) > + TREE_ADDRESSABLE (t) = 1; > switch (namelist->u.reduction_op) > { > case OMP_REDUCTION_PLUS: > @@ -1747,7 +1749,10 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp > switch (list) > { > case OMP_LIST_REDUCTION: > - omp_clauses = gfc_trans_omp_reduction_list (n, omp_clauses, where); > + /* An OpenACC async clause indicates the need to set reduction > + arguments addressable, to allow asynchronous copy-out. */ > + omp_clauses = gfc_trans_omp_reduction_list (n, omp_clauses, where, > + clauses->async); > break; > case OMP_LIST_PRIVATE: > clause_code = OMP_CLAUSE_PRIVATE; Jakub