[openacc] acc loop updates in fortran

Thomas Schwinge thomas@codesourcery.com
Wed Nov 4 17:15:00 GMT 2015


Hi Cesar!

On Tue, 3 Nov 2015 19:06:50 -0800, Cesar Philippidis <cesar@codesourcery.com> wrote:
> This patch updates the fortran front end so that it supports the acc
> loop clauses in a similar manner to both the c and c++ front ends in
> addition to addressing a couple of other loose ends.

> --- a/gcc/fortran/openmp.c
> +++ b/gcc/fortran/openmp.c

> @@ -3028,6 +3015,22 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
>  	n->sym->mark = 1;
>      }
>  
> +  /* OpenACC reductions.  */
> +  if (openacc)
> +    {
> +      for (n = omp_clauses->lists[OMP_LIST_REDUCTION]; n; n = n->next)
> +	n->sym->mark = 0;

Maybe I'm just confugsed, but if setting all these to zero here...

> +
> +      for (n = omp_clauses->lists[OMP_LIST_REDUCTION]; n; n = n->next)
> +	{
> +	  if (n->sym->mark)
> +	    gfc_error ("Symbol %qs present on multiple clauses at %L",
> +		       n->sym->name, &n->where);
> +	  else
> +	    n->sym->mark = 1;

... won't this just always run into the "else" branch?

> --- a/gcc/fortran/trans-openmp.c
> +++ b/gcc/fortran/trans-openmp.c

> @@ -3449,16 +3478,28 @@ gfc_trans_oacc_combined_directive (gfc_code *code)
>  	      sizeof (construct_clauses));
>        loop_clauses.collapse = construct_clauses.collapse;
> [...]
> -      construct_clauses.collapse = 0;

Again I'm confused by this, why this is being removed, as earlier in
<http://news.gmane.org/find-root.php?message_id=%3C87vb9r45qw.fsf%40kepler.schwinge.homeip.net%3E>.

> --- /dev/null
> +++ b/gcc/testsuite/gfortran.dg/goacc/combined-directives.f90

I suggest you also merge the existing
gcc/testsuite/gfortran.dg/goacc/combined_loop.f90 into your new test case
file (consistent naming, with the other combined-directives* files).

> @@ -0,0 +1,152 @@
> +! Exercise combined OpenACC directives.
> +
> +! { dg-do compile }
> +! { dg-options "-fopenacc -fdump-tree-gimple" }
> +
> +! { dg-prune-output "sorry, unimplemented" }

What's still unimplemented here?  Please add a comment, or put the
dg-prune-output directive next to the offending OpenACC directive, so
we'll be sure to remove it later on.

> --- /dev/null
> +++ b/gcc/testsuite/gfortran.dg/goacc/loop-5.f95
> @@ -0,0 +1,363 @@
> +! { dg-do compile }
> +! { dg-additional-options "-fmax-errors=100" }
> +
> +! { dg-prune-output "sorry, unimplemented" }

Likewise.

> +! { dg-prune-output "Error: work-sharing region" }

What's the intention of this?  If we're expecting this error, place
dg-error directives where they belong?

> --- /dev/null
> +++ b/gcc/testsuite/gfortran.dg/goacc/loop-6.f95
> @@ -0,0 +1,80 @@
> +! { dg-do compile }
> +! { dg-additional-options "-fmax-errors=100" }
> +
> +! { dg-prune-output "sorry, unimplemented" }

Likewise.

> +! { dg-prune-output "Error: work-sharing region" }

Likewise.

> --- a/gcc/testsuite/gfortran.dg/goacc/loop-tree-1.f90
> +++ b/gcc/testsuite/gfortran.dg/goacc/loop-tree-1.f90
> @@ -3,6 +3,9 @@
>  
>  ! test for tree-dump-original and spaces-commas
>  
> +! { dg-prune-output "sorry, unimplemented" }

Likewise.

> +! { dg-prune-output "Error: work-sharing region" }

Likewise.

> --- a/gcc/testsuite/gfortran.dg/goacc/parallel-tree.f95
> +++ b/gcc/testsuite/gfortran.dg/goacc/parallel-tree.f95
> @@ -37,4 +37,3 @@ end program test
>  
>  ! { dg-final { scan-tree-dump-times "map\\(force_deviceptr:u\\)" 1 "original" } } 
>  ! { dg-final { scan-tree-dump-times "private\\(v\\)" 1 "original" } } 
> -! { dg-final { scan-tree-dump-times "firstprivate\\(w\\)" 1 "original" } } 

Which of your source code changes does this change related to?


Grüße
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20151104/b7c67378/attachment.sig>


More information about the Gcc-patches mailing list