public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7347] Fix OpenACC gang-redundant execution in 'libgomp.oacc-fortran/privatized-ref-2.f90'
@ 2022-02-22 16:32 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-02-22 16:32 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f8187b5c0d22723c8e0a3d13d0ea5dd7ecfeff75

commit r12-7347-gf8187b5c0d22723c8e0a3d13d0ea5dd7ecfeff75
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Fri Jan 21 14:58:23 2022 +0100

    Fix OpenACC gang-redundant execution in 'libgomp.oacc-fortran/privatized-ref-2.f90'
    
    This was a latent problem, and this commit here now resolves a regression that
    after recent commit a78b1ab1df9ca44acc5638e8f9d0ae2e62bd65ed
    "amdgcn: Tune default OpenMP/OpenACC GPU utilization" we had (only) seen on a
    GCN offloading '-march=gfx908' system:
    
        {+WARNING: program timed out.+}
        [-PASS:-]{+FAIL:+} libgomp.oacc-fortran/privatized-ref-2.f90 -DACC_DEVICE_TYPE_radeon=1 -DACC_MEM_SHARED=0 -foffload=amdgcn-amdhsa  -O0  execution test
    
    Same for other optimization levels.
    
    Make sure that we're not executing non-parallelized code in gang-redundant
    mode, by putting these parts into their own 'parallel' constructs, which then
    default to 'num_gangs(1)'.
    
            libgomp/
            * testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Fix OpenACC
            gang-redundant execution.

Diff:
---
 .../libgomp.oacc-fortran/privatized-ref-2.f90      | 42 ++++++++++++++++------
 1 file changed, 32 insertions(+), 10 deletions(-)

diff --git a/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
index f4a6af986e8..6bd17148911 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
@@ -53,12 +53,10 @@ contains
     integer :: array(nn)
 
     !$acc parallel copyout(array) ! { dg-line l_compute[incr c_compute] }
-    ! { dg-note {variable 'atmp\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
-    ! { dg-note {variable 'shadow_loopvar\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
-    ! { dg-note {variable 'offset\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     ! { dg-note {variable 'S\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
-    ! { dg-note {variable 'test\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     array = [(-i, i = 1, nn)]
+    !$acc end parallel
+    !$acc parallel copy(array)
     !$acc loop gang private(array) ! { dg-line l_loop[incr c_loop] }
     ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
     ! { dg-note {variable 'array' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "" { target *-*-* } l_loop$c_loop }
@@ -66,6 +64,13 @@ contains
     do i = 1, 10
       array(i) = i
     end do
+    !$acc end parallel
+    !$acc parallel copyin(array) ! { dg-line l_compute[incr c_compute] }
+    ! { dg-note {variable 'test\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'atmp\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'shadow_loopvar\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'offset\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'S\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     if (any (array /= [(-i, i = 1, nn)])) error stop 1
     !$acc end parallel
   end subroutine foo
@@ -74,14 +79,10 @@ contains
     integer :: array(:)
 
     !$acc parallel copyout(array) ! { dg-line l_compute[incr c_compute] }
-    ! { dg-note {variable 'atmp\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
-    ! { dg-note {variable 'shadow_loopvar\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
-    ! { dg-note {variable 'offset\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     ! { dg-note {variable 'S\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
-    ! { dg-note {variable 'test\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
-    ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
-    ! { dg-note {variable 'A\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: static} "" { target *-*-* } l_compute$c_compute }
     array = [(-2*i, i = 1, size(array))]
+    !$acc end parallel
+    !$acc parallel copy(array)
     !$acc loop gang private(array) ! { dg-line l_loop[incr c_loop] }
     ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
     ! { dg-note {variable 'array\.[0-9]+' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
@@ -91,6 +92,11 @@ contains
     do i = 1, 10
       array(i) = 9*i
     end do
+    !$acc end parallel
+    !$acc parallel copyin(array) ! { dg-line l_compute[incr c_compute] }
+    ! { dg-note {variable 'test\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'A\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: static} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'S\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     if (any (array /= [(-2*i, i = 1, 10)])) error stop 2
     !$acc end parallel
   end subroutine bar
@@ -100,6 +106,8 @@ contains
 
     !$acc parallel copyout(str)
     str = "abcdefghij"
+    !$acc end parallel
+    !$acc parallel copy(str)
     !$acc loop gang private(str) ! { dg-line l_loop[incr c_loop] }
     ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
     ! { dg-note {variable 'str' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "" { target *-*-* } l_loop$c_loop }
@@ -110,6 +118,8 @@ contains
     do i = 1, 10
       str(i:i) = achar(ichar('A') + i)
     end do
+    !$acc end parallel
+    !$acc parallel copyin(str)
     if (str /= "abcdefghij") error stop 3
     !$acc end parallel
   end
@@ -122,10 +132,14 @@ contains
 ! ***************************************
     !!$acc parallel copyout(str)
     str = "abcdefghij"
+    !!$acc end parallel
+    !!$acc parallel copy(str)
     !!$acc loop gang private(str)
     !do i = 1, 10
     !  str(i:i) = achar(ichar('A') + i)
     !end do
+    !!$acc end parallel
+    !!$acc parallel copyin(str)
     if (str /= "abcdefghij") error stop 5
     !!$acc end parallel
   end
@@ -135,6 +149,8 @@ contains
 
     !$acc parallel copyout(scalar)
     scalar = "abcdefghi-12345"
+    !$acc end parallel
+    !$acc parallel copy(scalar)
     !$acc loop gang private(scalar) ! { dg-line l_loop[incr c_loop] }
     ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
     ! { dg-note {variable 'scalar' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "" { target *-*-* } l_loop$c_loop }
@@ -145,7 +161,9 @@ contains
       scalar(i:i) = achar(ichar('A') + i)
     end do
     !$acc end parallel
+    !$acc parallel copyin(scalar)
     if (scalar /= "abcdefghi-12345") error stop 6
+    !$acc end parallel
   end subroutine foobar
   subroutine foobar15 (scalar)
     integer :: i
@@ -153,11 +171,15 @@ contains
 
     !$acc parallel copyout(scalar)
     scalar = "abcdefghi-12345"
+    !$acc end parallel
+    !$acc parallel copy(scalar)
     !$acc loop gang private(scalar)
     do i = 1, 15
       scalar(i:i) = achar(ichar('A') + i)
     end do
     !$acc end parallel
+    !$acc parallel copyin(scalar)
     if (scalar /= "abcdefghi-12345") error stop 1
+    !$acc end parallel
   end subroutine foobar15
 end


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-22 16:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 16:32 [gcc r12-7347] Fix OpenACC gang-redundant execution in 'libgomp.oacc-fortran/privatized-ref-2.f90' Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).