public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: "gcc-patches@gnu.org" <gcc-patches@gnu.org>
Cc: Jakub Jelinek <jakub@redhat.com>
Subject: [gomp4, committed, 2/9] Update gate_oacc_kernels to handle oacc function
Date: Thu, 05 Nov 2015 10:40:00 -0000	[thread overview]
Message-ID: <563B320C.20808@mentor.com> (raw)
In-Reply-To: <563B2C99.90308@mentor.com>

[-- Attachment #1: Type: text/plain, Size: 1846 bytes --]

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


[-- Attachment #2: 0002-Update-gate_oacc_kernels-to-handle-oacc-function.patch --]
[-- Type: text/x-patch, Size: 2203 bytes --]

Update gate_oacc_kernels to handle oacc function

2015-11-04  Tom de Vries  <tom@codesourcery.com>

	* 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 <stdlib.h>
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


  parent reply	other threads:[~2015-11-05 10:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-05 10:17 [gomp4, committed] expand oacc kernels region at same time as oacc parallel region Tom de Vries
2015-11-05 10:33 ` [gomp4, committed, 1/9] Move expansion of kernels region back to first omp-expand Tom de Vries
2015-11-05 10:40 ` Tom de Vries [this message]
2015-11-05 10:46 ` [gomp4, committed, 3/9] Revert "Add skip_stmt parm to pass_dominator::get_sese ()" Tom de Vries
2015-11-05 10:50 ` [gomp4, committed, 4/9] Revert "Add pass_dominator::sese_mode_p ()" Tom de Vries
2015-11-05 10:57 ` [gomp4, committed, 5/9] Handle oacc function in parloops Tom de Vries
2015-11-05 10:59 ` [gomp4, committed, 6/9] Update goacc kernels C testcases Tom de Vries
2015-11-05 11:01 ` [gomp4, committed, 7/9] Update goacc kernels Fortran testcases Tom de Vries
2015-11-05 11:26 ` [gomp4, committed, 8/9] Release_defs in expand_omp_atomic_fetch_op Tom de Vries
2015-11-05 11:30 ` [gomp4, committed, 9/9] Remove BUILT_IN_GOACC_KERNELS_INTERNAL Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=563B320C.20808@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=gcc-patches@gnu.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).