From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11486 invoked by alias); 1 Feb 2019 19:48:41 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 11471 invoked by uid 89); 1 Feb 2019 19:48:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 01 Feb 2019 19:48:39 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-03.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1gpenk-0002Bx-Ts from Thomas_Schwinge@mentor.com for gcc-patches@gcc.gnu.org; Fri, 01 Feb 2019 11:48:37 -0800 Received: from hertz.schwinge.homeip.net (137.202.0.90) by SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Fri, 1 Feb 2019 19:48:33 +0000 From: Thomas Schwinge To: CC: =?utf-8?Q?Gerg=C3=B6?= Barany Subject: Re: [og8] OpenACC 'kernels' construct changes: splitting of the construct into several regions In-Reply-To: References: User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/25.2.2 (x86_64-pc-linux-gnu) Date: Fri, 01 Feb 2019 19:48:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SW-Source: 2019-02/txt/msg00045.txt.bz2 --=-=-= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-length: 1099 Hi! On Fri, 01 Feb 2019 00:59:30 +0100, I wrote: > From c7713be32fc5eace2b1e9c20447da849d23f6076 Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?Gerg=3DC3=3DB6=3D20Barany?=3D > 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] > + =3D { [GOMP_DIM_GANG] =3D &loop_gang_clause, > + [GOMP_DIM_WORKER] =3D &loop_worker_clause, > + [GOMP_DIM_VECTOR] =3D &loop_vector_clause }; > + wi.info =3D num_clauses; > + gimple *body =3D 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=C3=BC=C3=9Fe Thomas --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename="0001-Adjust-parallelism-of-loops-in-gang-single-parts-of-.patch" Content-length: 4605 >From 5885db6f8466e13ddfab046bae3149a992a30926 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge 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 + + * 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 * 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 --=-=-=--