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]

Re: [gomp4] New test loop independent clause


On 15/07/15 14:03, Thomas Schwinge wrote:
Hi Tom!

On Wed, 15 Jul 2015 12:43:05 +0200, Tom de Vries <Tom_deVries@mentor.com> wrote:
On 15/07/15 11:28, Thomas Schwinge wrote:
On Tue, 14 Jul 2015 14:10:01 -0500, James Norris <jnorris@codesourcery.com> wrote:
The attached adds testing for the independent clause
with the loop directive in Fortran.

Committed to gomp-4_0-branch.

--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-independent.f90

Thanks!  I had a look, and per -O2 -ftree-parallelize-loops=32
-fdump-tree-parloops_oacc_kernels-all -fdump-tree-optimized tree dumps,
indeed I see the anticipated ÂSUCCESS: may be parallelized as well as
Â#pragma omp target oacc_parallel num_gangs(32)Â markers, so I think this
test case is being parallelized (as well as it executes correctly).  So,
I'm correct in assuming that this is not showcasing the Fortran issue
that Tom raised yesterday?

The issue I remember raising is: PR66873 - fortran variant of outer-1.c
not parallelized by autopar.

Ah, I mixed that up, sorry.


Anyway, do we want a compiler test case additional to thie libgomp
execution test?


The important thing is to check in C and Fortran for 'SUCCESS: may be parallelized, marked independent'.

So I think we want a fortran variant of gcc/testsuite/c-c++-common/goacc/kernels-independent.c, in other words, a independent clause variant of of gcc/testsuite/gfortran.dg/goacc/kernels-loop.f95

Both gcc/testsuite/gfortran.dg/goacc/kernels-loop.f95 and gcc/testsuite/c-c++-common/goacc/kernels-loop.c have libgomp counterparts, there's no reason to have libgomp counterparts for the respective independent
clause variants.

Thanks,
- Tom

Anyway, assuming that it adds value to the
current set of test cases, should this also be made a compiler test case,
with dg-final directives checking for the anticipated properties, similar
to gcc/testsuite/gfortran.dg/goacc/kernels-loop.f95, for example?

@@ -0,0 +1,43 @@
+! { dg-do run } */
+! { dg-additional-options "-cpp" }
+! { dg-additional-options "-ftree-parallelize-loops=32" }
+
+#define N (1024 * 512)
+
+subroutine foo (a,  b,  c)
+  integer, parameter :: n = N
+  integer, dimension (n) :: a
+  integer, dimension (n) :: b
+  integer, dimension (n) :: c
+  integer i, ii
+
+  do i = 1, n
+    a(i) = i * 2;
+  end do
+
+  do i = 1, n
+    b(i) = i * 4;
+  end do
+
+  !$acc kernels copyin (a(1:n), b(1:n)) copyout (c(1:n))
+    !$acc loop independent
+    do ii = 1, n
+      c(ii) = a(ii) + b(ii)
+    end do
+  !$acc end kernels
+
+  do i = 1, n
+    if (c(i) .ne. a(i) + b(i)) call abort
+  end do
+
+end subroutine
+
+program main
+  integer, parameter :: n = N
+  integer :: a(n)
+  integer :: b(n)
+  integer :: c(n)
+
+  call foo (a, b, c)
+
+end program main


GrÃÃe,
  Thomas



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