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: Nested OpenACC/OpenMP constructs


Hi!

On Wed, 10 Dec 2014 11:16:08 +0100, Jakub Jelinek <jakub@redhat.com> wrote:
> On Wed, Dec 10, 2014 at 11:10:19AM +0100, Thomas Schwinge wrote:
> > --- /dev/null
> > +++ gcc/testsuite/c-c++-common/gomp/nesting-1.c
> > @@ -0,0 +1,77 @@
> > +void
> > +f_omp_parallel (void)
> > +{
> > +#pragma omp parallel
> > +  {
> > +    int i;
> 
> Can you please use a global variable declared outside of
> f_omp_parallel instead?
> 
> > +
> > +#pragma omp parallel
> > +    ;
> > +
> > +#pragma omp target
> > +    ;
> > +
> > +#pragma omp target data
> > +    ;
> > +
> > +#pragma omp target update to(i)
> 
> The thing is, if GCC tried harder, it could complain here,
> because i can't really be mapped at this point and thus it would be always
> undefined behavior.  If the var is global, it is possible
> somebody uses
>   #pragma omp target map(i)
>   f_omp_parallel ();
> and then it would be valid.

That makes sense, thanks.

> Similarly in other tests.

Will change on gomp-4_0-branch.

> Otherwise LGTM.

Committed to trunk in r218687:

commit 4c37888fdc6548eba74aa0d652e37b33dd097aea
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Dec 12 20:01:29 2014 +0000

    OpenMP target nesting tests.
    
    	gcc/testsuite/
    	* c-c++-common/gomp/nesting-1.c: New file.
    	* c-c++-common/gomp/nesting-warn-1.c: Likewise.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218687 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/testsuite/ChangeLog                          |  5 ++
 gcc/testsuite/c-c++-common/gomp/nesting-1.c      | 75 ++++++++++++++++++++++++
 gcc/testsuite/c-c++-common/gomp/nesting-warn-1.c | 23 ++++++++
 3 files changed, 103 insertions(+)

diff --git gcc/testsuite/ChangeLog gcc/testsuite/ChangeLog
index 8e5b424..f2502ff 100644
--- gcc/testsuite/ChangeLog
+++ gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-12  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* c-c++-common/gomp/nesting-1.c: New file.
+	* c-c++-common/gomp/nesting-warn-1.c: Likewise.
+
 2014-12-12  Kai Tietz  <ktietz@redhat.com>
 
 	PR c++/63996
diff --git gcc/testsuite/c-c++-common/gomp/nesting-1.c gcc/testsuite/c-c++-common/gomp/nesting-1.c
new file mode 100644
index 0000000..711ff8e
--- /dev/null
+++ gcc/testsuite/c-c++-common/gomp/nesting-1.c
@@ -0,0 +1,75 @@
+extern int i;
+
+void
+f_omp_parallel (void)
+{
+#pragma omp parallel
+  {
+#pragma omp parallel
+    ;
+
+#pragma omp target
+    ;
+
+#pragma omp target data
+    ;
+
+#pragma omp target update to(i)
+
+#pragma omp target data
+    {
+#pragma omp parallel
+      ;
+
+#pragma omp target
+      ;
+
+#pragma omp target data
+      ;
+
+#pragma omp target update to(i)
+    }
+  }
+}
+
+void
+f_omp_target (void)
+{
+#pragma omp target
+  {
+#pragma omp parallel
+    ;
+  }
+}
+
+void
+f_omp_target_data (void)
+{
+#pragma omp target data
+  {
+#pragma omp parallel
+    ;
+
+#pragma omp target
+    ;
+
+#pragma omp target data
+    ;
+
+#pragma omp target update to(i)
+
+#pragma omp target data
+    {
+#pragma omp parallel
+      ;
+
+#pragma omp target
+      ;
+
+#pragma omp target data
+      ;
+
+#pragma omp target update to(i)
+    }
+  }
+}
diff --git gcc/testsuite/c-c++-common/gomp/nesting-warn-1.c gcc/testsuite/c-c++-common/gomp/nesting-warn-1.c
new file mode 100644
index 0000000..c39dd49
--- /dev/null
+++ gcc/testsuite/c-c++-common/gomp/nesting-warn-1.c
@@ -0,0 +1,23 @@
+extern int i;
+
+void
+f_omp_target (void)
+{
+#pragma omp target
+  {
+#pragma omp target /* { dg-warning "target construct inside of target region" } */
+    ;
+#pragma omp target data /* { dg-warning "target data construct inside of target region" } */
+    ;
+#pragma omp target update to(i) /* { dg-warning "target update construct inside of target region" } */
+
+#pragma omp parallel
+    {
+#pragma omp target /* { dg-warning "target construct inside of target region" } */
+      ;
+#pragma omp target data /* { dg-warning "target data construct inside of target region" } */
+      ;
+#pragma omp target update to(i) /* { dg-warning "target update construct inside of target region" } */
+    }
+  }
+}


GrÃÃe,
 Thomas

Attachment: pgpnFIjrMdZTw.pgp
Description: PGP signature


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