diff mbox

OpenACC 2.5 default (present) clause

Message ID 87d1ch4w2r.fsf@hertz.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge April 12, 2017, 1:03 p.m. UTC
Hi!

On Fri, 07 Apr 2017 17:08:55 +0200, I wrote:
> OpenACC 2.5 added a default (present) clause, which "causes all arrays or
> variables of aggregate data type used in the compute construct that have
> implicitly determined data attributes to be treated as if they appeared
> in a present clause".  Preceded by the following cleanup patch (see
> <https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00377.html> for its
> origin), OK for trunk in next stage 1?

(Jakub asked me to ping this in next stage 1.)

> For now committed to gomp-4_0-branch in r246763:

> --- libgomp/testsuite/libgomp.oacc-c-c++-common/nested-2.c
> +++ libgomp/testsuite/libgomp.oacc-c-c++-common/nested-2.c

> +#pragma acc enter data create (a)
> +
> +#pragma acc parallel default (present)
> +    {
> +      for (int j = 0; j < N; ++j)
> +	a[j] = j - 1;
> +    }
> +
> +#pragma acc update host (a)
> +
> +    for (i = 0; i < N; ++i)
> +      {
> +        if (a[i] != i - 1)
> +	  abort ();
> +      }
> +
> +#pragma acc kernels default (present)
> +    {
> +      for (int j = 0; j < N; ++j)
> +	a[j] = j - 2;
> +    }
> +
> +#pragma acc exit data copyout (a)
> +
> +    for (i = 0; i < N; ++i)
> +      {
> +        if (a[i] != i - 2)
> +	  abort ();
> +      }

In our PowerPC testing, this change triggered linking failures (for host
comilation) and ICEs (for offloading compilation).
<https://gcc.gnu.org/PR80411> "DCE vs. offloading" filed (here, we got:
"char a[N]", causing GCC to figure out that "(char) -1 != (int) -1", thus
unconditionally "abort", thus the following OpenACC kernels getting DCEd,
thus PR80411), and committed to gomp-4_0-branch in r246871:

commit 6cf38f5ba09e4152336cf94d0eb9c80db9ffc024
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Apr 12 12:54:10 2017 +0000

    Fix libgomp.oacc-c-c++-common/nested-2.c: "char" might mean "unsigned char"
    
            libgomp/
            * testsuite/libgomp.oacc-c-c++-common/nested-2.c: Respect that
            "char" might mean "unsigned char".
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@246871 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp                                 | 5 +++++
 libgomp/testsuite/libgomp.oacc-c-c++-common/nested-2.c | 8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)



Grüße
 Thomas
diff mbox

Patch

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 873668e..32cb7e8 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,3 +1,8 @@ 
+2017-04-12  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* testsuite/libgomp.oacc-c-c++-common/nested-2.c: Respect that
+	"char" might mean "unsigned char".
+
 2017-04-07  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* testsuite/libgomp.oacc-c++/template-reduction.C: Update.
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/nested-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/nested-2.c
index e8ead3d..51b3b18 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/nested-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/nested-2.c
@@ -143,28 +143,28 @@  main (int argc, char *argv[])
 #pragma acc parallel default (present)
     {
       for (int j = 0; j < N; ++j)
-	a[j] = j - 1;
+	a[j] = j + 1;
     }
 
 #pragma acc update host (a)
 
     for (i = 0; i < N; ++i)
       {
-        if (a[i] != i - 1)
+        if (a[i] != i + 1)
 	  abort ();
       }
 
 #pragma acc kernels default (present)
     {
       for (int j = 0; j < N; ++j)
-	a[j] = j - 2;
+	a[j] = j + 2;
     }
 
 #pragma acc exit data copyout (a)
 
     for (i = 0; i < N; ++i)
       {
-        if (a[i] != i - 2)
+        if (a[i] != i + 2)
 	  abort ();
       }