From patchwork Sun Nov 8 15:41:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 541460 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 C1ED11402D9 for ; Mon, 9 Nov 2015 02:42:32 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=tik6c391; 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:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=K4O/FtZNNmDG8hHhSwJMCbwurfNG6Ww80je+sIPKBALriTwz8N l2l3/SMDui9aeQR87GvA4NGGoa3E9z/lWuuiI2ZKFRKz3tIItoGU7rhxVAizrDWV CHLTpY5FZ44Od+SrJBmesHgHJw3AbCSSFjlMM62n60h8XJA+Rf+a9gRuA= 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:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=OpNEunLQvBsjlgmjlGkiMa7O8V8=; b=tik6c391jT+rTU4Odpq6 VHf2n43OQFLLHB+2Q2XsMcdbLCLrBOctkNF4oB9BIYlwszTHjEwBWeOpb4JgNo5a kIEBnXRvhiG9WZUJKtj8LyH/8cBCbxcMk0lBcHgcLDVAc5lhylunw3CCdGH+Grqh ehdUeLyNATnwKhS0KmrGRxQ= Received: (qmail 669 invoked by alias); 8 Nov 2015 15:42:26 -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 655 invoked by uid 89); 8 Nov 2015 15:42:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 08 Nov 2015 15:42:24 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36168) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ZvS6n-0005ID-TR for gcc-patches@gnu.org; Sun, 08 Nov 2015 10:42:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZvS6k-0005Id-7S for gcc-patches@gnu.org; Sun, 08 Nov 2015 10:42:21 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:62189) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvS6k-0005IZ-1N for gcc-patches@gnu.org; Sun, 08 Nov 2015 10:42:18 -0500 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZvS6j-0002li-7z from Tom_deVries@mentor.com ; Sun, 08 Nov 2015 07:42:17 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Sun, 8 Nov 2015 15:42:15 +0000 To: "gcc-patches@gnu.org" CC: Jakub Jelinek From: Tom de Vries Subject: [gomp4, committed] Insert IFN_GOACC_DIM_POS for oacc kernels call in parloops Message-ID: <563F6D42.7070901@mentor.com> Date: Sun, 8 Nov 2015 16:41:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 Hi, this patch postpones insertion of the IFN_GOACC_DIM_POS call until we actually need it, in parloops. Committed to gomp-4_0-branch. Thanks, - Tom Insert IFN_GOACC_DIM_POS for oacc kernels call in parloops 2015-11-08 Tom de Vries * omp-low.c (lower_omp_target): Remove insertion of IFN_GOACC_DIM_POS call in kernels region. * tree-parloops.c: Include gomp-constants.h. (oacc_entry_exit_single_gang): Remove gang_pos parameter. Insert IFN_GOACC_DIM_POS call, if required. (oacc_entry_exit_ok): Remove gang_pos variable. --- gcc/omp-low.c | 8 -------- gcc/tree-parloops.c | 33 ++++++++++++++++++++------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/gcc/omp-low.c b/gcc/omp-low.c index d263609..57ac2aa 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -16321,14 +16321,6 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) false, NULL, NULL, &fork_seq, &join_seq, ctx); } - if (is_oacc_kernels (ctx)) - { - tree arg = build_int_cst (integer_type_node, GOMP_DIM_GANG); - gcall *gang_single - = gimple_build_call_internal (IFN_GOACC_DIM_POS, 1, arg); - gimple_seq_add_stmt (&new_body, gang_single); - } - if (offloaded) gimple_seq_add_stmt (&new_body, gimple_build_omp_entry_end ()); diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 1551eec..313637b 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see #include "params-enum.h" #include "tree-ssa-alias.h" #include "tree-eh.h" +#include "gomp-constants.h" #include "tree-dfa.h" /* This pass tries to distribute iterations of loops into several threads. @@ -2984,13 +2985,14 @@ oacc_entry_exit_ok_1 (bitmap in_loop_bbs, vec region_bbs, } /* Find stores inside REGION_BBS and outside IN_LOOP_BBS, and guard them with - GANG_POS == 0, except when the stores are REDUCTION_STORES. Return true + gang_pos == 0, except when the stores are REDUCTION_STORES. Return true if any changes were made. */ static bool oacc_entry_exit_single_gang (bitmap in_loop_bbs, vec region_bbs, - bitmap reduction_stores, tree gang_pos) + bitmap reduction_stores) { + tree gang_pos = NULL_TREE; bool changed = false; unsigned i; @@ -3030,6 +3032,20 @@ oacc_entry_exit_single_gang (bitmap in_loop_bbs, vec region_bbs, changed = true; + if (gang_pos == NULL_TREE) + { + tree arg = build_int_cst (integer_type_node, GOMP_DIM_GANG); + gcall *gang_single + = gimple_build_call_internal (IFN_GOACC_DIM_POS, 1, arg); + gang_pos = make_ssa_name (integer_type_node); + gimple_call_set_lhs (gang_single, gang_pos); + gimple_stmt_iterator start + = gsi_start_bb (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun))); + tree vuse = ssa_default_def (cfun, gimple_vop (cfun)); + gimple_set_vuse (gang_single, vuse); + gsi_insert_before (&start, gang_single, GSI_SAME_STMT); + } + if (dump_file) { fprintf (dump_file, @@ -3093,14 +3109,6 @@ oacc_entry_exit_ok (struct loop *loop, vec region_bbs = get_all_dominated_blocks (CDI_DOMINATORS, ENTRY_BLOCK_PTR_FOR_FN (cfun)); - gimple_stmt_iterator gsi - = gsi_start_bb (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun))); - gimple *stmt = gsi_stmt (gsi); - gcc_assert (gimple_call_internal_p (stmt) - && gimple_call_internal_fn (stmt) == IFN_GOACC_DIM_POS); - tree gang_pos = make_ssa_name (integer_type_node); - gimple_call_set_lhs (stmt, gang_pos); - bitmap in_loop_bbs = BITMAP_ALLOC (NULL); bitmap_clear (in_loop_bbs); for (unsigned int i = 0; i < loop->num_nodes; i++) @@ -3112,9 +3120,8 @@ oacc_entry_exit_ok (struct loop *loop, if (res) { - bool changed - = oacc_entry_exit_single_gang (in_loop_bbs, region_bbs, - reduction_stores, gang_pos); + bool changed = oacc_entry_exit_single_gang (in_loop_bbs, region_bbs, + reduction_stores); if (changed) { free_dominance_info (CDI_DOMINATORS); -- 1.9.1