From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67801 invoked by alias); 23 May 2016 14:55:11 -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 66927 invoked by uid 89); 23 May 2016 14:55:10 -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=watch, late 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; Mon, 23 May 2016 14:55:04 +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 655127F6A4; Mon, 23 May 2016 14:55:03 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-88.ams2.redhat.com [10.36.116.88]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4NEt13g022773 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 23 May 2016 10:55:02 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u4NEsxud002583; Mon, 23 May 2016 16:54:59 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u4NEsumS002582; Mon, 23 May 2016 16:54:56 +0200 Date: Mon, 23 May 2016 14:55:00 -0000 From: Jakub Jelinek To: Alexander Monakov Cc: Ilya Verbin , Nathan Sidwell , Thomas Schwinge , Jan Hubicka , gcc-patches@gcc.gnu.org Subject: Re: "omp declare target" on DECL_EXTERNAL vars Message-ID: <20160523145456.GU28550@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20160520161244.GN28550@tucnak.redhat.com> <20160520162120.GO28550@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2016-05/txt/msg01808.txt.bz2 On Mon, May 23, 2016 at 05:37:17PM +0300, Alexander Monakov wrote: > Hello, > > On Fri, 20 May 2016, Jakub Jelinek wrote: > [snip] > > The reason I needed the above is that both gimplify.c and omp-low.c > > test just the node->offloadable flag, bit the attribute, and so when > > it is external and the flag wasn't set, we could privatize the vars > > even when we were supposed to map them etc. > > In the C/C++ FEs, we set not just node->offloadable, but also > > for ENABLE_OFFLOADING g->have_offload and offload_vars too. > > Wonder if that means we register even non-local vars, that would be IMHO a > > bug. On the other side, we need to watch for an extern declaration > > of a VAR_DECL marked for offloading and only later on locally defined, > > in that case if we haven't set g->have_offload and added entry to > > offload_vars, we'd need to do it when merging the extern decl with the > > definition. > > > > So, your thoughts on that? > > As I'm relatively late to this game, at times like this it's hard for me to > follow what's the general model is. It appears that 'omp declare target' is > superfluous given symtab_node::offloadable. Offloading compilation still needs > to distinguish target region entry points from the rest of the functions > (hence 'omp target entrypoint' serves a clear purpose), but does plain 'omp > declare target' have a particular meaning not conveyed by > symtab_node::offloadable && !'omp target entrypoint'? "omp declare target" and "omp declare target link" attributes are FE representation, symtab_node::offloadable is ME representation. We have just one bit in the latter right now, so e.g. it does not differentiate between the two kinds of offloadable vars. In the C/C++ FE, we set the offloadable bit right away next to the creation of the attribute, in the Fortran FE we don't (and not sure if it is even safe to create symtab node at that point yet). > Is/should be there an invariant like "when omp-low is completed, all decls > annotated with 'omp declare target' will also have symtab_node::offloadable > set"? Without my patch to gomp4.5 branch, that invariant didn't hold for Fortran DECL_EXTERNAL vars. With the patch it holds, but we need to come to agreement what behavior we do want for DECL_EXTERNAL vars. Jakub