public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Cc: "Gergö Barany" <gergo@codesourcery.com>
Subject: Re: [og8] OpenACC 'kernels' construct changes: splitting of the construct into several regions
Date: Fri, 01 Feb 2019 19:48:00 -0000	[thread overview]
Message-ID: <yxfpsgx7cmsx.fsf@hertz.schwinge.homeip.net> (raw)
In-Reply-To: <yxfp7eeke5ul.fsf@hertz.schwinge.homeip.net>

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

Hi!

On Fri, 01 Feb 2019 00:59:30 +0100, I wrote:
> From c7713be32fc5eace2b1e9c20447da849d23f6076 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Gerg=C3=B6=20Barany?= <gergo@codesourcery.com>
> Date: Wed, 23 Jan 2019 22:11:11 -0800
> Subject: [PATCH 6/9] Adjust parallelism of loops in gang-single parts of
>  OpenACC kernels regions

>  transform_kernels_loop_clauses (gimple *omp_for,

> +  struct walk_stmt_info wi;
> +  memset (&wi, 0, sizeof (wi));
> +  tree *num_clauses[GOMP_DIM_MAX]
> +    = { [GOMP_DIM_GANG] = &loop_gang_clause,
> +        [GOMP_DIM_WORKER] = &loop_worker_clause,
> +        [GOMP_DIM_VECTOR] = &loop_vector_clause };
> +  wi.info = num_clauses;
> +  gimple *body = gimple_omp_body (omp_for);
> +  walk_gimple_seq (body, adjust_nested_loop_clauses, NULL, &wi);

It makes sense to me, but not to GCC 4.6 ;-) -- pushed to
openacc-gcc-8-branch the attached commit
5885db6f8466e13ddfab046bae3149a992a30926 'Adjust parallelism of loops in
gang-single parts of OpenACC kernels regions: "struct
adjust_nested_loop_clauses_wi_info"'.


Grüße
 Thomas



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Adjust-parallelism-of-loops-in-gang-single-parts-of-.patch --]
[-- Type: text/x-diff, Size: 4604 bytes --]

From 5885db6f8466e13ddfab046bae3149a992a30926 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Fri, 1 Feb 2019 18:12:05 +0100
Subject: [PATCH] Adjust parallelism of loops in gang-single parts of OpenACC
 kernels regions: "struct adjust_nested_loop_clauses_wi_info"

The current code apparently is too freaky at least for for GCC 4.6:

    [...]/gcc/omp-oacc-kernels.c: In function 'tree_node* transform_kernels_loop_clauses(gimple*, tree, tree, tree, tree)':
    [...]/gcc/omp-oacc-kernels.c:584:10: error: expected identifier before numeric constant
    [...]/gcc/omp-oacc-kernels.c: In lambda function:
    [...]/gcc/omp-oacc-kernels.c:584:25: error: expected '{' before '=' token
    [...]/gcc/omp-oacc-kernels.c: In function 'tree_node* transform_kernels_loop_clauses(gimple*, tree, tree, tree, tree)':
    [...]/gcc/omp-oacc-kernels.c:584:25: warning: lambda expressions only available with -std=c++0x or -std=gnu++0x [enabled by default]
    [...]/gcc/omp-oacc-kernels.c:584:28: error: no match for 'operator=' in '{} = & loop_gang_clause'
    [...]

	gcc/
	* omp-oacc-kernels.c (struct adjust_nested_loop_clauses_wi_info): New.
	(adjust_nested_loop_clauses, transform_kernels_loop_clauses): Use it.
---
 gcc/ChangeLog.openacc  |  5 +++++
 gcc/omp-oacc-kernels.c | 29 +++++++++++++++++------------
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/gcc/ChangeLog.openacc b/gcc/ChangeLog.openacc
index 433653b2b38..a3472637729 100644
--- a/gcc/ChangeLog.openacc
+++ b/gcc/ChangeLog.openacc
@@ -1,3 +1,8 @@
+2019-02-01  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* omp-oacc-kernels.c (struct adjust_nested_loop_clauses_wi_info): New.
+	(adjust_nested_loop_clauses, transform_kernels_loop_clauses): Use it.
+
 2019-01-31  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* doc/invoke.texi (-fopenacc-kernels): Update.
diff --git a/gcc/omp-oacc-kernels.c b/gcc/omp-oacc-kernels.c
index a8860c98e11..d1db4924b1c 100644
--- a/gcc/omp-oacc-kernels.c
+++ b/gcc/omp-oacc-kernels.c
@@ -409,14 +409,19 @@ add_parent_or_loop_num_clause (tree parent_clause, tree loop_clause,
    nested loops.  It adds an auto clause unless there is already an
    independent/seq/auto clause or a gang/worker/vector annotation.  */
 
+struct adjust_nested_loop_clauses_wi_info
+{
+  tree *loop_gang_clause_ptr;
+  tree *loop_worker_clause_ptr;
+  tree *loop_vector_clause_ptr;
+};
+
 static tree
 adjust_nested_loop_clauses (gimple_stmt_iterator *gsi_p, bool *,
                             struct walk_stmt_info *wi)
 {
-  tree **clauses = (tree **) wi->info;
-  tree *gang_num_clause = clauses[GOMP_DIM_GANG];
-  tree *worker_num_clause = clauses[GOMP_DIM_WORKER];
-  tree *vector_length_clause = clauses[GOMP_DIM_VECTOR];
+  struct adjust_nested_loop_clauses_wi_info *wi_info
+    = (struct adjust_nested_loop_clauses_wi_info *) wi->info;
   gimple *stmt = gsi_stmt (*gsi_p);
 
   if (gimple_code (stmt) == GIMPLE_OMP_FOR)
@@ -430,13 +435,13 @@ adjust_nested_loop_clauses (gimple_stmt_iterator *gsi_p, bool *,
           switch (OMP_CLAUSE_CODE (loop_clause))
             {
               case OMP_CLAUSE_GANG:
-                outer_clause_ptr = gang_num_clause;
+                outer_clause_ptr = wi_info->loop_gang_clause_ptr;
                 break;
               case OMP_CLAUSE_WORKER:
-                outer_clause_ptr = worker_num_clause;
+                outer_clause_ptr = wi_info->loop_worker_clause_ptr;
                 break;
               case OMP_CLAUSE_VECTOR:
-                outer_clause_ptr = vector_length_clause;
+                outer_clause_ptr = wi_info->loop_vector_clause_ptr;
                 break;
               case OMP_CLAUSE_INDEPENDENT:
               case OMP_CLAUSE_SEQ:
@@ -580,11 +585,11 @@ transform_kernels_loop_clauses (gimple *omp_for,
      Turn these into worker/vector annotations on the parallel region.  */
   struct walk_stmt_info wi;
   memset (&wi, 0, sizeof (wi));
-  tree *num_clauses[GOMP_DIM_MAX]
-    = { [GOMP_DIM_GANG] = &loop_gang_clause,
-        [GOMP_DIM_WORKER] = &loop_worker_clause,
-        [GOMP_DIM_VECTOR] = &loop_vector_clause };
-  wi.info = num_clauses;
+  struct adjust_nested_loop_clauses_wi_info wi_info;
+  wi_info.loop_gang_clause_ptr = &loop_gang_clause;
+  wi_info.loop_worker_clause_ptr = &loop_worker_clause;
+  wi_info.loop_vector_clause_ptr = &loop_vector_clause;
+  wi.info = &wi_info;
   gimple *body = gimple_omp_body (omp_for);
   walk_gimple_seq (body, adjust_nested_loop_clauses, NULL, &wi);
   /* Check if there were conflicting numbers of workers or vector lanes.  */
-- 
2.17.1


  reply	other threads:[~2019-02-01 19:48 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-01  0:00 Thomas Schwinge
2019-02-01 19:48 ` Thomas Schwinge [this message]
2019-07-17 21:03 ` [PATCH 00/10, OpenACC] Rework handling of OpenACC kernels regions Kwok Cheung Yeung
2019-07-17 21:04   ` [PATCH 01/10, OpenACC] Use "-fopenacc-kernels=parloops" to document "parloops" test cases Kwok Cheung Yeung
2019-07-17 21:05   ` [PATCH 02/10, OpenACC] Add OpenACC target kinds for decomposed kernels regions Kwok Cheung Yeung
2019-07-18  9:28     ` Jakub Jelinek
2019-08-05 22:31       ` Kwok Cheung Yeung
2019-07-17 21:06   ` [PATCH 03/10, OpenACC] Separate OpenACC kernels regions in data and parallel parts Kwok Cheung Yeung
2019-07-17 21:11   ` [PATCH 04/10, OpenACC] Turn OpenACC kernels regions into a sequence of, parallel regions Kwok Cheung Yeung
2019-07-18 10:09     ` Jakub Jelinek
2019-08-05 21:58       ` Kwok Cheung Yeung
2020-11-13 22:33         ` In 'gcc/omp-oacc-kernels-decompose.cc', use langhook instead of accessing language-specific decl information (was: [PATCH 04/10, OpenACC] Turn OpenACC kernels regions into a sequence of, parallel regions) Thomas Schwinge
2019-07-17 21:12   ` [PATCH 05/10, OpenACC] Handle conditional execution of loops in OpenACC, kernels regions Kwok Cheung Yeung
2019-07-17 21:13   ` [PATCH 06/10, OpenACC] Adjust parallelism of loops in gang-single parts of OpenACC " Kwok Cheung Yeung
2019-08-05 22:17     ` Kwok Cheung Yeung
2019-07-17 21:24   ` [PATCH 07/10, OpenACC] Launch kernels asynchronously in " Kwok Cheung Yeung
2019-07-17 21:30   ` [PATCH 08/10, OpenACC] New OpenACC kernels region decompose algorithm Kwok Cheung Yeung
2019-07-17 21:32   ` [PATCH 09/10, OpenACC] Avoid introducing 'create' mapping clauses for loop index variables in kernels regions Kwok Cheung Yeung
2019-07-17 21:37   ` [PATCH 10/10, OpenACC] Make new OpenACC kernels conversion the default; adjust and add tests Kwok Cheung Yeung
2019-07-18  9:24   ` [PATCH 00/10, OpenACC] Rework handling of OpenACC kernels regions Jakub Jelinek
2020-11-13 22:22 ` Decompose OpenACC 'kernels' constructs into parts, a sequence of compute constructs (was: [og8] OpenACC 'kernels' construct changes: splitting of the construct into several regions) Thomas Schwinge
2020-11-15  9:14   ` Tobias Burnus
2021-04-19  8:29     ` Decompose OpenACC 'kernels' constructs into parts, a sequence of compute constructs Thomas Schwinge
2021-04-19 12:38       ` Thomas Schwinge
2020-11-27 13:50   ` Thomas Schwinge
2022-01-13  9:44   ` Enhance OpenACC 'kernels' decomposition testing (was: Decompose OpenACC 'kernels' constructs into parts, a sequence of compute constructs) Thomas Schwinge
2022-01-19 22:29   ` Catch 'GIMPLE_DEBUG' misbehavior in OpenACC 'kernels' decomposition [PR100400, PR103836, PR104061] " Thomas Schwinge
2022-01-19 23:00     ` Jakub Jelinek
2022-01-20  8:26       ` Catch 'GIMPLE_DEBUG' misbehavior in OpenACC 'kernels' decomposition [PR100400, PR103836, PR104061] Thomas Schwinge
2022-01-20  9:58         ` Jakub Jelinek
2022-03-12 12:38   ` Add 'c-c++-common/goacc/kernels-decompose-pr104086-1.c' [PR104086] Thomas Schwinge
2022-03-12 12:42     ` OpenACC 'kernels' decomposition: Mark variables used in 'present' clauses as addressable [PR100280, PR104086] Thomas Schwinge
2022-03-17  8:04   ` Enhance further testcases to verify Openacc 'kernels' decomposition 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=yxfpsgx7cmsx.fsf@hertz.schwinge.homeip.net \
    --to=thomas@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gergo@codesourcery.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).