This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch,openacc] update fortran nested parallelism error messages


Bernhard noticed a typo in one of the OpenACC parallelism error
messages. The error should have reported that gang loops cannot be
nested inside vector loops, not worker loops.

I'll commit the attached patch to trunk as obvious. I bootstrapped and
regtested it against x86_64 Linux with nvptx offloading.

Cesar
[OpenACC] update fortran nested parallelism error messages

2018-09-24  Bernhard Reuther-Fischer  <aldot@gcc.gnu.org>
	    Cesar Philippidis  <cesar@codesourcery.com>

	gcc/fortran/
	* openmp.c (resolve_oacc_loop_blocks):

	gcc/testsuite/
	* gfortran.dg/goacc/nested-parallelism.f90: New test.

---
 gcc/fortran/openmp.c                          |  2 +-
 .../gfortran.dg/goacc/nested-parallelism.f90  | 51 +++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gfortran.dg/goacc/nested-parallelism.f90

diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index ac1923ea06b..a046863445d 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -5913,7 +5913,7 @@ resolve_oacc_loop_blocks (gfc_code *code)
 			     &code->loc);
 		if (c->code->ext.omp_clauses->vector)
 		  gfc_error ("Loop parallelized across gangs is not allowed "
-			     "inside loop parallelized across workers at %L",
+			     "inside loop parallelized across vectors at %L",
 			     &code->loc);
 	      }
 	    if (code->ext.omp_clauses->worker)
diff --git a/gcc/testsuite/gfortran.dg/goacc/nested-parallelism.f90 b/gcc/testsuite/gfortran.dg/goacc/nested-parallelism.f90
new file mode 100644
index 00000000000..6ebef6a4547
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/nested-parallelism.f90
@@ -0,0 +1,51 @@
+! Verify the invalid gang, worker, vector parallelism error messages.
+
+program np
+  integer, parameter :: n = 100
+  integer :: i, j, k
+
+  !$acc parallel loop gang
+  do i = 1, n
+     !$acc loop gang ! { dg-error "gangs is not allowed inside another loop parallelized across gangs" }
+     do j = 1, n
+     end do
+
+     !$acc loop worker
+     do j = 1, n
+     end do
+
+     !$acc loop vector
+     do j = 1, n
+     end do     
+  end do
+  
+  !$acc parallel loop worker
+  do i = 1, n
+     !$acc loop gang ! { dg-error "gangs is not allowed inside loop parallelized across workers" }
+     do j = 1, n
+     end do
+
+     !$acc loop worker ! { dg-error "workers is not allowed inside another loop parallelized across workers" }
+     do j = 1, n
+     end do
+
+     !$acc loop vector
+     do j = 1, n
+     end do     
+  end do
+
+  !$acc parallel loop vector
+  do i = 1, n
+     !$acc loop gang ! { dg-error "gangs is not allowed inside loop parallelized across vectors" }
+     do j = 1, n
+     end do
+
+     !$acc loop worker ! { dg-error "workers is not allowed inside another loop parallelized across vectors" }
+     do j = 1, n
+     end do
+
+     !$acc loop vector ! { dg-error "vectors is not allowed inside another loop parallelized across vectors" }
+     do j = 1, n
+     end do     
+  end do
+end program np
-- 
2.17.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]