public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Richard Biener <rguenther@suse.de>,
	Jakub Jelinek <jakub@redhat.com>,
	Thomas Schwinge <Thomas_Schwinge@mentor.com>
Subject: [PATCH, 2/8] Add pass_oacc_kernels
Date: Sat, 15 Nov 2014 17:22:00 -0000	[thread overview]
Message-ID: <54678B66.1000704@mentor.com> (raw)
In-Reply-To: <546743BC.5070804@mentor.com>

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

On 15-11-14 13:14, Tom de Vries wrote:
> Hi,
>
> I'm submitting a patch series with initial support for the oacc kernels directive.
>
> The patch series uses pass_parallelize_loops to implement parallelization of
> loops in the oacc kernels region.
>
> The patch series consists of these 8 patches:
> ...
>      1  Expand oacc kernels after pass_build_ealias
>      2  Add pass_oacc_kernels
>      3  Add pass_ch_oacc_kernels to pass_oacc_kernels
>      4  Add pass_tree_loop_{init,done} to pass_oacc_kernels
>      5  Add pass_loop_im to pass_oacc_kernels
>      6  Add pass_ccp to pass_oacc_kernels
>      7  Add pass_parloops_oacc_kernels to pass_oacc_kernels
>      8  Do simple omp lowering for no address taken var
> ...

This patch adds a pass group pass_oacc_kernels.

The rationale is that we want a pass group to run oacc kernels region related 
(optimization) passes in.

OK for trunk?

Thanks,
- Tom


[-- Attachment #2: 0002-Add-pass_oacc_kernels.patch --]
[-- Type: text/x-patch, Size: 3020 bytes --]

2014-11-14  Tom de Vries  <tom@codesourcery.com>

	* passes.def: Add pass group pass_oacc_kernels.
	* tree-pass.h (make_pass_oacc_kernels): Declare.
	* tree-ssa-loop.c (gate_oacc_kernels): New static function.
	(pass_data_oacc_kernels): New pass_data.
	(class pass_oacc_kernels): New pass.
	(make_pass_oacc_kernels): New function.
---
 gcc/passes.def      |  5 +++++
 gcc/tree-pass.h     |  1 +
 gcc/tree-ssa-loop.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+)

diff --git a/gcc/passes.def b/gcc/passes.def
index bce8591..1fdb70a 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -72,6 +72,11 @@ along with GCC; see the file COPYING3.  If not see
 	  /* pass_build_ealias is a dummy pass that ensures that we
 	     execute TODO_rebuild_alias at this point.  */
 	  NEXT_PASS (pass_build_ealias);
+	  /* Pass group that runs when there are oacc kernels in the
+	     function.  */
+	  NEXT_PASS (pass_oacc_kernels);
+	  PUSH_INSERT_PASSES_WITHIN (pass_oacc_kernels)
+	  POP_INSERT_PASSES ()
 	  NEXT_PASS (pass_expand_omp_ssa);
 	  NEXT_PASS (pass_fre);
 	  NEXT_PASS (pass_merge_phi);
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index eaa69b4..0bae847 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -445,6 +445,7 @@ extern gimple_opt_pass *make_pass_strength_reduction (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_vtable_verify (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_ubsan (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_sanopt (gcc::context *ctxt);
+extern gimple_opt_pass *make_pass_oacc_kernels (gcc::context *ctxt);
 
 /* IPA Passes */
 extern simple_ipa_opt_pass *make_pass_ipa_lower_emutls (gcc::context *ctxt);
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 758b5fc..c29aa22 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -157,6 +157,54 @@ make_pass_tree_loop (gcc::context *ctxt)
   return new pass_tree_loop (ctxt);
 }
 
+/* Gate for oacc kernels pass group.  */
+
+static bool
+gate_oacc_kernels (function *fn)
+{
+  if (!flag_openacc)
+    return false;
+
+  return fn->contains_oacc_kernels;
+}
+
+/* The oacc kernels superpass.  */
+
+namespace {
+
+const pass_data pass_data_oacc_kernels =
+{
+  GIMPLE_PASS, /* type */
+  "oacc_kernels", /* name */
+  OPTGROUP_LOOP, /* optinfo_flags */
+  TV_TREE_LOOP, /* tv_id */
+  PROP_cfg, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  0, /* todo_flags_finish */
+};
+
+class pass_oacc_kernels : public gimple_opt_pass
+{
+public:
+  pass_oacc_kernels (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_oacc_kernels, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *fn) { return gate_oacc_kernels (fn); }
+
+}; // class pass_oacc_kernels
+
+} // anon namespace
+
+gimple_opt_pass *
+make_pass_oacc_kernels (gcc::context *ctxt)
+{
+  return new pass_oacc_kernels (ctxt);
+}
+
 /* The no-loop superpass.  */
 
 namespace {
-- 
1.9.1






  parent reply	other threads:[~2014-11-15 17:20 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-15 14:08 openacc kernels directive -- initial support Tom de Vries
2014-11-15 17:21 ` [PATCH, 1/8] Expand oacc kernels after pass_build_ealias Tom de Vries
2014-11-24 11:29   ` Tom de Vries
2014-11-25 11:30     ` Tom de Vries
2015-04-21 19:40       ` Expand oacc kernels after pass_fre (was: [PATCH, 1/8] Expand oacc kernels after pass_build_ealias) Thomas Schwinge
2015-04-22  7:36         ` Richard Biener
2015-06-04 16:50           ` Expand oacc kernels after pass_fre Tom de Vries
2015-06-08  7:29             ` Richard Biener
2015-06-19  9:04               ` Tom de Vries
2015-08-05  7:24             ` [committed, gomp4] Fix release_dangling_ssa_names Tom de Vries
2015-08-05  7:29               ` Richard Biener
2015-08-05  8:48                 ` Tom de Vries
2015-08-05  9:30                   ` Richard Biener
2015-08-05 10:49                     ` Tom de Vries
2015-08-05 11:13                       ` Richard Biener
2015-08-11  9:25                         ` [committed] Add todo comment for move_sese_region_to_fn Tom de Vries
2015-08-11 18:53                         ` [PATCH] Don't create superfluous parm in expand_omp_taskreg Tom de Vries
2015-08-12 10:51                           ` Richard Biener
2015-09-24  6:36                           ` Thomas Schwinge
2015-09-24  7:21                             ` Tom de Vries
2015-09-24  9:31                               ` Thomas Schwinge
2015-09-30  8:05                                 ` [gomp4,committed] Remove release_dangling_ssa_names Tom de Vries
2015-09-30 10:05                                   ` Thomas Schwinge
2015-09-30 10:25                                     ` Tom de Vries
2015-09-30 10:43                                       ` Thomas Schwinge
2014-11-15 17:22 ` Tom de Vries [this message]
2014-11-25 11:31   ` [PATCH, 2/8] Add pass_oacc_kernels Tom de Vries
2015-04-21 19:46     ` Thomas Schwinge
2014-11-15 17:23 ` [PATCH, 3/8] Add pass_ch_oacc_kernels to pass_oacc_kernels Tom de Vries
2014-11-25 11:39   ` Tom de Vries
2015-04-21 19:49     ` Thomas Schwinge
2015-04-22  7:39       ` Richard Biener
2015-06-03  9:22         ` Tom de Vries
2015-06-03 11:21           ` Richard Biener
2015-06-04 15:59             ` Tom de Vries
2015-06-03 10:05         ` Tom de Vries
2015-06-03 11:22           ` Richard Biener
2014-11-15 17:23 ` [PATCH, 4/8] Add pass_tree_loop_{init,done} " Tom de Vries
2014-11-25 11:42   ` Tom de Vries
2015-04-21 19:52     ` Thomas Schwinge
2015-04-22  7:40       ` Richard Biener
2015-06-02 13:52         ` Tom de Vries
2015-06-02 13:58           ` Richard Biener
2015-06-02 15:40             ` Tom de Vries
2015-06-03 11:26               ` Richard Biener
2014-11-15 17:24 ` [PATCH, 5/8] Add pass_loop_im " Tom de Vries
2014-11-25 12:00   ` Tom de Vries
2015-04-21 19:57     ` [PATCH, 5/8] Add pass_lim " Thomas Schwinge
2014-11-15 18:32 ` [PATCH, 6/8] Add pass_ccp " Tom de Vries
2014-11-25 12:03   ` Tom de Vries
2015-04-21 20:01     ` [PATCH, 6/8] Add pass_copy_prop in pass_oacc_kernels Thomas Schwinge
2015-04-22  7:42       ` Richard Biener
2015-06-02 13:04         ` Tom de Vries
2014-11-15 18:52 ` [PATCH, 7/8] Add pass_parloops_oacc_kernels to pass_oacc_kernels Tom de Vries
2014-11-25 12:15   ` Tom de Vries
2015-04-21 20:09     ` [PATCH, 7/8] Add pass_parallelize_loops_oacc_kernels " Thomas Schwinge
2014-11-15 19:04 ` [PATCH, 8/8] Do simple omp lowering for no address taken var Tom de Vries
2014-11-17 10:29   ` Richard Biener
2014-11-18  9:13     ` Eric Botcazou
2014-11-18  9:53       ` Richard Biener
2014-11-18 12:20         ` Richard Biener
2014-11-24 11:53     ` Tom de Vries
2014-11-24 11:55       ` Tom de Vries
2014-11-24 12:42         ` Richard Biener
2014-11-24 18:49           ` Tom de Vries
2014-11-24 12:40       ` Richard Biener
2014-11-19 20:34 ` openacc kernels directive -- initial support Tom de Vries
2015-04-21 19:27 ` Add BUILT_IN_GOACC_KERNELS_INTERNAL (was: openacc kernels directive -- initial support) Thomas Schwinge
2015-04-21 20:24 ` Handle global loop counters in fortran oacc kernels " Thomas Schwinge
2015-04-21 20:29 ` Handle global loop counters in c/c++ " Thomas Schwinge
2015-04-21 20:33 ` Handle oacc kernels with other directives " Thomas Schwinge

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=54678B66.1000704@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=Thomas_Schwinge@mentor.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.de \
    /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).