From patchwork Sun Jul 26 17:09:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 500083 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 AB00A140326 for ; Mon, 27 Jul 2015 03:09:32 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=EtVfKqr4; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=LGsYQJwPrTPTNn5LOtgEYVigm8e45CunRab3qejnS/94mDHeBm 2GZe1mRZwSk/tf0TnOu2eNVcuhBzbdulsDYat6JPbuFTdeEjiMOqc8vjOMH0b77M 1fRof2TT8SGLLx3MsgSJmNuZLSnL1uw9EE3rHhtdDZlrUkM7wHoOV9Cew= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=HgqFztScqYaW/7VRuX433RKz6rI=; b=EtVfKqr4AcssL6oJEXY5 9tFdkfv8PMzJy173hMYOj+ntFpChFZ1Yp66cCUrXQmnZXbz6gbrVaeR6+E2xpxO0 x+DKVTOHs8Y+E2usZbNjHOwnZSvObqWCSCoMfgXMStEFnZryym7OWmnRRTEyzyjr /EcnCNJ1gNeBhWjDClnEJE0= Received: (qmail 12528 invoked by alias); 26 Jul 2015 17:09:25 -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 12519 invoked by uid 89); 26 Jul 2015 17:09:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qg0-f48.google.com Received: from mail-qg0-f48.google.com (HELO mail-qg0-f48.google.com) (209.85.192.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sun, 26 Jul 2015 17:09:24 +0000 Received: by qgii95 with SMTP id i95so38162331qgi.2 for ; Sun, 26 Jul 2015 10:09:21 -0700 (PDT) X-Received: by 10.140.31.74 with SMTP id e68mr34285510qge.95.1437930561824; Sun, 26 Jul 2015 10:09:21 -0700 (PDT) Received: from ?IPv6:2601:181:c000:c497:a2a8:cdff:fe3e:b48? ([2601:181:c000:c497:a2a8:cdff:fe3e:b48]) by smtp.googlemail.com with ESMTPSA id g81sm7603822qhc.8.2015.07.26.10.09.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Jul 2015 10:09:20 -0700 (PDT) To: GCC Patches From: Nathan Sidwell Subject: [gomp4] fiuxup openacc default handling Message-ID: <55B5143E.4080303@acm.org> Date: Sun, 26 Jul 2015 13:09:18 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 I've committed this update to my earlier breakout of default handling. After complaining about something because of 'none', we should fall through to the default handling, to prevent ICEing later (on patch seriesI'm working on). This matches the OMP default handling. Also tweaked the setting of GOVD_ flags slightly, to make the firstprivate handling I'm working on less invasive. nathan 2015-07-26 Nathan Sidwell * gimplify.c (oacc_default_clause): Fallthrough to unspecified handling. Propagate mapping from outer scope. Index: gcc/gimplify.c =================================================================== --- gcc/gimplify.c (revision 226226) +++ gcc/gimplify.c (working copy) @@ -5930,7 +5930,7 @@ oacc_default_clause (struct gimplify_omp DECL_NAME (lang_hooks.decls.omp_report_decl (decl)), rkind); error_at (ctx->location, "enclosing OpenACC %s construct", rkind); } - break; + /* FALLTHRU. */ case OMP_CLAUSE_DEFAULT_UNSPECIFIED: { @@ -5944,33 +5944,39 @@ oacc_default_clause (struct gimplify_omp continue; if (!(octx->region_type & (ORT_TARGET_DATA | ORT_TARGET))) break; - if (splay_tree_lookup (octx->variables, (splay_tree_key) decl)) + splay_tree_node n2 + = splay_tree_lookup (octx->variables, (splay_tree_key) decl); + if (n2) + { + flags |= n2->value & GOVD_MAP; goto found_outer; + } } } - { - tree type = TREE_TYPE (decl); - /* Should this be REFERENCE_TYPE_P? */ - if (POINTER_TYPE_P (type)) - type = TREE_TYPE (type); + if (is_global_var (decl) && device_resident_p (decl)) + flags |= GOVD_MAP_TO_ONLY | GOVD_MAP; + /* Scalars under kernels are default 'copy'. */ + else if (ctx->acc_region_kind == ARK_KERNELS) + flags |= GOVD_FORCE_MAP | GOVD_MAP; + else if (ctx->acc_region_kind == ARK_PARALLEL) + { + tree type = TREE_TYPE (decl); + + /* Should this be REFERENCE_TYPE_P? */ + if (POINTER_TYPE_P (type)) + type = TREE_TYPE (type); - /* For OpenACC regions, array and aggregate variables - default to present_or_copy, while scalar variables - by default are firstprivate (gang-local) in parallel. */ - if (!AGGREGATE_TYPE_P (type)) - { - if (is_global_var (decl) && device_resident_p (decl)) - flags |= GOVD_MAP_TO_ONLY; - else if (ctx->acc_region_kind == ARK_PARALLEL) - flags |= (GOVD_GANGLOCAL | GOVD_MAP_TO_ONLY); - /* Scalars under kernels are default 'copy'. */ - else if (ctx->acc_region_kind == ARK_KERNELS) - flags |= GOVD_FORCE_MAP; - else - gcc_unreachable (); - } + if (AGGREGATE_TYPE_P (type)) + /* Aggregates default to 'copy'. This should really + include GOVD_FORCE_MAP. */ + flags |= GOVD_MAP; + else + /* Scalars default tp 'firstprivate'. */ + flags |= GOVD_GANGLOCAL | GOVD_MAP_TO_ONLY | GOVD_MAP; } + else + gcc_unreachable (); found_outer:; } break; @@ -6020,7 +6026,8 @@ omp_notice_variable (struct gimplify_omp if (is_oacc) flags = oacc_default_clause (ctx, decl, in_code, flags); - flags |= GOVD_MAP; + else + flags |= GOVD_MAP; if (!lang_hooks.types.omp_mappable_type (TREE_TYPE (decl), is_oacc)) {