From patchwork Thu Nov 5 10:40:12 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: 540344 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 E8A061413DC for ; Thu, 5 Nov 2015 21:40:48 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=KRBIY4nP; 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=UrGTnBVfikWbiiiJ2 sCtwAhlwxg/bdhwEEkkt8dSd8EiIvaVt5tx+d1CFAaytIlfW/mttx5XcQH9pt5lM FJtptf3p6mxKwNekyzNH1lwkXmsKYBzFzLqBD20H65f83wSeHNKpoBOAMYG0UFTb d/YfrC6DzUN04MJe4rTCP0o4tY= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=YKHOJ/55lcGv08BTkJeJmMa 2bGc=; b=KRBIY4nP01qiOkw6MEfHJ6OUy2DZS9NbXYcDUXGlAIul15q5ARORDzV hNfsHuCjNg5uZbwXLGhyI66tIoot720XMOkBh0mhmkF0Q1G6Ru6hWClJ/URCQBdT N/Fg71NBUZhgHiWJDIcHrQr9I3vCIdfgq7Fs+atD/YtGZz++sJnQ= Received: (qmail 90009 invoked by alias); 5 Nov 2015 10:40:41 -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 89997 invoked by uid 89); 5 Nov 2015 10:40:40 -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; Thu, 05 Nov 2015 10:40:38 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39930) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ZuHy8-0007vL-Gh for gcc-patches@gnu.org; Thu, 05 Nov 2015 05:40:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZuHy2-0004Gn-Vb for gcc-patches@gnu.org; Thu, 05 Nov 2015 05:40:35 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:38336) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuHy2-0004Gg-MN for gcc-patches@gnu.org; Thu, 05 Nov 2015 05:40:30 -0500 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZuHy1-0002ss-MH from Tom_deVries@mentor.com ; Thu, 05 Nov 2015 02:40:30 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.224.2; Thu, 5 Nov 2015 10:40:28 +0000 Subject: [gomp4, committed, 2/9] Update gate_oacc_kernels to handle oacc function To: "gcc-patches@gnu.org" References: <563B2C99.90308@mentor.com> CC: Jakub Jelinek From: Tom de Vries Message-ID: <563B320C.20808@mentor.com> Date: Thu, 5 Nov 2015 11:40:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <563B2C99.90308@mentor.com> X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 On 05/11/15 11:16, Tom de Vries wrote: > Hi, > > now that we have committed -foffload-alias in gomp-4_0-branch ( > https://gcc.gnu.org/ml/gcc-patches/2015-11/msg00214.html ), we no longer > need the kernels region to be a part of the original function when doing > alias analysis. > > So, we no longer have the need to postpone splitting off the kernels > region into a seperate function until after alias analysis, but we can > do this at the same time as when we expand the parallel region. > > The following patch series implements that: > > 1 Move expansion of kernels region back to first omp-expand > 2 Update gate_oacc_kernels to handle oacc function > 3 Revert "Add skip_stmt parm to pass_dominator::get_sese ()" > 4 Revert "Add pass_dominator::sese_mode_p ()" > 5 Handle oacc function in parloops > 6 Update goacc kernels C testcases > 7 Update goacc kernels Fortran testcases > 8 Release_defs in expand_omp_atomic_fetch_op > 9 Remove BUILT_IN_GOACC_KERNELS_INTERNAL > > [ The patch series is broken up into logical bits, but intended as > single commit. Various things in kernels support will be broken in > intermediate stages. ] > > Committed to gomp-4_0-branch. > > I'll post the patches in reply to this message. This patch updates the kernels pass group gate function. Before, it needed to trigger on functions containing kernel regions. Now, it needs to trigger on oacc functions that used to be kernels regions before they were split off. Furthermore, I've duplicated the parloops gate here (flag_tree_parallelize_loops > 1). There's not much sense in running the pass group unless we're trying to parallelize. Consequently, I needed to add a "-ftree-parallelize-loops=32" settting to a testcase which missed that setting. Thanks, - Tom Update gate_oacc_kernels to handle oacc function 2015-11-04 Tom de Vries * tree-ssa-loop.c: Include omp-low.h. (gate_oacc_kernels): Test for flag_tree_parallelize_loops. Test for oacc function attribute. Test for loop with in_oacc_kernels_region. * c-c++-common/goacc/kernels-counter-var-redundant-load.c: Run with -ftree-parallelize-loops=32. --- .../goacc/kernels-counter-var-redundant-load.c | 1 + gcc/tree-ssa-loop.c | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-counter-var-redundant-load.c b/gcc/testsuite/c-c++-common/goacc/kernels-counter-var-redundant-load.c index c4ffc1d..bf59838 100644 --- a/gcc/testsuite/c-c++-common/goacc/kernels-counter-var-redundant-load.c +++ b/gcc/testsuite/c-c++-common/goacc/kernels-counter-var-redundant-load.c @@ -1,4 +1,5 @@ /* { dg-additional-options "-O2" } */ +/* { dg-additional-options "-ftree-parallelize-loops=32" } */ /* { dg-additional-options "-fdump-tree-dom_oacc_kernels3" } */ #include diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c index 5e0b5a5..344c6c7 100644 --- a/gcc/tree-ssa-loop.c +++ b/gcc/tree-ssa-loop.c @@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-inline.h" #include "tree-scalar-evolution.h" #include "tree-vectorizer.h" +#include "omp-low.h" /* A pass making sure loops are fixed up. */ @@ -151,7 +152,26 @@ make_pass_tree_loop (gcc::context *ctxt) static bool gate_oacc_kernels (function *fn) { - return (fn->curr_properties & PROP_gimple_eomp) == 0; + if (flag_tree_parallelize_loops <= 1) + return false; + + tree oacc_function_attr = get_oacc_fn_attrib (fn->decl); + if (oacc_function_attr == NULL_TREE) + return false; + + tree val = TREE_VALUE (oacc_function_attr); + while (val != NULL_TREE && TREE_VALUE (val) == NULL_TREE) + val = TREE_CHAIN (val); + + if (val != NULL_TREE) + return false; + + struct loop *loop; + FOR_EACH_LOOP (loop, 0) + if (loop->in_oacc_kernels_region) + return true; + + return false; } /* The oacc kernels superpass. */ -- 1.9.1