From patchwork Wed Mar 12 13:48:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 329459 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8BDAC2C00CE for ; Thu, 13 Mar 2014 00:48:23 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=T3zcqnSJ8gUw0moI G96mfH0EiQdVOs9xEhbW8C2Xjugs1O/9C99ADosmIfHdFM1jSBjKXpb1HiIemD5l sHVUFKeAqpIDp5hv9LR9LSuE01NINHSEX+VJsorF2srjRhAUfMFWxYMxIdIrdBvB dW/Zz4swgGMGZEJJKSjXrUptfi4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=IN0vVeDlATo73vob7i5z5F oLrnU=; b=vthNec8WYXwUkY47WQTGTqmYqMaCZDq1FIXc9XJZYClsLTttnYYWOM UQAvdz9DctfqLwvu/+g8xEfCiOBF9gA0XNO6ybbQzIZfjGWA0liRvkqPtsecLs3c +KV89xgOajF09kyljItS2aMHg5wVAj8rip3IVS6MppVY9AI0s/AUU= Received: (qmail 3481 invoked by alias); 12 Mar 2014 13:48:16 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 3469 invoked by uid 89); 12 Mar 2014 13:48:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00 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; Wed, 12 Mar 2014 13:48:10 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WNjVv-0004N9-Gg from Thomas_Schwinge@mentor.com ; Wed, 12 Mar 2014 06:48:07 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 12 Mar 2014 06:48:07 -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.2.247.3; Wed, 12 Mar 2014 13:48:05 +0000 From: Thomas Schwinge To: , CC: Jakub Jelinek , Richard Henderson , "Michael V. Zolotukhin" , , Subject: Re: [gomp4] Accelerator constructs omp lowering and expansion In-Reply-To: <20130904185447.GG23437@tucnak.redhat.com> References: <20130904185447.GG23437@tucnak.redhat.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/23.4.1 (i486-pc-linux-gnu) Date: Wed, 12 Mar 2014 14:48:03 +0100 Message-ID: <877g7zfrzg.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Hi! On Wed, 4 Sep 2013 20:54:47 +0200, Jakub Jelinek wrote: > This patch implements #pragma omp {target{, data, update},teams} lowering > and expansion, and adds stub calls into libgomp, so that (for now > unconditionally) we can at least always fall back to host execution. > 2013-09-04 Jakub Jelinek > * omp-low.c [...] > (create_omp_child_function): If current function has > "omp declare target" attribute or if current region > is OMP_TARGET or lexically nested in it, add that > attribute to the omp child function. It seems that I have missed this one when generalizing the existing code for OpenACC: > --- gcc/omp-low.c.jj 2013-08-27 22:44:31.000000000 +0200 > +++ gcc/omp-low.c 2013-09-04 19:58:30.320019227 +0200 > @@ -1677,6 +1775,26 @@ create_omp_child_function (omp_context * > DECL_EXTERNAL (decl) = 0; > DECL_CONTEXT (decl) = NULL_TREE; > DECL_INITIAL (decl) = make_node (BLOCK); > + bool target_p = false; > + if (lookup_attribute ("omp declare target", > + DECL_ATTRIBUTES (current_function_decl))) > + target_p = true; > + else > + { > + omp_context *octx; > + for (octx = ctx; octx; octx = octx->outer) > + if (gimple_code (octx->stmt) == GIMPLE_OMP_TARGET > + && gimple_omp_target_kind (octx->stmt) > + == GF_OMP_TARGET_KIND_REGION) > + { > + target_p = true; > + break; > + } > + } > + if (target_p) > + DECL_ATTRIBUTES (decl) > + = tree_cons (get_identifier ("omp declare target"), > + NULL_TREE, DECL_ATTRIBUTES (decl)); > > t = build_decl (DECL_SOURCE_LOCATION (decl), > RESULT_DECL, NULL_TREE, void_type_node); Even if not yet relevant at the moment for OpenACC, I think it makes sense to make it more obvious, and change the code as follows. Will commit soon unless someone disagrees. commit a07a6e3414da55ff4bbc8b7f0ceb747c1712fecc Author: Thomas Schwinge Date: Wed Mar 12 12:30:58 2014 +0100 * gcc/omp-low.c (create_omp_child_function): Use is_gimple_omp_offloaded. Grüße, Thomas diff --git gcc/omp-low.c gcc/omp-low.c index 32f702c..82c0489 100644 --- gcc/omp-low.c +++ gcc/omp-low.c @@ -1979,16 +1979,12 @@ create_omp_child_function (omp_context *ctx, bool task_copy) { omp_context *octx; for (octx = ctx; octx; octx = octx->outer) - if (gimple_code (octx->stmt) == GIMPLE_OMP_TARGET - && gimple_omp_target_kind (octx->stmt) - == GF_OMP_TARGET_KIND_REGION) + if (is_gimple_omp_offloaded (octx->stmt)) { target_p = true; break; } } - gcc_assert (!is_gimple_omp_oacc_specifically (ctx->stmt) - || !target_p); if (target_p) DECL_ATTRIBUTES (decl) = tree_cons (get_identifier ("omp declare target"),