public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] [OG10] Xfail libgomp.oacc-fortran/privatized-ref-2.f90 when offloading to nvptx
@ 2020-09-16 17:34 ` Kwok Cheung Yeung
       [not found]   ` <0968ff25a4dc4d9895682ce0669345c5@svr-orw-mbx-02.mgc.mentorg.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Kwok Cheung Yeung @ 2020-09-16 17:34 UTC (permalink / raw)
  To: GCC Patches, Thomas Schwinge, Tobias Burnus

[-- Attachment #1: Type: text/plain, Size: 227 bytes --]

Hello

I have committed this patch to xfail libgomp.oacc-fortran/privatized-ref-2.f90 
when the offload target is nvptx, as the generated code has some alloca calls 
which are currently not supported by nvptx (PR65181).

Kwok


[-- Attachment #2: alloca_xfail.patch --]
[-- Type: text/plain, Size: 1459 bytes --]

commit 1245f6f615fa08d2ab4165598c9db72c4dad4467
Author: Kwok Cheung Yeung <kcy@codesourcery.com>
Date:   Wed Sep 16 10:19:35 2020 -0700

    XFAIL libgomp.oacc-fortran/privatized-ref-2.f90 on nvptx
    
    The testcase uses alloca, which is not currently supported on nvptx
    (see PR65181).
    
    2020-09-16  Kwok Cheung Yeung  <kcy@codesourcery.com>
    
    	libgomp/
    	* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: XFAIL on nvptx.

diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 6e313aa..890a4e2 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,5 +1,9 @@
 2020-09-16  Kwok Cheung Yeung  <kcy@codesourcery.com>
 
+	* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: XFAIL on nvptx.
+
+2020-09-16  Kwok Cheung Yeung  <kcy@codesourcery.com>
+
 	* testsuite/libgomp.oacc-c++/privatized-ref-2.C (workers, vectors):
 	Reduce number of workers to 16.
 	* testsuite/libgomp.oacc-c++/privatized-ref-3.C (workers, vectors):
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
index ca8fbe8..658ab9e 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
@@ -1,4 +1,5 @@
 ! { dg-do run }
+! { dg-xfail-if "no alloca support" { offload_target_nvptx } }
 
 program main
   implicit none (type, external)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Add 'libgomp.oacc-fortran/privatized-ref-2.f90'
       [not found]   ` <0968ff25a4dc4d9895682ce0669345c5@svr-orw-mbx-02.mgc.mentorg.com>
@ 2021-05-21 14:28     ` Thomas Schwinge
  2022-02-22 16:39       ` Fix OpenACC gang-redundant execution in 'libgomp.oacc-fortran/privatized-ref-2.f90' (was: Add 'libgomp.oacc-fortran/privatized-ref-2.f90') Thomas Schwinge
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Schwinge @ 2021-05-21 14:28 UTC (permalink / raw)
  To: Tobias Burnus, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2557 bytes --]

Hi!

This came into existance internally, when the og10 branch was set up.

On 2020-06-03T17:23:51+0200, Tobias Burnus <Tobias_Burnus@mentor.com> wrote:
> This fixes [...] on OG10 (og10_prerelease); it will be
> later applied to gcn/… to fix the issue. (Upstream is unaffected.)
> [...]

However, that means that your testcase does work on master branch (and
would regress if certain commits got pushed there).  As the testcase has
got a property useful for a thing I'm currently working on, I've pushed
to master branch "Add 'libgomp.oacc-fortran/privatized-ref-2.f90'" in
commit 61796dc03befa9b7426d5bc7c336cca585944143, and "Don't skip
'libgomp.oacc-fortran/privatized-ref-2.f90' for nvptx offloading" in
commit 5d42db533324e80a7382b20b94cace5b202d41ea, see attached.


I confirm that "FIXME: Fails due to PR middle-end/95499" is still a
problem.

And, GCC '-O' reports:

    [...]/libgomp.oacc-fortran/privatized-ref-2.f90:147:21:

      147 |   subroutine foobar15 (scalar)
          |                     ^
    Warning: ‘foobar15’ defined but not used [-Wunused-function]
    [...]/libgomp.oacc-fortran/privatized-ref-2.f90: In function ‘MAIN__’:
    [...]/libgomp.oacc-fortran/privatized-ref-2.f90:31:22: warning: ‘a.offset’ is used uninitialized [-Wuninitialized]
       31 |   A = [(3*j, j=1, 10)]
          |                      ^
    [...]/libgomp.oacc-fortran/privatized-ref-2.f90:27:30: note: ‘a’ declared here
       27 |   integer, allocatable :: A(:)
          |                              ^
    [...]/libgomp.oacc-fortran/privatized-ref-2.f90:31:22: warning: ‘a.dim[0].lbound’ is used uninitialized [-Wuninitialized]
       31 |   A = [(3*j, j=1, 10)]
          |                      ^
    [...]/libgomp.oacc-fortran/privatized-ref-2.f90:27:30: note: ‘a’ declared here
       27 |   integer, allocatable :: A(:)
          |                              ^
    [...]/libgomp.oacc-fortran/privatized-ref-2.f90:31:22: warning: ‘a.dim[0].ubound’ is used uninitialized [-Wuninitialized]
       31 |   A = [(3*j, j=1, 10)]
          |                      ^
    [...]/libgomp.oacc-fortran/privatized-ref-2.f90:27:30: note: ‘a’ declared here
       27 |   integer, allocatable :: A(:)
          |                              ^

I haven't looked into these.


Grüße
 Thomas


-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-libgomp.oacc-fortran-privatized-ref-2.f90.patch --]
[-- Type: text/x-diff, Size: 3487 bytes --]

From 61796dc03befa9b7426d5bc7c336cca585944143 Mon Sep 17 00:00:00 2001
From: Tobias Burnus <tobias@codesourcery.com>
Date: Wed, 3 Jun 2020 15:35:12 +0200
Subject: [PATCH 1/2] Add 'libgomp.oacc-fortran/privatized-ref-2.f90'

	libgomp/
	* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: New.
---
 .../libgomp.oacc-fortran/privatized-ref-2.f90 | 101 ++++++++++++++++++
 1 file changed, 101 insertions(+)
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90

diff --git a/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
new file mode 100644
index 00000000000..6c3e1dcc211
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
@@ -0,0 +1,101 @@
+! { dg-do run { target { ! openacc_nvidia_accel_selected } } }
+
+program main
+  implicit none (type, external)
+  integer :: j
+  integer, allocatable :: A(:)
+  character(len=:), allocatable :: my_str
+  character(len=15), allocatable :: my_str15
+
+  A = [(3*j, j=1, 10)]
+  call foo (A, size(A))
+  call bar (A)
+  my_str = "1234567890"
+  call foo_str(my_str)
+  call bar_str(my_str)
+  my_str15 = "123456789012345"
+  call foobar (my_str15)
+  deallocate (A, my_str, my_str15)
+contains
+  subroutine foo (array, nn)
+    integer :: i, nn
+    integer :: array(nn)
+
+    !$acc parallel copyout(array)
+    array = [(-i, i = 1, nn)]
+    !$acc loop gang private(array)
+    do i = 1, 10
+      array(i) = i
+    end do
+    if (any (array /= [(-i, i = 1, nn)])) error stop 1
+    !$acc end parallel
+  end subroutine foo
+  subroutine bar (array)
+    integer :: i
+    integer :: array(:)
+
+    !$acc parallel copyout(array)
+    array = [(-2*i, i = 1, size(array))]
+    !$acc loop gang private(array)
+    do i = 1, 10
+      array(i) = 9*i
+    end do
+    if (any (array /= [(-2*i, i = 1, 10)])) error stop 2
+    !$acc end parallel
+  end subroutine bar
+  subroutine foo_str(str)
+    integer :: i
+    character(len=*) :: str
+
+    !$acc parallel copyout(str)
+    str = "abcdefghij"
+    !$acc loop gang private(str)
+    do i = 1, 10
+      str(i:i) = achar(ichar('A') + i)
+    end do
+    if (str /= "abcdefghij") error stop 3
+    !$acc end parallel
+  end
+  subroutine bar_str(str)
+    integer :: i
+    character(len=:), allocatable :: str
+
+! ***************************************
+! FIXME: Fails due to PR middle-end/95499
+! ***************************************
+    !!$acc parallel copyout(str)
+    str = "abcdefghij"
+    !!$acc loop gang private(str)
+    !do i = 1, 10
+    !  str(i:i) = achar(ichar('A') + i)
+    !end do
+    if (str /= "abcdefghij") error stop 5
+    !!$acc end parallel
+  end
+  subroutine foobar (scalar)
+    integer :: i
+    character(len=15), optional :: scalar
+
+    !$acc parallel copyout(scalar)
+    scalar = "abcdefghi-12345"
+    !$acc loop gang private(scalar)
+    do i = 1, 15
+      scalar(i:i) = achar(ichar('A') + i)
+    end do
+    !$acc end parallel
+    if (scalar /= "abcdefghi-12345") error stop 6
+  end subroutine foobar
+  subroutine foobar15 (scalar)
+    integer :: i
+    character(len=15), optional, allocatable :: scalar
+
+    !$acc parallel copyout(scalar)
+    scalar = "abcdefghi-12345"
+    !$acc loop gang private(scalar)
+    do i = 1, 15
+      scalar(i:i) = achar(ichar('A') + i)
+    end do
+    !$acc end parallel
+    if (scalar /= "abcdefghi-12345") error stop 1
+  end subroutine foobar15
+end
-- 
2.30.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Don-t-skip-libgomp.oacc-fortran-privatized-ref-2.f90.patch --]
[-- Type: text/x-diff, Size: 2317 bytes --]

From 5d42db533324e80a7382b20b94cace5b202d41ea Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Fri, 21 May 2021 09:03:43 +0200
Subject: [PATCH 2/2] Don't skip 'libgomp.oacc-fortran/privatized-ref-2.f90'
 for nvptx offloading

	libgomp/
	* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Don't skip
	for nvptx offloading.
---
 .../libgomp.oacc-fortran/privatized-ref-2.f90        | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
index 6c3e1dcc211..907f0245f93 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
@@ -1,4 +1,11 @@
-! { dg-do run { target { ! openacc_nvidia_accel_selected } } }
+! { dg-do run }
+
+! PR65181 "Support for alloca in nvptx"
+! { dg-excess-errors "lto1, mkoffload and lto-wrapper fatal errors" { target openacc_nvidia_accel_selected } }
+! Aside from restricting this testcase to non-nvptx offloading, and duplicating
+! it with 'dg-do link' for nvptx offloading, there doesn't seem to be a way to
+! XFAIL the "UNRESOLVED: [...] compilation failed to produce executable", or
+! get rid of it, unfortunately.
 
 program main
   implicit none (type, external)
@@ -24,6 +31,7 @@ contains
     !$acc parallel copyout(array)
     array = [(-i, i = 1, nn)]
     !$acc loop gang private(array)
+    ! { dg-message {sorry, unimplemented: target cannot support alloca} PR65181 { target openacc_nvidia_accel_selected } .-1 }
     do i = 1, 10
       array(i) = i
     end do
@@ -37,6 +45,7 @@ contains
     !$acc parallel copyout(array)
     array = [(-2*i, i = 1, size(array))]
     !$acc loop gang private(array)
+    ! { dg-message {sorry, unimplemented: target cannot support alloca} PR65181 { target openacc_nvidia_accel_selected } .-1 }
     do i = 1, 10
       array(i) = 9*i
     end do
@@ -50,6 +59,7 @@ contains
     !$acc parallel copyout(str)
     str = "abcdefghij"
     !$acc loop gang private(str)
+    ! { dg-message {sorry, unimplemented: target cannot support alloca} PR65181 { target openacc_nvidia_accel_selected } .-1 }
     do i = 1, 10
       str(i:i) = achar(ichar('A') + i)
     end do
-- 
2.30.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Fix OpenACC gang-redundant execution in 'libgomp.oacc-fortran/privatized-ref-2.f90' (was: Add 'libgomp.oacc-fortran/privatized-ref-2.f90')
  2021-05-21 14:28     ` Add 'libgomp.oacc-fortran/privatized-ref-2.f90' Thomas Schwinge
@ 2022-02-22 16:39       ` Thomas Schwinge
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Schwinge @ 2022-02-22 16:39 UTC (permalink / raw)
  To: Tobias Burnus, gcc-patches; +Cc: Andrew Stubbs

[-- Attachment #1: Type: text/plain, Size: 4267 bytes --]

Hi!

On 2021-05-21T16:28:57+0200, I wrote:
> This came into existance internally, when the og10 branch was set up.
>
> On 2020-06-03T17:23:51+0200, Tobias Burnus <Tobias_Burnus@mentor.com> wrote:
>> This fixes [...] on OG10 (og10_prerelease); it will be
>> later applied to gcn/… to fix the issue. (Upstream is unaffected.)
>> [...]
>
> However, that means that your testcase does work on master branch (and
> would regress if certain commits got pushed there).  As the testcase has
> got a property useful for a thing I'm currently working on, I've pushed
> to master branch "Add 'libgomp.oacc-fortran/privatized-ref-2.f90'" in
> commit 61796dc03befa9b7426d5bc7c336cca585944143

After commit a78b1ab1df9ca44acc5638e8f9d0ae2e62bd65ed
"amdgcn: Tune default OpenMP/OpenACC GPU utilization", we'd seen this
test case regress (only) on our AMD GPU amd-instinct1/'-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.  Nothing more in 'libgomp.log'.

I have determined this is a latent problem in the original test case,
which contains a few instances of code as follows:

    !$acc parallel copyout(array)
    array = [(-i, i = 1, nn)]
    !$acc loop gang private(array)
    do i = 1, 10
      array(i) = i
    end do
    if (any (array /= [(-i, i = 1, nn)])) error stop 1
    !$acc end parallel

Given the '!$acc loop gang', the whole containing '!$acc parallel' region
is launched with gang parallelism.  The '!$acc loop gang' executes in
gang-partitioned mode, but the 'array' assignment before and checks after
don't execute in a (hypothetical) gang-single mode, but instead in
gang-redundant mode, meaning that each gang executes these concurrently,
giving rise to data races and other mischief.  Thus, we have to 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)'.  Pushed to master branch
commit f8187b5c0d22723c8e0a3d13d0ea5dd7ecfeff75 "Fix OpenACC
gang-redundant execution in 'libgomp.oacc-fortran/privatized-ref-2.f90'",
see attached.


Grüße
 Thomas


> I confirm that "FIXME: Fails due to PR middle-end/95499" is still a
> problem.
>
> And, GCC '-O' reports:
>
>     [...]/libgomp.oacc-fortran/privatized-ref-2.f90:147:21:
>
>       147 |   subroutine foobar15 (scalar)
>           |                     ^
>     Warning: ‘foobar15’ defined but not used [-Wunused-function]
>     [...]/libgomp.oacc-fortran/privatized-ref-2.f90: In function ‘MAIN__’:
>     [...]/libgomp.oacc-fortran/privatized-ref-2.f90:31:22: warning: ‘a.offset’ is used uninitialized [-Wuninitialized]
>        31 |   A = [(3*j, j=1, 10)]
>           |                      ^
>     [...]/libgomp.oacc-fortran/privatized-ref-2.f90:27:30: note: ‘a’ declared here
>        27 |   integer, allocatable :: A(:)
>           |                              ^
>     [...]/libgomp.oacc-fortran/privatized-ref-2.f90:31:22: warning: ‘a.dim[0].lbound’ is used uninitialized [-Wuninitialized]
>        31 |   A = [(3*j, j=1, 10)]
>           |                      ^
>     [...]/libgomp.oacc-fortran/privatized-ref-2.f90:27:30: note: ‘a’ declared here
>        27 |   integer, allocatable :: A(:)
>           |                              ^
>     [...]/libgomp.oacc-fortran/privatized-ref-2.f90:31:22: warning: ‘a.dim[0].ubound’ is used uninitialized [-Wuninitialized]
>        31 |   A = [(3*j, j=1, 10)]
>           |                      ^
>     [...]/libgomp.oacc-fortran/privatized-ref-2.f90:27:30: note: ‘a’ declared here
>        27 |   integer, allocatable :: A(:)
>           |                              ^
>
> I haven't looked into these.
>
>
> Grüße
>  Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-OpenACC-gang-redundant-execution-in-libgomp.oacc.patch --]
[-- Type: text/x-diff, Size: 9289 bytes --]

From f8187b5c0d22723c8e0a3d13d0ea5dd7ecfeff75 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Fri, 21 Jan 2022 14:58:23 +0100
Subject: [PATCH] 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.
---
 .../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
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-22 16:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <fc0dfbcc-0f5a-e63d-3943-80fb7b7cf03e@mentor.com>
2020-09-16 17:34 ` [PATCH] [OG10] Xfail libgomp.oacc-fortran/privatized-ref-2.f90 when offloading to nvptx Kwok Cheung Yeung
     [not found]   ` <0968ff25a4dc4d9895682ce0669345c5@svr-orw-mbx-02.mgc.mentorg.com>
2021-05-21 14:28     ` Add 'libgomp.oacc-fortran/privatized-ref-2.f90' Thomas Schwinge
2022-02-22 16:39       ` Fix OpenACC gang-redundant execution in 'libgomp.oacc-fortran/privatized-ref-2.f90' (was: Add '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).