Hi! On Wed, 4 Jun 2014 20:58:06 -0700, Cesar Philippidis <ce...@codesourcery.com> wrote: > On 06/04/2014 06:53 AM, Ilmir Usmanov wrote: > >> @@ -1817,13 +1818,9 @@ scan_sharing_clauses (tree clauses, omp_context > >> *ctx) > >> case OMP_CLAUSE_PRIVATE: > >> case OMP_CLAUSE_FIRSTPRIVATE: > >> case OMP_CLAUSE_REDUCTION: > >> - if (is_gimple_omp_oacc_specifically (ctx->stmt)) > >> - { > >> - sorry ("clause not supported yet"); > >> - break; > >> - } > > This change produces regression on parallel-tree.f95 testcase: ICE. > > I've replaced the asserts with sorry messages in my other patch, so it > shouldn't ICE anymore.
I checked in the following to gomp-4_0-branch, r211630: commit 3d28e12852971eeda32294ef1427e0c7c0a0ca72 Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Fri Jun 13 11:13:04 2014 +0000 Unsupported OpenACC clauses: sorry message instead of aborting. gcc/ * omp-low.c (scan_sharing_clauses): For clauses currently not supported with OpenACC directives, emit a sorry message instead of aborting. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@211630 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.gomp | 6 ++++++ gcc/omp-low.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp index 2abe179..6ab79c0 100644 --- gcc/ChangeLog.gomp +++ gcc/ChangeLog.gomp @@ -1,3 +1,9 @@ +2014-06-13 Cesar Philippidis <ce...@codesourcery.com> + + * omp-low.c (scan_sharing_clauses): For clauses currently not + supported with OpenACC directives, emit a sorry message instead of + aborting. + 2014-06-12 Thomas Schwinge <tho...@codesourcery.com> James Norris <jnor...@codesourcery.com> diff --git gcc/omp-low.c gcc/omp-low.c index 958f116..d1ecd88 100644 --- gcc/omp-low.c +++ gcc/omp-low.c @@ -1785,7 +1785,11 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) case OMP_CLAUSE_MERGEABLE: case OMP_CLAUSE_PROC_BIND: case OMP_CLAUSE_SAFELEN: - gcc_assert (!is_gimple_omp_oacc_specifically (ctx->stmt)); + if (is_gimple_omp_oacc_specifically (ctx->stmt)) + { + sorry ("clause not supported yet"); + break; + } break; case OMP_CLAUSE_ALIGNED: > If this patch is OK with you, please commit it. I checked in the following to gomp-4_0-branch, r211634: commit ee272605d78b610a7accbdcc2a304d7d0e70a1e6 Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Fri Jun 13 11:18:47 2014 +0000 OpenACC loop construct. gcc/fortran/ * trans-openmp.c (gfc_trans_oacc_combined_directive): Move under gfc_trans_omp_do. (gfc_trans_omp_do, gfc_trans_oacc_directive): Handle EXEC_OACC_LOOP. gcc/testsuite/ * gfortran.dg/goacc/loop-tree.f95: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@211634 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog.gomp | 7 ++ gcc/fortran/trans-openmp.c | 133 ++++++++++++++---------- gcc/testsuite/ChangeLog.gomp | 5 + gcc/testsuite/gfortran.dg/goacc/loop-tree-1.f90 | 49 +++++++++ 4 files changed, 139 insertions(+), 55 deletions(-) diff --git gcc/fortran/ChangeLog.gomp gcc/fortran/ChangeLog.gomp index aff672e..97f62c0 100644 --- gcc/fortran/ChangeLog.gomp +++ gcc/fortran/ChangeLog.gomp @@ -1,3 +1,10 @@ +2014-06-13 Ilmir Usmanov <i.usma...@samsung.com> + Cesar Philippidis <ce...@codesourcery.com> + + * trans-openmp.c (gfc_trans_oacc_combined_directive): Move under + gfc_trans_omp_do. + (gfc_trans_omp_do, gfc_trans_oacc_directive): Handle EXEC_OACC_LOOP. + 2014-04-05 Tobias Burnus <bur...@net-b.de> PR fortran/60283 diff --git gcc/fortran/trans-openmp.c gcc/fortran/trans-openmp.c index 08f6faa..721dcb1 100644 --- gcc/fortran/trans-openmp.c +++ gcc/fortran/trans-openmp.c @@ -1856,58 +1856,6 @@ typedef struct dovar_init_d { tree init; } dovar_init; -/* parallel loop and kernels loop. */ -static tree -gfc_trans_oacc_combined_directive (gfc_code *code) -{ - stmtblock_t block; - gfc_omp_clauses construct_clauses, loop_clauses; - tree stmt, oacc_clauses = NULL_TREE; - enum tree_code construct_code; - - switch (code->op) - { - case EXEC_OACC_PARALLEL_LOOP: - construct_code = OACC_PARALLEL; - break; - case EXEC_OACC_KERNELS_LOOP: - construct_code = OACC_KERNELS; - break; - default: - gcc_unreachable (); - } - - gfc_start_block (&block); - - memset (&loop_clauses, 0, sizeof (loop_clauses)); - if (code->ext.omp_clauses != NULL) - { - memcpy (&construct_clauses, code->ext.omp_clauses, - sizeof (construct_clauses)); - loop_clauses.collapse = construct_clauses.collapse; - loop_clauses.gang = construct_clauses.gang; - loop_clauses.vector = construct_clauses.vector; - loop_clauses.worker = construct_clauses.worker; - loop_clauses.seq = construct_clauses.seq; - loop_clauses.independent = construct_clauses.independent; - construct_clauses.collapse = 0; - construct_clauses.gang = false; - construct_clauses.vector = false; - construct_clauses.worker = false; - construct_clauses.seq = false; - construct_clauses.independent = false; - oacc_clauses = gfc_trans_omp_clauses (&block, &construct_clauses, - code->loc); - } - - gfc_error ("!$ACC LOOP directive not implemented yet %L", &code->loc); - stmt = gfc_trans_omp_code (code->block->next, true); - stmt = build2_loc (input_location, construct_code, void_type_node, stmt, - oacc_clauses); - gfc_add_expr_to_block (&block, stmt); - return gfc_finish_block (&block); -} - static tree gfc_trans_omp_do (gfc_code *code, gfc_exec_op op, stmtblock_t *pblock, gfc_omp_clauses *do_clauses, tree par_clauses) @@ -1915,6 +1863,7 @@ gfc_trans_omp_do (gfc_code *code, gfc_exec_op op, stmtblock_t *pblock, gfc_se se; tree dovar, stmt, from, to, step, type, init, cond, incr; tree count = NULL_TREE, cycle_label, tmp, omp_clauses; + tree_code stmt_code; stmtblock_t block; stmtblock_t body; gfc_omp_clauses *clauses = code->ext.omp_clauses; @@ -2174,7 +2123,19 @@ gfc_trans_omp_do (gfc_code *code, gfc_exec_op op, stmtblock_t *pblock, } /* End of loop body. */ - stmt = make_node (op == EXEC_OMP_SIMD ? OMP_SIMD : OMP_FOR); + switch (op) + { + case EXEC_OMP_SIMD: + stmt_code = OMP_SIMD; + break; + case EXEC_OACC_LOOP: + stmt_code = OACC_LOOP; + break; + default: + stmt_code = OMP_FOR; + } + + stmt = make_node (stmt_code); TREE_TYPE (stmt) = void_type_node; OMP_FOR_BODY (stmt) = gfc_finish_block (&body); @@ -2187,6 +2148,68 @@ gfc_trans_omp_do (gfc_code *code, gfc_exec_op op, stmtblock_t *pblock, return gfc_finish_block (&block); } +/* parallel loop and kernels loop. */ +static tree +gfc_trans_oacc_combined_directive (gfc_code *code) +{ + stmtblock_t block, *pblock = NULL; + gfc_omp_clauses construct_clauses, loop_clauses; + tree stmt, oacc_clauses = NULL_TREE; + enum tree_code construct_code; + + switch (code->op) + { + case EXEC_OACC_PARALLEL_LOOP: + construct_code = OACC_PARALLEL; + break; + case EXEC_OACC_KERNELS_LOOP: + construct_code = OACC_KERNELS; + break; + default: + gcc_unreachable (); + } + + gfc_start_block (&block); + + memset (&loop_clauses, 0, sizeof (loop_clauses)); + if (code->ext.omp_clauses != NULL) + { + memcpy (&construct_clauses, code->ext.omp_clauses, + sizeof (construct_clauses)); + loop_clauses.collapse = construct_clauses.collapse; + loop_clauses.gang = construct_clauses.gang; + loop_clauses.vector = construct_clauses.vector; + loop_clauses.worker = construct_clauses.worker; + loop_clauses.seq = construct_clauses.seq; + loop_clauses.independent = construct_clauses.independent; + construct_clauses.collapse = 0; + construct_clauses.gang = false; + construct_clauses.vector = false; + construct_clauses.worker = false; + construct_clauses.seq = false; + construct_clauses.independent = false; + oacc_clauses = gfc_trans_omp_clauses (&block, &construct_clauses, + code->loc); + } + if (!loop_clauses.seq) + pblock = █ + else + pushlevel (); + stmt = gfc_trans_omp_do (code, code->op, pblock, &loop_clauses, NULL); + if (TREE_CODE (stmt) != BIND_EXPR) + stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0)); + else + poplevel (0, 0); + stmt = build2_loc (input_location, construct_code, void_type_node, stmt, + oacc_clauses); + if (code->op == EXEC_OACC_KERNELS_LOOP) + OACC_KERNELS_COMBINED (stmt) = 1; + else + OACC_PARALLEL_COMBINED (stmt) = 1; + gfc_add_expr_to_block (&block, stmt); + return gfc_finish_block (&block); +} + static tree gfc_trans_omp_flush (void) { @@ -2763,8 +2786,8 @@ gfc_trans_oacc_directive (gfc_code *code) case EXEC_OACC_HOST_DATA: return gfc_trans_oacc_construct (code); case EXEC_OACC_LOOP: - gfc_error ("!$ACC LOOP directive not implemented yet %L", &code->loc); - return NULL_TREE; + return gfc_trans_omp_do (code, code->op, NULL, code->ext.omp_clauses, + NULL); case EXEC_OACC_UPDATE: case EXEC_OACC_WAIT: case EXEC_OACC_CACHE: diff --git gcc/testsuite/ChangeLog.gomp gcc/testsuite/ChangeLog.gomp index 9b65cc9..557287b 100644 --- gcc/testsuite/ChangeLog.gomp +++ gcc/testsuite/ChangeLog.gomp @@ -1,3 +1,8 @@ +2014-06-13 Ilmir Usmanov <i.usma...@samsung.com> + Cesar Philippidis <ce...@codesourcery.com> + + * gfortran.dg/goacc/loop-tree.f95: New file. + 2014-06-12 Thomas Schwinge <tho...@codesourcery.com> * c-c++-common/goacc/if-clause-1.c: New file. diff --git gcc/testsuite/gfortran.dg/goacc/loop-tree-1.f90 gcc/testsuite/gfortran.dg/goacc/loop-tree-1.f90 new file mode 100644 index 0000000..14779b6 --- /dev/null +++ gcc/testsuite/gfortran.dg/goacc/loop-tree-1.f90 @@ -0,0 +1,49 @@ +! { dg-do compile } +! { dg-additional-options "-fdump-tree-original -std=f2008" } + +! test for tree-dump-original and spaces-commas + +program test + implicit none + integer :: i, j, k, m, sum + REAL :: a(64), b(64), c(64) + + !$acc kernels + !$acc loop collapse(2) + DO i = 1,10 + DO j = 1,10 + ENDDO + ENDDO + + !$acc loop independent gang (3) + DO i = 1,10 + !$acc loop worker(3) ! { dg-error "work-sharing region may not be closely nested inside of work-sharing, critical, ordered, master or explicit task region" } + DO j = 1,10 + !$acc loop vector(5) + DO k = 1,10 + ENDDO + ENDDO + ENDDO + !$acc end kernels + + sum = 0 + !$acc parallel + !$acc loop private(m) reduction(+:sum) + DO i = 1,10 + sum = sum + 1 + ENDDO + !$acc end parallel + +end program test +! { dg-prune-output "sorry" } +! { dg-final { scan-tree-dump-times "pragma acc loop" 5 "original" } } + +! { dg-final { scan-tree-dump-times "collapse\\(2\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "independent" 1 "original" } } +! { dg-final { scan-tree-dump-times "gang\\(3\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "worker\\(3\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "vector\\(5\\)" 1 "original" } } + +! { dg-final { scan-tree-dump-times "private\\(m\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "reduction\\(\\+:sum\\)" 1 "original" } } +! { dg-final { cleanup-tree-dump "original" } } Grüße, Thomas
pgpjDDXJasNF6.pgp
Description: PGP signature