[PATCH, 2/8] Add pass_oacc_kernels
Thomas Schwinge
thomas@codesourcery.com
Tue Apr 21 19:46:00 GMT 2015
Hi!
On Tue, 25 Nov 2014 12:25:35 +0100, Tom de Vries <Tom_deVries@mentor.com> wrote:
> On 15-11-14 18:20, Tom de Vries wrote:
> > On 15-11-14 13:14, Tom de Vries wrote:
> >> 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.
> >
>
> Updated for moving pass_oacc_kernels down past pass_fre in the pass list.
>
> Bootstrapped and reg-tested as before.
>
> OK for trunk?
Committed to gomp-4_0-branch in r222280:
commit 0ac5f6ae679a0cd70b197f0962d7d365e7dfbd21
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue Apr 21 19:45:23 2015 +0000
Add pass_oacc_kernels
gcc/
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@222280 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/ChangeLog.gomp | 7 +++++++
gcc/passes.def | 7 ++++++-
gcc/tree-pass.h | 1 +
gcc/tree-ssa-loop.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 59 insertions(+), 1 deletion(-)
diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp
index 1f86160..8a53ad8 100644
--- gcc/ChangeLog.gomp
+++ gcc/ChangeLog.gomp
@@ -1,5 +1,12 @@
2015-04-21 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.
+
* omp-low.c: Include gimple-pretty-print.h.
(release_first_vuse_in_edge_dest): New function.
(expand_omp_target): When not in ssa, don't split off oacc kernels
diff --git gcc/passes.def gcc/passes.def
index db0dd18..854c5b8 100644
--- gcc/passes.def
+++ gcc/passes.def
@@ -86,7 +86,12 @@ along with GCC; see the file COPYING3. If not see
execute TODO_rebuild_alias at this point. */
NEXT_PASS (pass_build_ealias);
NEXT_PASS (pass_fre);
- NEXT_PASS (pass_expand_omp_ssa);
+ /* Pass group that runs when there are oacc kernels in the
+ function. */
+ NEXT_PASS (pass_oacc_kernels);
+ PUSH_INSERT_PASSES_WITHIN (pass_oacc_kernels)
+ NEXT_PASS (pass_expand_omp_ssa);
+ POP_INSERT_PASSES ()
NEXT_PASS (pass_merge_phi);
NEXT_PASS (pass_cd_dce);
NEXT_PASS (pass_early_ipa_sra);
diff --git gcc/tree-pass.h gcc/tree-pass.h
index b59ae7a..35778f2 100644
--- gcc/tree-pass.h
+++ gcc/tree-pass.h
@@ -450,6 +450,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 gcc/tree-ssa-loop.c gcc/tree-ssa-loop.c
index ccb8f97..a041858 100644
--- gcc/tree-ssa-loop.c
+++ gcc/tree-ssa-loop.c
@@ -163,6 +163,51 @@ 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)
+{
+ return (fn->curr_properties & PROP_gimple_eomp) == 0;
+}
+
+/* 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 {
Grüße,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150421/19ec9185/attachment.sig>
More information about the Gcc-patches
mailing list