Hi Cesar! On Wed, 4 Jun 2014 20:42:16 -0700, Cesar Philippidis <ce...@codesourcery.com> wrote: > The way that the loop clause > is handle in fortran is that all loops get lowered with the collapse > clause set. By default, for non-concurrent loops, collapse is set to 1. > And when collapse == 1, nothing special happens during the omp-lowering > phase.
Ah, I see. > In this updated patch, I removed the c front end changes. Also, collapse > support in fortran is restricted to collapse(1) or else the do loop > clause will do nothing. Any collapse value != 1 will get caught by one > of the existing asserts. I checked in the following to gomp-4_0-branch, r211632: commit aec20f26f3a7410ba36a734ede85220b188d1e94 Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Fri Jun 13 11:16:07 2014 +0000 For OpenACC directives, the collapse(1) clause is supported. gcc/ * omp-low.c (extract_omp_for_data, scan_sharing_clauses): For OpenACC directives, the collapse(1) clause is supported. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@211632 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.gomp | 6 ++++++ gcc/omp-low.c | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp index 68f9370..75e47d0 100644 --- gcc/ChangeLog.gomp +++ gcc/ChangeLog.gomp @@ -1,3 +1,9 @@ +2014-06-13 Thomas Schwinge <tho...@codesourcery.com> + Cesar Philippidis <ce...@codesourcery.com> + + * omp-low.c (extract_omp_for_data, scan_sharing_clauses): For + OpenACC directives, the collapse(1) clause is supported. + 2014-06-13 Cesar Philippidis <ce...@codesourcery.com> * omp-low.c (scan_sharing_clauses): Preliminary support for diff --git gcc/omp-low.c gcc/omp-low.c index 454a293..bc6ca23 100644 --- gcc/omp-low.c +++ gcc/omp-low.c @@ -365,6 +365,9 @@ extract_omp_for_data (gimple for_stmt, struct omp_for_data *fd, case OMP_CLAUSE_COLLAPSE: if (fd->collapse > 1) { + if (is_gimple_omp_oacc_specifically (for_stmt)) + sorry ("collapse (>1) clause not supported yet"); + collapse_iter = &OMP_CLAUSE_COLLAPSE_ITERVAR (t); collapse_count = &OMP_CLAUSE_COLLAPSE_COUNT (t); } @@ -1779,7 +1782,6 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) case OMP_CLAUSE_NOWAIT: case OMP_CLAUSE_ORDERED: - case OMP_CLAUSE_COLLAPSE: case OMP_CLAUSE_UNTIED: case OMP_CLAUSE_MERGEABLE: case OMP_CLAUSE_PROC_BIND: @@ -1789,6 +1791,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) sorry ("clause not supported yet"); break; } + case OMP_CLAUSE_COLLAPSE: break; case OMP_CLAUSE_ALIGNED: @@ -1925,7 +1928,6 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) case OMP_CLAUSE_DIST_SCHEDULE: case OMP_CLAUSE_NOWAIT: case OMP_CLAUSE_ORDERED: - case OMP_CLAUSE_COLLAPSE: case OMP_CLAUSE_UNTIED: case OMP_CLAUSE_FINAL: case OMP_CLAUSE_MERGEABLE: @@ -1937,6 +1939,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) case OMP_CLAUSE_TO: case OMP_CLAUSE_FROM: gcc_assert (!is_gimple_omp_oacc_specifically (ctx->stmt)); + case OMP_CLAUSE_COLLAPSE: case OMP_CLAUSE_IF: case OMP_CLAUSE_NUM_GANGS: case OMP_CLAUSE_NUM_WORKERS: > On 06/04/2014 12:49 PM, Thomas Schwinge wrote: > > (Also, I'm not sure to > > which extent we're at all currently handling combined directives in > > gimplification and lowering?) > > Do you mean something like > > $!acc parallel loop > > ? That doesn't work yet. But it does work when you separate them. Right, that's what I meant. > > So, if this helps you to make progress, I'm OK for you to commit the > > preliminary support for OMP_CLAUSE_PRIVATE, and I'll then revisit this > > clause/code in the near future, for the correct OpenACC semantics. I checked in the following to gomp-4_0-branch, r211631: commit cb91bb0ec983ab19b0668de7246b7c75f275d523 Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Fri Jun 13 11:15:02 2014 +0000 Preliminary support for OMP_CLAUSE_PRIVATE for OpenACC. gcc/ * omp-low.c (scan_sharing_clauses): Preliminary support for OMP_CLAUSE_PRIVATE for OpenACC. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@211631 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.gomp | 3 +++ gcc/omp-low.c | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp index 6ab79c0..68f9370 100644 --- gcc/ChangeLog.gomp +++ gcc/ChangeLog.gomp @@ -1,5 +1,8 @@ 2014-06-13 Cesar Philippidis <ce...@codesourcery.com> + * omp-low.c (scan_sharing_clauses): Preliminary support for + OMP_CLAUSE_PRIVATE for OpenACC. + * omp-low.c (scan_sharing_clauses): For clauses currently not supported with OpenACC directives, emit a sorry message instead of aborting. diff --git gcc/omp-low.c gcc/omp-low.c index d1ecd88..454a293 100644 --- gcc/omp-low.c +++ gcc/omp-low.c @@ -1534,7 +1534,6 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) switch (OMP_CLAUSE_CODE (c)) { case OMP_CLAUSE_PRIVATE: - gcc_assert (!is_gimple_omp_oacc_specifically (ctx->stmt)); decl = OMP_CLAUSE_DECL (c); if (OMP_CLAUSE_PRIVATE_OUTER_REF (c)) goto do_private; @@ -1833,7 +1832,6 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) break; /* FALLTHRU */ - case OMP_CLAUSE_PRIVATE: case OMP_CLAUSE_FIRSTPRIVATE: case OMP_CLAUSE_REDUCTION: if (is_gimple_omp_oacc_specifically (ctx->stmt)) @@ -1843,6 +1841,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) } case OMP_CLAUSE_LINEAR: gcc_assert (!is_gimple_omp_oacc_specifically (ctx->stmt)); + case OMP_CLAUSE_PRIVATE: decl = OMP_CLAUSE_DECL (c); if (is_variable_sized (decl)) install_var_local (decl, ctx); Grüße, Thomas
pgpteXFETsOga.pgp
Description: PGP signature