Hi! On 2015-10-21T15:42:26-0400, Nathan Sidwell <nat...@acm.org> wrote: > This patch is the early lowering part of OpenACC loops. Rather than > piggy-back > onto expand_omp_for_static_nochunk & expand_omp_for_static_chunk, we have a > new > function 'expand_oacc_for', which does the OpenACC equivalent > expension. [...]
Aye! (These changes got committed in r229472.) > +static void > +expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) > +{ > + [...] > + bool chunking = !gimple_in_ssa_p (cfun);; > + [...] > + if (gimple_in_ssa_p (cfun)) > + { > + offset_init = gimple_omp_for_index (for_stmt, 0); > + gcc_assert (integer_zerop (fd->loop.n1)); > + /* The SSA parallelizer does gang parallelism. */ > + gwv = build_int_cst (integer_type_node, GOMP_DIM_MASK (GOMP_DIM_GANG)); > + } > + [etc.] That's, uhm, a bit "non-obvious" ;-) what's going on there, that (citing from my patch/commit) "some of the 'gimple_in_ssa_p (cfun)' conditionals are for SSA specifics, and some are for 'parloops' OpenACC 'kernels'-parallelized specifics". To clarify that, I've pushed "More explicit checking of which OMP constructs we're expecting, part II" to master branch in commit 8c3aa359ce33732273bbd61c5f9a2c607779b32e, and backported to releases/gcc-10 branch in commit 6e8837438148d6ed3e512099b2d12d06836c2a45, see attached. Grüße Thomas ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
>From 8c3aa359ce33732273bbd61c5f9a2c607779b32e Mon Sep 17 00:00:00 2001 From: Thomas Schwinge <tho...@codesourcery.com> Date: Fri, 20 Nov 2020 10:41:46 +0100 Subject: [PATCH] More explicit checking of which OMP constructs we're expecting, part II In particular, more precisely highlight what applies generally vs. the special handling for the current 'parloops'-based OpenACC 'kernels' implementation. gcc/ * omp-expand.c (expand_oacc_for): More explicit checking of which OMP constructs we're expecting. --- gcc/omp-expand.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index c0e94e5e323..928644b099c 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -7413,6 +7413,21 @@ expand_omp_taskloop_for_inner (struct omp_region *region, static void expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) { + bool is_oacc_kernels_parallelized + = (lookup_attribute ("oacc kernels parallelized", + DECL_ATTRIBUTES (current_function_decl)) != NULL); + { + bool is_oacc_kernels + = (lookup_attribute ("oacc kernels", + DECL_ATTRIBUTES (current_function_decl)) != NULL); + if (is_oacc_kernels_parallelized) + gcc_checking_assert (is_oacc_kernels); + } + gcc_assert (gimple_in_ssa_p (cfun) == is_oacc_kernels_parallelized); + /* In the following, some of the 'gimple_in_ssa_p (cfun)' conditionals are + for SSA specifics, and some are for 'parloops' OpenACC + 'kernels'-parallelized specifics. */ + tree v = fd->loop.v; enum tree_code cond_code = fd->loop.cond_code; enum tree_code plus_code = PLUS_EXPR; -- 2.17.1
>From 6e8837438148d6ed3e512099b2d12d06836c2a45 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge <tho...@codesourcery.com> Date: Fri, 20 Nov 2020 10:41:46 +0100 Subject: [PATCH] More explicit checking of which OMP constructs we're expecting, part II In particular, more precisely highlight what applies generally vs. the special handling for the current 'parloops'-based OpenACC 'kernels' implementation. gcc/ * omp-expand.c (expand_oacc_for): More explicit checking of which OMP constructs we're expecting. (cherry picked from commit 8c3aa359ce33732273bbd61c5f9a2c607779b32e) --- gcc/omp-expand.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index 735e263c8f8..27adbaf15cb 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -5998,6 +5998,21 @@ expand_omp_taskloop_for_inner (struct omp_region *region, static void expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) { + bool is_oacc_kernels_parallelized + = (lookup_attribute ("oacc kernels parallelized", + DECL_ATTRIBUTES (current_function_decl)) != NULL); + { + bool is_oacc_kernels + = (lookup_attribute ("oacc kernels", + DECL_ATTRIBUTES (current_function_decl)) != NULL); + if (is_oacc_kernels_parallelized) + gcc_checking_assert (is_oacc_kernels); + } + gcc_assert (gimple_in_ssa_p (cfun) == is_oacc_kernels_parallelized); + /* In the following, some of the 'gimple_in_ssa_p (cfun)' conditionals are + for SSA specifics, and some are for 'parloops' OpenACC + 'kernels'-parallelized specifics. */ + tree v = fd->loop.v; enum tree_code cond_code = fd->loop.cond_code; enum tree_code plus_code = PLUS_EXPR; -- 2.17.1