public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: Richard Biener <rguenther@suse.de>
Cc: "gcc-patches@gnu.org" <gcc-patches@gnu.org>,
	Jakub Jelinek	<jakub@redhat.com>
Subject: Re: [PATCH, 6/16] Add pass_oacc_kernels
Date: Tue, 24 Nov 2015 12:17:00 -0000	[thread overview]
Message-ID: <565454BD.1030700@mentor.com> (raw)
In-Reply-To: <564DD3C1.8040005@mentor.com>

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

On 19/11/15 14:50, Tom de Vries wrote:
> On 11/11/15 11:58, Richard Biener wrote:
>> On Mon, 9 Nov 2015, Tom de Vries wrote:
>>
>>> On 09/11/15 16:35, Tom de Vries wrote:
>>>> Hi,
>>>>
>>>> this patch series for stage1 trunk adds support to:
>>>> - parallelize oacc kernels regions using parloops, and
>>>> - map the loops onto the oacc gang dimension.
>>>>
>>>> The patch series contains these patches:
>>>>
>>>>        1    Insert new exit block only when needed in
>>>>           transform_to_exit_first_loop_alt
>>>>        2    Make create_parallel_loop return void
>>>>        3    Ignore reduction clause on kernels directive
>>>>        4    Implement -foffload-alias
>>>>        5    Add in_oacc_kernels_region in struct loop
>>>>        6    Add pass_oacc_kernels
>>>>        7    Add pass_dominator_oacc_kernels
>>>>        8    Add pass_ch_oacc_kernels
>>>>        9    Add pass_parallelize_loops_oacc_kernels
>>>>       10    Add pass_oacc_kernels pass group in passes.def
>>>>       11    Update testcases after adding kernels pass group
>>>>       12    Handle acc loop directive
>>>>       13    Add c-c++-common/goacc/kernels-*.c
>>>>       14    Add gfortran.dg/goacc/kernels-*.f95
>>>>       15    Add libgomp.oacc-c-c++-common/kernels-*.c
>>>>       16    Add libgomp.oacc-fortran/kernels-*.f95
>>>>
>>>> The first 9 patches are more or less independent, but patches 10-16 are
>>>> intended to be committed at the same time.
>>>>
>>>> Bootstrapped and reg-tested on x86_64.
>>>>
>>>> Build and reg-tested with nvidia accelerator, in combination with a
>>>> patch that enables accelerator testing (which is submitted at
>>>> https://gcc.gnu.org/ml/gcc-patches/2015-10/msg01771.html ).
>>>>
>>>> I'll post the individual patches in reply to this message.
>>>
>>> this patchs add a pass group pass_oacc_kernels (which will be added
>>> to the
>>> pass list as a whole in patch 10).
>>
>> Just to understand (while also skimming the HSA patches).
>>
>> You are basically relying on autopar for what the HSA patches call
>> "gridification"?  That is, OMP lowering produces loopy kernels
>> and autopar then will basically strip the outermost loop?
>
> Short answer: no. In more detail...
<SNIP>

Reposting patch, after splitting the pass group into two.

Thanks,
- TOm


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

Add pass_oacc_kernels

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

	* tree-pass.h (make_pass_oacc_kernels, make_pass_oacc_kernels2):
	Declare.
	* tree-ssa-loop.c (gate_oacc_kernels): New static function.
	(pass_data_oacc_kernels, pass_data_oacc_kernels2): New pass_data.
	(class pass_oacc_kernels, class pass_oacc_kernels2): New pass.
	(make_pass_oacc_kernels, make_pass_oacc_kernels2): New function.

---
 gcc/tree-pass.h     |   2 +
 gcc/tree-ssa-loop.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 112 insertions(+)

diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index dcd2d5e..9704918 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -465,6 +465,8 @@ 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);
+extern gimple_opt_pass *make_pass_oacc_kernels2 (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 afdef12..cf7d94e 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -35,6 +35,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.  */
@@ -141,6 +142,115 @@ 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_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.  */
+
+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);
+}
+
+namespace {
+
+const pass_data pass_data_oacc_kernels2 =
+{
+  GIMPLE_PASS, /* type */
+  "oacc_kernels2", /* 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_kernels2 : public gimple_opt_pass
+{
+public:
+  pass_oacc_kernels2 (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_oacc_kernels2, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual bool gate (function *fn) { return gate_oacc_kernels (fn); }
+  virtual unsigned int execute (function *fn)
+    {
+      /* Rather than having a copy of the previous dump, get some use out of
+	 this dump, and try to minimize differences with the following pass
+	 (pass_lim), which will initizalize the loop optimizer with
+	 LOOPS_NORMAL.  */
+      loop_optimizer_init (LOOPS_NORMAL);
+      loop_optimizer_finalize (fn);
+      return 0;
+    }
+
+}; // class pass_oacc_kernels2
+
+} // anon namespace
+
+gimple_opt_pass *
+make_pass_oacc_kernels2 (gcc::context *ctxt)
+{
+  return new pass_oacc_kernels2 (ctxt);
+}
+
 /* The no-loop superpass.  */
 
 namespace {

  reply	other threads:[~2015-11-24 12:15 UTC|newest]

Thread overview: 133+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09 15:35 [PATCH series, 16] Use parloops to parallelize oacc kernels regions Tom de Vries
2015-11-09 15:44 ` [PATCH, 1/16] Insert new exit block only when needed in transform_to_exit_first_loop_alt Tom de Vries
2015-11-11 10:50   ` Richard Biener
2015-11-09 15:45 ` [PATCH, 2/16] Make create_parallel_loop return void Tom de Vries
2015-11-11 10:50   ` Richard Biener
2015-11-09 15:51 ` [PATCH, 3/16] Ignore reduction clause on kernels directive Tom de Vries
2015-11-24 12:25   ` [PING][PATCH, " Tom de Vries
2016-01-18 14:24     ` [PING^2][PATCH, " Tom de Vries
2016-01-18 14:26       ` Jakub Jelinek
2015-11-09 16:10 ` [PATCH, 4/16] Implement -foffload-alias Tom de Vries
2015-11-11 10:53   ` Richard Biener
2015-11-11 11:01     ` Jakub Jelinek
2015-11-12 16:04       ` Tom de Vries
2015-11-13  8:46         ` Richard Biener
2015-11-13 11:03           ` Tom de Vries
2015-11-13 11:30             ` Richard Biener
2015-11-13 11:39               ` Jakub Jelinek
2015-11-21 12:24                 ` Tom de Vries
2015-11-23 11:46                   ` Richard Biener
2015-11-27 11:44                     ` Tom de Vries
2015-11-27 12:14                       ` Tom de Vries
2015-12-02  9:59                         ` Jakub Jelinek
2016-03-14 13:16                           ` Tom de Vries
2016-03-14 23:18                             ` Tom de Vries
2015-12-02  9:46                       ` Jakub Jelinek
2015-12-02 13:11                         ` Tom de Vries
2015-12-11 12:45                 ` Tom de Vries
2015-12-11 13:00                   ` Richard Biener
2015-12-13 16:38                     ` Tom de Vries
2015-12-14 13:26                       ` Richard Biener
2015-12-14 15:44                         ` Tom de Vries
2015-12-16 13:16                           ` Richard Biener
2015-12-16 14:43                             ` Tom de Vries
2015-12-17 12:03                               ` [gomp4] " Thomas Schwinge
2015-12-03 11:53       ` Tom de Vries
2015-11-09 16:31 ` [PATCH, 5/16] Add in_oacc_kernels_region in struct loop Tom de Vries
2015-11-11 10:57   ` Richard Biener
2015-11-16 11:39     ` Tom de Vries
2015-11-16 12:41       ` Richard Biener
2015-11-16 11:39     ` Tom de Vries
2015-11-09 17:39 ` [PATCH, 6/16] Add pass_oacc_kernels Tom de Vries
2015-11-11 10:59   ` Richard Biener
2015-11-19 13:51     ` Tom de Vries
2015-11-24 12:17       ` Tom de Vries [this message]
2015-11-25 10:42         ` Richard Biener
2016-02-05 12:06   ` Use plain -fopenacc to enable OpenACC kernels processing (was: [PATCH, 6/16] Add pass_oacc_kernels) Thomas Schwinge
2016-02-10 14:40     ` Use plain -fopenacc to enable OpenACC kernels processing Thomas Schwinge
2016-02-15 16:54       ` Tom de Vries
2016-02-23 15:19         ` Thomas Schwinge
2015-11-09 18:14 ` [PATCH, 7/16] Add pass_dominator_oacc_kernels Tom de Vries
2015-11-11 11:05   ` Richard Biener
2015-11-16 12:04     ` Tom de Vries
2015-11-09 18:34 ` [PATCH, 8/16] Add pass_ch_oacc_kernels Tom de Vries
2015-11-11 20:29   ` Tom de Vries
2015-11-30 12:12     ` [gomp4] Use pass_ch instead of pass_ch_oacc_kernels (was: [PATCH, 8/16] Add pass_ch_oacc_kernels) Thomas Schwinge
2015-11-09 19:53 ` [PATCH, 9/16] Add pass_parallelize_loops_oacc_kernels Tom de Vries
2015-11-16 11:59   ` Tom de Vries
2015-11-24 12:27     ` Tom de Vries
2015-12-13 16:58       ` [PIING][PATCH, " Tom de Vries
2015-12-14 15:23         ` Richard Biener
2016-01-16 22:41           ` [Committed] Move pass_expand_omp_ssa out of pass_parallelize_loops Tom de Vries
2016-01-18 12:59           ` [Committed] Allow pass_parallelize_loops to be run outside the loop pipeline Tom de Vries
2016-01-18 13:07           ` [committed] Add oacc_kernels_p argument to pass_parallelize_loops Tom de Vries
2016-01-18 13:30             ` [committed] Add pass_parallelize_loops to pass_oacc_kernels Tom de Vries
2016-01-20  8:54             ` [committed] Add oacc_kernels_p argument to pass_parallelize_loops Thomas Schwinge
2016-01-20 10:31               ` Tom de Vries
2015-11-09 19:59 ` [PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def Tom de Vries
2015-11-11 11:03   ` Richard Biener
2015-11-16 11:55     ` Tom de Vries
2015-11-16 12:45       ` Richard Biener
2015-11-16 23:21         ` Tom de Vries
2015-11-17 10:05           ` Richard Biener
2015-11-17 14:54             ` Tom de Vries
2015-11-17 15:18               ` Richard Biener
2015-11-17 15:39                 ` Tom de Vries
2015-11-17 22:21                   ` [PATCH, PR68373 ] Call scev_const_prop in pass_parallelize_loops::execute Tom de Vries
2015-11-19  9:36                     ` Tom de Vries
2015-11-20 10:15                       ` Richard Biener
2015-11-18  8:30                   ` [PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def Richard Biener
2015-11-18 16:22                     ` Bernhard Reutner-Fischer
2015-11-20 12:53                       ` [committed, trivial] Fix typo and trailing whitespace in dump-file strings in parloops Tom de Vries
2015-11-19  0:35               ` [PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def Tom de Vries
2015-11-20 10:28                 ` Richard Biener
2015-11-21  8:42                   ` Tom de Vries
2015-11-23 11:31                     ` Richard Biener
2015-11-23 15:53                       ` Tom de Vries
2015-11-23 16:38                         ` Richard Biener
2015-11-19 10:31         ` Tom de Vries
2015-11-20 10:37           ` Richard Biener
2015-11-20 13:27             ` Tom de Vries
2015-11-20 13:29               ` Richard Biener
2015-11-20 16:34                 ` Tom de Vries
2015-11-23 10:11                   ` Richard Biener
2015-11-24 12:22                     ` Tom de Vries
2015-11-24 13:19                       ` Richard Biener
2015-11-24 14:33                         ` Tom de Vries
2015-11-24 14:36                           ` Richard Biener
2015-11-24 15:05                             ` Tom de Vries
2015-11-25 10:43                               ` Richard Biener
2015-11-25 10:44                       ` Richard Biener
2015-11-30 17:48                         ` [gomp4] " Thomas Schwinge
2015-11-22 23:37             ` [PATCH] Don't reapply loops flags if unnecessary in loop_optimizer_init Tom de Vries
2015-11-23 10:33               ` Richard Biener
2015-11-23 11:27                 ` Tom de Vries
2015-11-09 20:02 ` [PATCH, 11/16] Update testcases after adding kernels pass group Tom de Vries
2015-11-11 11:03   ` Richard Biener
2015-11-12 14:32     ` Tom de Vries
2015-11-12 14:43       ` Richard Biener
2015-11-12 15:42         ` David Malcolm
2015-11-13  9:44           ` Richard Biener
2015-11-09 20:06 ` [PATCH, 12/16] Handle acc loop directive Tom de Vries
2015-11-24 12:30   ` [PING][PATCH, " Tom de Vries
2016-01-18 14:27     ` [PING^2][PATCH, " Tom de Vries
2016-01-26 12:38       ` [PING^3][PATCH, " Tom de Vries
2016-01-26 12:50         ` Jakub Jelinek
2016-02-12 11:11           ` Tom de Vries
2016-02-22 10:55             ` Tom de Vries
2016-02-22 10:58               ` Jakub Jelinek
2016-02-29  3:27                 ` Tom de Vries
2016-03-07  8:22                   ` [PING][PATCH, " Tom de Vries
2016-03-14  6:21                     ` [PING^2][PATCH, " Tom de Vries
2015-11-09 20:08 ` [PATCH, 13/16] Add c-c++-common/goacc/kernels-*.c Tom de Vries
2016-01-18 13:33   ` [committed] Add oacc kernels tests in goacc Tom de Vries
2015-11-09 20:09 ` [PATCH, 14/16] Add gfortran.dg/goacc/kernels-*.f95 Tom de Vries
2015-11-09 20:11 ` [PATCH, 15/16] Add libgomp.oacc-c-c++-common/kernels-*.c Tom de Vries
2016-01-18 13:39   ` [comitted] Add oacc kernels test in libgomp Tom de Vries
2016-03-09  9:18   ` [PATCH, 15/16] Add libgomp.oacc-c-c++-common/kernels-*.c Tom de Vries
2016-03-18 12:46     ` Scan for parallelization of the oacc kernels test-cases in gfortran.dg/goacc (was: [PATCH, 15/16] Add libgomp.oacc-c-c++-common/kernels-*.c) Thomas Schwinge
2016-04-05  9:13       ` Scan for parallelization of the oacc kernels test-cases in gfortran.dg/goacc Tom de Vries
2016-04-07 15:26         ` Thomas Schwinge
2015-11-09 20:12 ` [PATCH, 16/16] Add libgomp.oacc-fortran/kernels-*.f95 Tom de Vries
2016-03-09  9:19   ` Tom de Vries
2016-03-16 13:12     ` 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=565454BD.1030700@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=gcc-patches@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).