aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2022-01-21 14:58:23 +0100
committerThomas Schwinge <thomas@codesourcery.com>2022-02-22 17:32:03 +0100
commitf8187b5c0d22723c8e0a3d13d0ea5dd7ecfeff75 (patch)
tree4b94026737aa83f6aff809f3aab56df8fe95aadf /libgomp
parent537c96588026aec09b9a00d6d0f3670f612428b5 (diff)
downloadgcc-f8187b5c0d22723c8e0a3d13d0ea5dd7ecfeff75.zip
gcc-f8187b5c0d22723c8e0a3d13d0ea5dd7ecfeff75.tar.gz
gcc-f8187b5c0d22723c8e0a3d13d0ea5dd7ecfeff75.tar.bz2
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.
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f9042
1 files 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 f4a6af9..6bd1714 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