public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Also test -O0 for OpenACC C, C++ offloading test cases
@ 2016-03-22 12:14 Thomas Schwinge
  2016-03-22 13:04 ` Thomas Schwinge
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Thomas Schwinge @ 2016-03-22 12:14 UTC (permalink / raw)
  To: gcc-patches, Jakub Jelinek

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

Hi!

As discussed in
<http://news.gmane.org/find-root.php?message_id=%3C87oaj3z280.fsf%40schwinge.name%3E>
(and similar to what we're already doing for Fortran, and similar to what
recently got committed to libgomp/testsuite/libgomp.hsa.c/c.exp), it has
been helpful to also run C, C++ offloading test cases with -O0 in
addition to the -O2 default.  Making my earlier gomp-4_0-branch patch
conceptually simpler, I came up with the following; OK for trunk?

commit 879c8f6dcb9dad514fb3bf11c721fed37b6574be
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Tue Mar 22 10:26:19 2016 +0100

    Also test -O0 for OpenACC C, C++ offloading test cases
    
    	libgomp/
    	* testsuite/libgomp.oacc-c++/c++.exp: Set up torture testing, use
    	gcc-dg-runtest.
    	* testsuite/libgomp.oacc-c/c.exp: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c: Specify
    	-fno-builtin-acc_on_device instead of -O0.
    	* testsuite/libgomp.oacc-c-c++-common/acc-on-device.c: Skip for
    	-O0.
    	* testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c:
    	Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-g-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-g-2.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-v-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-w-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/routine-g-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/routine-v-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/routine-w-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c:
    	Don't specify -O2.
    	* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c:
    	Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c:
    	Likewise.
---
 libgomp/testsuite/libgomp.oacc-c++/c++.exp         | 29 +++++++++++++++++-----
 .../libgomp.oacc-c-c++-common/acc-on-device-2.c    |  5 ++--
 .../libgomp.oacc-c-c++-common/acc-on-device.c      |  3 ++-
 .../kernels-alias-ipa-pta-2.c                      |  2 +-
 .../kernels-alias-ipa-pta-3.c                      |  2 +-
 .../kernels-alias-ipa-pta.c                        |  2 +-
 .../libgomp.oacc-c-c++-common/loop-auto-1.c        |  4 ++-
 .../libgomp.oacc-c-c++-common/loop-dim-default.c   |  6 +++--
 .../testsuite/libgomp.oacc-c-c++-common/loop-g-1.c |  5 ++--
 .../testsuite/libgomp.oacc-c-c++-common/loop-g-2.c |  5 ++--
 .../libgomp.oacc-c-c++-common/loop-gwv-1.c         |  5 ++--
 .../libgomp.oacc-c-c++-common/loop-red-g-1.c       |  5 ++--
 .../libgomp.oacc-c-c++-common/loop-red-gwv-1.c     |  5 ++--
 .../libgomp.oacc-c-c++-common/loop-red-v-1.c       |  5 ++--
 .../libgomp.oacc-c-c++-common/loop-red-v-2.c       |  5 ++--
 .../libgomp.oacc-c-c++-common/loop-red-w-1.c       |  5 ++--
 .../libgomp.oacc-c-c++-common/loop-red-w-2.c       |  5 ++--
 .../testsuite/libgomp.oacc-c-c++-common/loop-v-1.c |  5 ++--
 .../testsuite/libgomp.oacc-c-c++-common/loop-w-1.c |  5 ++--
 .../libgomp.oacc-c-c++-common/loop-wv-1.c          |  5 ++--
 .../libgomp.oacc-c-c++-common/routine-g-1.c        |  5 ++--
 .../libgomp.oacc-c-c++-common/routine-gwv-1.c      |  5 ++--
 .../libgomp.oacc-c-c++-common/routine-v-1.c        |  5 ++--
 .../libgomp.oacc-c-c++-common/routine-w-1.c        |  5 ++--
 .../libgomp.oacc-c-c++-common/routine-wv-1.c       |  5 ++--
 libgomp/testsuite/libgomp.oacc-c/c.exp             | 29 +++++++++++++++++-----
 26 files changed, 111 insertions(+), 56 deletions(-)

diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
index 88b0269..bbdbe2f 100644
--- libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -2,6 +2,7 @@
 
 load_lib libgomp-dg.exp
 load_gcc_lib gcc-dg.exp
+load_gcc_lib torture-options.exp
 
 global shlib_ext
 
@@ -13,13 +14,9 @@ if [info exists lang_include_flags] then {
     unset lang_include_flags
 }
 
-# If a testcase doesn't have special options, use these.
-if ![info exists DEFAULT_CFLAGS] then {
-    set DEFAULT_CFLAGS "-O2"
-}
-
 # Initialize dg.
 dg-init
+torture-init
 
 # Turn on OpenACC.
 lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
@@ -104,7 +101,26 @@ if { $lang_test_file_found } {
 
 	setenv ACC_DEVICE_TYPE $offload_target_openacc
 
-	dg-runtest $tests "$tagopt" "$libstdcxx_includes $DEFAULT_CFLAGS"
+	# To get better test coverage for device-specific code that is only
+	# ever used in offloading configurations, we'd like more thorough
+	# testing for test cases that deal with offloading, which most of all
+	# OpenACC test cases are.  We enable torture testing, but limit it to
+	# -O0 and -O2 only, to avoid testing times exploding too much, under
+	# the assumption that between -O0 and -O[something] there is the
+	# biggest difference in the overall structure of the generated code.
+	switch $offload_target_openacc {
+	    host {
+		set-torture-options [list \
+					 { -O2 } ]
+	    }
+	    default {
+		set-torture-options [list \
+					 { -O0 } \
+					 { -O2 } ]
+	    }
+	}
+
+	gcc-dg-runtest $tests "$tagopt" "$libstdcxx_includes"
     }
 }
 
@@ -112,4 +128,5 @@ if { $lang_test_file_found } {
 set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST"
 
 # All done.
+torture-finish
 dg-finish
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c
index e5d9c36..bfcb67d 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c
@@ -1,9 +1,8 @@
-/* { dg-additional-options "-O0" } */
+/* Test the acc_on_device library function. */
+/* { dg-additional-options "-fno-builtin-acc_on_device" } */
 
 #include <openacc.h>
 
-/* acc_on_device might not be folded at -O0, but it should work. */
-
 int main ()
 {
   int dev;
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c
index 88c000e..e0d8710 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
-/* { dg-additional-options "-O2" } */
+/* We don't expect this to work with optimizations disabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <openacc.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c
index 0f323c8..e8d65df 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-O2 -fipa-pta" } */
+/* { dg-additional-options "-fipa-pta" } */
 
 #include <stdlib.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c
index 654e750..dd8ca87 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-O2 -fipa-pta" } */
+/* { dg-additional-options "-fipa-pta" } */
 
 #include <stdlib.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c
index 44d4fd2..50e7dc1 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-O2 -fipa-pta" } */
+/* { dg-additional-options "-fipa-pta" } */
 
 #include <stdlib.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c
index 4922c9c..e44d26e 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c
@@ -1,5 +1,7 @@
 /* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 #include <openacc.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c
index 36b882f..80e4363 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c
@@ -1,5 +1,7 @@
-
-/* { dg-additional-options "-O2 -fopenacc-dim=16:16" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
+/* { dg-additional-options "-fopenacc-dim=16:16" } */
 
 #include <openacc.h>
 #include <alloca.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
index 23c2a75..0c8e9ff 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
index 1a93db3..2316ce3 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
index 26b2df9..e05573f 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
index c14bddd..17a27b1 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
index 3de8b09..4566568 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
index bae5c66..94c752f 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
index ada92e3..3c8b4b8 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
index 706d0d8..7616b19 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
index a073ac8..5f0a439 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
index b9ec95b..cdba658 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
index 539e41d..a65d535 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
index fcb9079..df1a9fc 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c
index 201dc72..b30424f 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
index 8fc4cb5..b1cdfd0 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c
index fefeb93..c49f643 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
index 01d1dc8..5806cb3 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c
index bd9f1df..49761ce 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
index 5020e6a..b509a10 100644
--- libgomp/testsuite/libgomp.oacc-c/c.exp
+++ libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -13,14 +13,11 @@ if [info exists lang_include_flags] then {
 
 load_lib libgomp-dg.exp
 load_gcc_lib gcc-dg.exp
-
-# If a testcase doesn't have special options, use these.
-if ![info exists DEFAULT_CFLAGS] then {
-    set DEFAULT_CFLAGS "-O2"
-}
+load_gcc_lib torture-options.exp
 
 # Initialize dg.
 dg-init
+torture-init
 
 # Turn on OpenACC.
 lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
@@ -67,8 +64,28 @@ foreach offload_target_openacc $offload_targets_s_openacc {
 
     setenv ACC_DEVICE_TYPE $offload_target_openacc
 
-    dg-runtest $tests "$tagopt" $DEFAULT_CFLAGS
+    # To get better test coverage for device-specific code that is only
+    # ever used in offloading configurations, we'd like more thorough
+    # testing for test cases that deal with offloading, which most of all
+    # OpenACC test cases are.  We enable torture testing, but limit it to
+    # -O0 and -O2 only, to avoid testing times exploding too much, under
+    # the assumption that between -O0 and -O[something] there is the
+    # biggest difference in the overall structure of the generated code.
+    switch $offload_target_openacc {
+	host {
+	    set-torture-options [list \
+				     { -O2 } ]
+	}
+	default {
+	    set-torture-options [list \
+				     { -O0 } \
+				     { -O2 } ]
+	}
+    }
+
+    gcc-dg-runtest $tests "$tagopt" ""
 }
 
 # All done.
+torture-finish
 dg-finish


Grüße
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

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

* Also test -O0 for OpenACC C, C++ offloading test cases
  2016-03-22 12:14 Also test -O0 for OpenACC C, C++ offloading test cases Thomas Schwinge
@ 2016-03-22 13:04 ` Thomas Schwinge
  2016-03-23  0:03 ` Bernd Schmidt
  2016-03-23 19:47 ` Also test -O0 for OpenACC C, C++ offloading test cases Jakub Jelinek
  2 siblings, 0 replies; 22+ messages in thread
From: Thomas Schwinge @ 2016-03-22 13:04 UTC (permalink / raw)
  To: gcc-patches, Jakub Jelinek

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

Hi!

As discussed in
<http://news.gmane.org/find-root.php?message_id=%3C87oaj3z280.fsf%40schwinge.name%3E>
(and similar to what we're already doing for Fortran, and similar to what
recently got committed to libgomp/testsuite/libgomp.hsa.c/c.exp), it has
been helpful to also run C, C++ offloading test cases with -O0 in
addition to the -O2 default.  Making my earlier gomp-4_0-branch patch
conceptually simpler, I came up with the following; OK for trunk?

commit 879c8f6dcb9dad514fb3bf11c721fed37b6574be
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Tue Mar 22 10:26:19 2016 +0100

    Also test -O0 for OpenACC C, C++ offloading test cases
    
    	libgomp/
    	* testsuite/libgomp.oacc-c++/c++.exp: Set up torture testing, use
    	gcc-dg-runtest.
    	* testsuite/libgomp.oacc-c/c.exp: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c: Specify
    	-fno-builtin-acc_on_device instead of -O0.
    	* testsuite/libgomp.oacc-c-c++-common/acc-on-device.c: Skip for
    	-O0.
    	* testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c:
    	Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-g-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-g-2.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-v-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-w-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/routine-g-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/routine-v-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/routine-w-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c:
    	Don't specify -O2.
    	* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c:
    	Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c:
    	Likewise.
---
 libgomp/testsuite/libgomp.oacc-c++/c++.exp         | 29 +++++++++++++++++-----
 .../libgomp.oacc-c-c++-common/acc-on-device-2.c    |  5 ++--
 .../libgomp.oacc-c-c++-common/acc-on-device.c      |  3 ++-
 .../kernels-alias-ipa-pta-2.c                      |  2 +-
 .../kernels-alias-ipa-pta-3.c                      |  2 +-
 .../kernels-alias-ipa-pta.c                        |  2 +-
 .../libgomp.oacc-c-c++-common/loop-auto-1.c        |  4 ++-
 .../libgomp.oacc-c-c++-common/loop-dim-default.c   |  6 +++--
 .../testsuite/libgomp.oacc-c-c++-common/loop-g-1.c |  5 ++--
 .../testsuite/libgomp.oacc-c-c++-common/loop-g-2.c |  5 ++--
 .../libgomp.oacc-c-c++-common/loop-gwv-1.c         |  5 ++--
 .../libgomp.oacc-c-c++-common/loop-red-g-1.c       |  5 ++--
 .../libgomp.oacc-c-c++-common/loop-red-gwv-1.c     |  5 ++--
 .../libgomp.oacc-c-c++-common/loop-red-v-1.c       |  5 ++--
 .../libgomp.oacc-c-c++-common/loop-red-v-2.c       |  5 ++--
 .../libgomp.oacc-c-c++-common/loop-red-w-1.c       |  5 ++--
 .../libgomp.oacc-c-c++-common/loop-red-w-2.c       |  5 ++--
 .../testsuite/libgomp.oacc-c-c++-common/loop-v-1.c |  5 ++--
 .../testsuite/libgomp.oacc-c-c++-common/loop-w-1.c |  5 ++--
 .../libgomp.oacc-c-c++-common/loop-wv-1.c          |  5 ++--
 .../libgomp.oacc-c-c++-common/routine-g-1.c        |  5 ++--
 .../libgomp.oacc-c-c++-common/routine-gwv-1.c      |  5 ++--
 .../libgomp.oacc-c-c++-common/routine-v-1.c        |  5 ++--
 .../libgomp.oacc-c-c++-common/routine-w-1.c        |  5 ++--
 .../libgomp.oacc-c-c++-common/routine-wv-1.c       |  5 ++--
 libgomp/testsuite/libgomp.oacc-c/c.exp             | 29 +++++++++++++++++-----
 26 files changed, 111 insertions(+), 56 deletions(-)

diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
index 88b0269..bbdbe2f 100644
--- libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -2,6 +2,7 @@
 
 load_lib libgomp-dg.exp
 load_gcc_lib gcc-dg.exp
+load_gcc_lib torture-options.exp
 
 global shlib_ext
 
@@ -13,13 +14,9 @@ if [info exists lang_include_flags] then {
     unset lang_include_flags
 }
 
-# If a testcase doesn't have special options, use these.
-if ![info exists DEFAULT_CFLAGS] then {
-    set DEFAULT_CFLAGS "-O2"
-}
-
 # Initialize dg.
 dg-init
+torture-init
 
 # Turn on OpenACC.
 lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
@@ -104,7 +101,26 @@ if { $lang_test_file_found } {
 
 	setenv ACC_DEVICE_TYPE $offload_target_openacc
 
-	dg-runtest $tests "$tagopt" "$libstdcxx_includes $DEFAULT_CFLAGS"
+	# To get better test coverage for device-specific code that is only
+	# ever used in offloading configurations, we'd like more thorough
+	# testing for test cases that deal with offloading, which most of all
+	# OpenACC test cases are.  We enable torture testing, but limit it to
+	# -O0 and -O2 only, to avoid testing times exploding too much, under
+	# the assumption that between -O0 and -O[something] there is the
+	# biggest difference in the overall structure of the generated code.
+	switch $offload_target_openacc {
+	    host {
+		set-torture-options [list \
+					 { -O2 } ]
+	    }
+	    default {
+		set-torture-options [list \
+					 { -O0 } \
+					 { -O2 } ]
+	    }
+	}
+
+	gcc-dg-runtest $tests "$tagopt" "$libstdcxx_includes"
     }
 }
 
@@ -112,4 +128,5 @@ if { $lang_test_file_found } {
 set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST"
 
 # All done.
+torture-finish
 dg-finish
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c
index e5d9c36..bfcb67d 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c
@@ -1,9 +1,8 @@
-/* { dg-additional-options "-O0" } */
+/* Test the acc_on_device library function. */
+/* { dg-additional-options "-fno-builtin-acc_on_device" } */
 
 #include <openacc.h>
 
-/* acc_on_device might not be folded at -O0, but it should work. */
-
 int main ()
 {
   int dev;
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c
index 88c000e..e0d8710 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
-/* { dg-additional-options "-O2" } */
+/* We don't expect this to work with optimizations disabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <openacc.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c
index 0f323c8..e8d65df 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-O2 -fipa-pta" } */
+/* { dg-additional-options "-fipa-pta" } */
 
 #include <stdlib.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c
index 654e750..dd8ca87 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-O2 -fipa-pta" } */
+/* { dg-additional-options "-fipa-pta" } */
 
 #include <stdlib.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c
index 44d4fd2..50e7dc1 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-O2 -fipa-pta" } */
+/* { dg-additional-options "-fipa-pta" } */
 
 #include <stdlib.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c
index 4922c9c..e44d26e 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c
@@ -1,5 +1,7 @@
 /* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 #include <openacc.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c
index 36b882f..80e4363 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c
@@ -1,5 +1,7 @@
-
-/* { dg-additional-options "-O2 -fopenacc-dim=16:16" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
+/* { dg-additional-options "-fopenacc-dim=16:16" } */
 
 #include <openacc.h>
 #include <alloca.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
index 23c2a75..0c8e9ff 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
index 1a93db3..2316ce3 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
index 26b2df9..e05573f 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
index c14bddd..17a27b1 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
index 3de8b09..4566568 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
index bae5c66..94c752f 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
index ada92e3..3c8b4b8 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
index 706d0d8..7616b19 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
index a073ac8..5f0a439 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
index b9ec95b..cdba658 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
index 539e41d..a65d535 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
index fcb9079..df1a9fc 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c
index 201dc72..b30424f 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
index 8fc4cb5..b1cdfd0 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c
index fefeb93..c49f643 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
index 01d1dc8..5806cb3 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c
index bd9f1df..49761ce 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* Dead code elimination for blocks guarded by acc_on_device () only works with
+   optimizations enabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
index 5020e6a..b509a10 100644
--- libgomp/testsuite/libgomp.oacc-c/c.exp
+++ libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -13,14 +13,11 @@ if [info exists lang_include_flags] then {
 
 load_lib libgomp-dg.exp
 load_gcc_lib gcc-dg.exp
-
-# If a testcase doesn't have special options, use these.
-if ![info exists DEFAULT_CFLAGS] then {
-    set DEFAULT_CFLAGS "-O2"
-}
+load_gcc_lib torture-options.exp
 
 # Initialize dg.
 dg-init
+torture-init
 
 # Turn on OpenACC.
 lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
@@ -67,8 +64,28 @@ foreach offload_target_openacc $offload_targets_s_openacc {
 
     setenv ACC_DEVICE_TYPE $offload_target_openacc
 
-    dg-runtest $tests "$tagopt" $DEFAULT_CFLAGS
+    # To get better test coverage for device-specific code that is only
+    # ever used in offloading configurations, we'd like more thorough
+    # testing for test cases that deal with offloading, which most of all
+    # OpenACC test cases are.  We enable torture testing, but limit it to
+    # -O0 and -O2 only, to avoid testing times exploding too much, under
+    # the assumption that between -O0 and -O[something] there is the
+    # biggest difference in the overall structure of the generated code.
+    switch $offload_target_openacc {
+	host {
+	    set-torture-options [list \
+				     { -O2 } ]
+	}
+	default {
+	    set-torture-options [list \
+				     { -O0 } \
+				     { -O2 } ]
+	}
+    }
+
+    gcc-dg-runtest $tests "$tagopt" ""
 }
 
 # All done.
+torture-finish
 dg-finish


Grüße
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

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

* Re: Also test -O0 for OpenACC C, C++ offloading test cases
  2016-03-22 12:14 Also test -O0 for OpenACC C, C++ offloading test cases Thomas Schwinge
  2016-03-22 13:04 ` Thomas Schwinge
@ 2016-03-23  0:03 ` Bernd Schmidt
  2016-03-23  7:35   ` Thomas Schwinge
  2016-03-23 19:47 ` Also test -O0 for OpenACC C, C++ offloading test cases Jakub Jelinek
  2 siblings, 1 reply; 22+ messages in thread
From: Bernd Schmidt @ 2016-03-23  0:03 UTC (permalink / raw)
  To: Thomas Schwinge, gcc-patches, Jakub Jelinek

On 03/22/2016 11:23 AM, Thomas Schwinge wrote:
> diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
> index 01d1dc8..5806cb3 100644
> --- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
> +++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
> @@ -1,5 +1,6 @@
> -/* { dg-do run } */
> -/* { dg-additional-options "-O2" } */
> +/* Dead code elimination for blocks guarded by acc_on_device () only works with
> +   optimizations enabled.
> +   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */

What exactly is going on with these? Do these tests fail with -O0, and 
is that likely to be a problem in practice?

Also, why remove the dg-do run?


Bernd

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

* Re: Also test -O0 for OpenACC C, C++ offloading test cases
  2016-03-23  0:03 ` Bernd Schmidt
@ 2016-03-23  7:35   ` Thomas Schwinge
  2016-03-23 19:19     ` Bernd Schmidt
  0 siblings, 1 reply; 22+ messages in thread
From: Thomas Schwinge @ 2016-03-23  7:35 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: gcc-patches, Jakub Jelinek, Nathan Sidwell

Hi!

On Tue, 22 Mar 2016 23:52:11 +0100, Bernd Schmidt <bschmidt@redhat.com> wrote:
> On 03/22/2016 11:23 AM, Thomas Schwinge wrote:
> > --- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
> > +++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
> > @@ -1,5 +1,6 @@
> > -/* { dg-do run } */
> > -/* { dg-additional-options "-O2" } */
> > +/* Dead code elimination for blocks guarded by acc_on_device () only works with
> > +   optimizations enabled.
> > +   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
> 
> What exactly is going on with these? Do these tests fail with -O0, and 
> is that likely to be a problem in practice?

Want me to re-word that?  :-| I thought it would be obvious from looking
at the test case code; will not be a problem in practice.  It's because
of constructs used in the test cases, like the following, for example:

    #pragma acc loop worker
      for (unsigned ix = 0; ix < N; ix++)
        {
          if (__builtin_acc_on_device (5))
            {
              int g = 0, w = 0, v = 0;
    
              __asm__ volatile ("mov.u32 %0,%%ctaid.x;" : "=r" (g));
              __asm__ volatile ("mov.u32 %0,%%tid.y;" : "=r" (w));
              __asm__ volatile ("mov.u32 %0,%%tid.x;" : "=r" (v));
              ary[ix] = (g << 16) | (w << 8) | v;
            }
          else
            ary[ix] = ix;
        }

Without optimizations, the target (x86_64) assembler will bail out seeing
the device (nvptx) inline assembly code, even if it's dead code always
because of the acc_on_device () conditional.

Long ago, my suggestion has been to have GCC provide builtin functions
for users to retrieve the number of gangs, workers, vectors, and the
current thread's IDs of these; not sure why Nathan didn't implement that?
(Should be easy to do -- want me to have a look at that, as a separate
patch?)


> Also, why remove the dg-do run?

Because that's the default anyway.


Grüße
 Thomas

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

* Re: Also test -O0 for OpenACC C, C++ offloading test cases
  2016-03-23  7:35   ` Thomas Schwinge
@ 2016-03-23 19:19     ` Bernd Schmidt
  2016-03-24 23:33       ` Thomas Schwinge
  0 siblings, 1 reply; 22+ messages in thread
From: Bernd Schmidt @ 2016-03-23 19:19 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches, Jakub Jelinek, Nathan Sidwell

On 03/23/2016 07:47 AM, Thomas Schwinge wrote:
> Want me to re-word that?  :-| I thought it would be obvious from looking
> at the test case code; will not be a problem in practice.  It's because
> of constructs used in the test cases, like the following, for example:

>            if (__builtin_acc_on_device (5))
>              {
>                int g = 0, w = 0, v = 0;
>
>                __asm__ volatile ("mov.u32 %0,%%ctaid.x;" : "=r" (g));
>                __asm__ volatile ("mov.u32 %0,%%tid.y;" : "=r" (w));
>                __asm__ volatile ("mov.u32 %0,%%tid.x;" : "=r" (v));
>                ary[ix] = (g << 16) | (w << 8) | v;

Ok, maybe write "This code uses nvptx assembly guarded with 
__builtin_acc_on_device, which fails to be optimized away at -O0."

Ok with something like that.


Bernd

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

* Re: Also test -O0 for OpenACC C, C++ offloading test cases
  2016-03-22 12:14 Also test -O0 for OpenACC C, C++ offloading test cases Thomas Schwinge
  2016-03-22 13:04 ` Thomas Schwinge
  2016-03-23  0:03 ` Bernd Schmidt
@ 2016-03-23 19:47 ` Jakub Jelinek
  2016-03-25  1:05   ` check-target-libgomp wall time, without vs. with offloading (was: Also test -O0 for OpenACC C, C++ offloading test cases) Thomas Schwinge
  2 siblings, 1 reply; 22+ messages in thread
From: Jakub Jelinek @ 2016-03-23 19:47 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches

On Tue, Mar 22, 2016 at 11:23:43AM +0100, Thomas Schwinge wrote:
> As discussed in
> <http://news.gmane.org/find-root.php?message_id=%3C87oaj3z280.fsf%40schwinge.name%3E>
> (and similar to what we're already doing for Fortran, and similar to what
> recently got committed to libgomp/testsuite/libgomp.hsa.c/c.exp), it has
> been helpful to also run C, C++ offloading test cases with -O0 in
> addition to the -O2 default.  Making my earlier gomp-4_0-branch patch
> conceptually simpler, I came up with the following; OK for trunk?

How big difference in make check-target-libgomp time is that?
Without PTX offloading I bet zero, but with PTX offloading configured, is it
10% or 50% slower?

	Jakub

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

* Re: Also test -O0 for OpenACC C, C++ offloading test cases
  2016-03-23 19:19     ` Bernd Schmidt
@ 2016-03-24 23:33       ` Thomas Schwinge
  2016-03-29 13:35         ` Thomas Schwinge
  2016-04-01  8:56         ` [gomp4] " Thomas Schwinge
  0 siblings, 2 replies; 22+ messages in thread
From: Thomas Schwinge @ 2016-03-24 23:33 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: gcc-patches, Jakub Jelinek, Nathan Sidwell

Hi!

On Wed, 23 Mar 2016 19:57:50 +0100, Bernd Schmidt <bschmidt@redhat.com> wrote:
> Ok with [...].

Thanks for the review; committed in r234471:

commit 02662647911b3296b07d7f4e3e3ed0200619da48
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Mar 24 21:29:55 2016 +0000

    Also test -O0 for OpenACC C, C++ offloading test cases
    
    	libgomp/
    	* testsuite/libgomp.oacc-c++/c++.exp: Set up torture testing, use
    	gcc-dg-runtest.
    	* testsuite/libgomp.oacc-c/c.exp: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c: Specify
    	-fno-builtin-acc_on_device instead of -O0.
    	* testsuite/libgomp.oacc-c-c++-common/acc-on-device.c: Skip for
    	-O0.
    	* testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c:
    	Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-g-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-g-2.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-v-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-w-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/routine-g-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/routine-v-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/routine-w-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c:
    	Don't specify -O2.
    	* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c:
    	Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c:
    	Likewise.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234471 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog                                  | 36 ++++++++++++++++++++++
 libgomp/testsuite/libgomp.oacc-c++/c++.exp         | 29 +++++++++++++----
 .../libgomp.oacc-c-c++-common/acc-on-device-2.c    |  5 ++-
 .../libgomp.oacc-c-c++-common/acc-on-device.c      |  3 +-
 .../kernels-alias-ipa-pta-2.c                      |  2 +-
 .../kernels-alias-ipa-pta-3.c                      |  2 +-
 .../kernels-alias-ipa-pta.c                        |  2 +-
 .../libgomp.oacc-c-c++-common/loop-auto-1.c        |  5 +--
 .../libgomp.oacc-c-c++-common/loop-dim-default.c   |  6 ++--
 .../testsuite/libgomp.oacc-c-c++-common/loop-g-1.c |  5 +--
 .../testsuite/libgomp.oacc-c-c++-common/loop-g-2.c |  5 +--
 .../libgomp.oacc-c-c++-common/loop-gwv-1.c         |  5 +--
 .../libgomp.oacc-c-c++-common/loop-red-g-1.c       |  5 +--
 .../libgomp.oacc-c-c++-common/loop-red-gwv-1.c     |  5 +--
 .../libgomp.oacc-c-c++-common/loop-red-v-1.c       |  5 +--
 .../libgomp.oacc-c-c++-common/loop-red-v-2.c       |  5 +--
 .../libgomp.oacc-c-c++-common/loop-red-w-1.c       |  5 +--
 .../libgomp.oacc-c-c++-common/loop-red-w-2.c       |  5 +--
 .../testsuite/libgomp.oacc-c-c++-common/loop-v-1.c |  5 +--
 .../testsuite/libgomp.oacc-c-c++-common/loop-w-1.c |  5 +--
 .../libgomp.oacc-c-c++-common/loop-wv-1.c          |  5 +--
 .../libgomp.oacc-c-c++-common/routine-g-1.c        |  5 +--
 .../libgomp.oacc-c-c++-common/routine-gwv-1.c      |  5 +--
 .../libgomp.oacc-c-c++-common/routine-v-1.c        |  5 +--
 .../libgomp.oacc-c-c++-common/routine-w-1.c        |  5 +--
 .../libgomp.oacc-c-c++-common/routine-wv-1.c       |  5 +--
 libgomp/testsuite/libgomp.oacc-c/c.exp             | 29 +++++++++++++----
 27 files changed, 147 insertions(+), 57 deletions(-)

diff --git libgomp/ChangeLog libgomp/ChangeLog
index 5f2c401..e0cd567 100644
--- libgomp/ChangeLog
+++ libgomp/ChangeLog
@@ -1,3 +1,39 @@
+2016-03-24  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* testsuite/libgomp.oacc-c++/c++.exp: Set up torture testing, use
+	gcc-dg-runtest.
+	* testsuite/libgomp.oacc-c/c.exp: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c: Specify
+	-fno-builtin-acc_on_device instead of -O0.
+	* testsuite/libgomp.oacc-c-c++-common/acc-on-device.c: Skip for
+	-O0.
+	* testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c:
+	Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-g-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-g-2.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-v-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-w-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/routine-g-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/routine-v-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/routine-w-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c:
+	Don't specify -O2.
+	* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c:
+	Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c:
+	Likewise.
+
 2016-03-24  Martin Liska  <mliska@suse.cz>
 
 	* plugin/plugin-hsa.c (packet_store_release): New function
diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
index 88b0269..bbdbe2f 100644
--- libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -2,6 +2,7 @@
 
 load_lib libgomp-dg.exp
 load_gcc_lib gcc-dg.exp
+load_gcc_lib torture-options.exp
 
 global shlib_ext
 
@@ -13,13 +14,9 @@ if [info exists lang_include_flags] then {
     unset lang_include_flags
 }
 
-# If a testcase doesn't have special options, use these.
-if ![info exists DEFAULT_CFLAGS] then {
-    set DEFAULT_CFLAGS "-O2"
-}
-
 # Initialize dg.
 dg-init
+torture-init
 
 # Turn on OpenACC.
 lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
@@ -104,7 +101,26 @@ if { $lang_test_file_found } {
 
 	setenv ACC_DEVICE_TYPE $offload_target_openacc
 
-	dg-runtest $tests "$tagopt" "$libstdcxx_includes $DEFAULT_CFLAGS"
+	# To get better test coverage for device-specific code that is only
+	# ever used in offloading configurations, we'd like more thorough
+	# testing for test cases that deal with offloading, which most of all
+	# OpenACC test cases are.  We enable torture testing, but limit it to
+	# -O0 and -O2 only, to avoid testing times exploding too much, under
+	# the assumption that between -O0 and -O[something] there is the
+	# biggest difference in the overall structure of the generated code.
+	switch $offload_target_openacc {
+	    host {
+		set-torture-options [list \
+					 { -O2 } ]
+	    }
+	    default {
+		set-torture-options [list \
+					 { -O0 } \
+					 { -O2 } ]
+	    }
+	}
+
+	gcc-dg-runtest $tests "$tagopt" "$libstdcxx_includes"
     }
 }
 
@@ -112,4 +128,5 @@ if { $lang_test_file_found } {
 set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST"
 
 # All done.
+torture-finish
 dg-finish
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c
index e5d9c36..bfcb67d 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c
@@ -1,9 +1,8 @@
-/* { dg-additional-options "-O0" } */
+/* Test the acc_on_device library function. */
+/* { dg-additional-options "-fno-builtin-acc_on_device" } */
 
 #include <openacc.h>
 
-/* acc_on_device might not be folded at -O0, but it should work. */
-
 int main ()
 {
   int dev;
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c
index 88c000e..e0d8710 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
-/* { dg-additional-options "-O2" } */
+/* We don't expect this to work with optimizations disabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <openacc.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c
index 0f323c8..e8d65df 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-O2 -fipa-pta" } */
+/* { dg-additional-options "-fipa-pta" } */
 
 #include <stdlib.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c
index 654e750..dd8ca87 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-O2 -fipa-pta" } */
+/* { dg-additional-options "-fipa-pta" } */
 
 #include <stdlib.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c
index 44d4fd2..50e7dc1 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-O2 -fipa-pta" } */
+/* { dg-additional-options "-fipa-pta" } */
 
 #include <stdlib.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c
index 4922c9c..622bbdf 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 #include <openacc.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c
index 36b882f..c433b80 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c
@@ -1,5 +1,7 @@
-
-/* { dg-additional-options "-O2 -fopenacc-dim=16:16" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
+/* { dg-additional-options "-fopenacc-dim=16:16" } */
 
 #include <openacc.h>
 #include <alloca.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
index 23c2a75..7bff6cd 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
index 1a93db3..92b82a0 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
index 26b2df9..42b612a 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
index c14bddd..a8684f95 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
index 3de8b09..3b104cf 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
index bae5c66..b77ae76 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
index ada92e3..16d8f9f 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
index 706d0d8..9cc12b3 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
index a073ac8..f0c9d81 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
index b9ec95b..2974807 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
index 539e41d..33b6eae 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
index fcb9079..578cfad 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c
index 201dc72..9d14c3b 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
index 8fc4cb5..ace2f49 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c
index fefeb93..2503e8d 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
index 01d1dc8..80cd462 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c
index bd9f1df..5e45fad 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
index 5020e6a..b509a10 100644
--- libgomp/testsuite/libgomp.oacc-c/c.exp
+++ libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -13,14 +13,11 @@ if [info exists lang_include_flags] then {
 
 load_lib libgomp-dg.exp
 load_gcc_lib gcc-dg.exp
-
-# If a testcase doesn't have special options, use these.
-if ![info exists DEFAULT_CFLAGS] then {
-    set DEFAULT_CFLAGS "-O2"
-}
+load_gcc_lib torture-options.exp
 
 # Initialize dg.
 dg-init
+torture-init
 
 # Turn on OpenACC.
 lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
@@ -67,8 +64,28 @@ foreach offload_target_openacc $offload_targets_s_openacc {
 
     setenv ACC_DEVICE_TYPE $offload_target_openacc
 
-    dg-runtest $tests "$tagopt" $DEFAULT_CFLAGS
+    # To get better test coverage for device-specific code that is only
+    # ever used in offloading configurations, we'd like more thorough
+    # testing for test cases that deal with offloading, which most of all
+    # OpenACC test cases are.  We enable torture testing, but limit it to
+    # -O0 and -O2 only, to avoid testing times exploding too much, under
+    # the assumption that between -O0 and -O[something] there is the
+    # biggest difference in the overall structure of the generated code.
+    switch $offload_target_openacc {
+	host {
+	    set-torture-options [list \
+				     { -O2 } ]
+	}
+	default {
+	    set-torture-options [list \
+				     { -O0 } \
+				     { -O2 } ]
+	}
+    }
+
+    gcc-dg-runtest $tests "$tagopt" ""
 }
 
 # All done.
+torture-finish
 dg-finish


Grüße
 Thomas

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

* check-target-libgomp wall time, without vs. with offloading (was: Also test -O0 for OpenACC C, C++ offloading test cases)
  2016-03-23 19:47 ` Also test -O0 for OpenACC C, C++ offloading test cases Jakub Jelinek
@ 2016-03-25  1:05   ` Thomas Schwinge
  2016-04-28 10:44     ` check-target-libgomp wall time, without vs. with offloading Thomas Schwinge
  0 siblings, 1 reply; 22+ messages in thread
From: Thomas Schwinge @ 2016-03-25  1:05 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

Hi!

On Wed, 23 Mar 2016 20:02:01 +0100, Jakub Jelinek <jakub@redhat.com> wrote:
> On Tue, Mar 22, 2016 at 11:23:43AM +0100, Thomas Schwinge wrote:
> > As discussed in
> > <http://news.gmane.org/find-root.php?message_id=%3C87oaj3z280.fsf%40schwinge.name%3E>
> > (and similar to what we're already doing for Fortran, and similar to what
> > recently got committed to libgomp/testsuite/libgomp.hsa.c/c.exp), it has
> > been helpful to also run C, C++ offloading test cases with -O0 in
> > addition to the -O2 default.  Making my earlier gomp-4_0-branch patch
> > conceptually simpler, I came up with the following; OK for trunk?
> 
> How big difference in make check-target-libgomp time is that?
> Without PTX offloading I bet zero, but with PTX offloading configured, is it
> 10% or 50% slower?

15 %.  The major part of the total time is still spent in Fortran
testing...  ;-/

Offloading compilation is slow; I suppose because of having to invoke
several tools (LTO streaming -> mkoffload -> offload compilers,
assemblers, linkers -> combine the resulting images; but I have not done
a detailed analysis on that).  I used the following patch to gather the
following numbers:

Baseline, without offloading:

    TIME 1458823399 START [...]/libgomp.c/c.exp
    TIME 1458823544 (145) END [...]/libgomp.c/c.exp
    TIME 1458823544 START [...]/libgomp.c++/c++.exp
    TIME 1458823672 (128) END [...]/libgomp.c++/c++.exp
    TIME 1458823672 START [...]/libgomp.fortran/fortran.exp
    TIME 1458824080 (408) END [...]/libgomp.fortran/fortran.exp
    TIME 1458824080 START [...]/libgomp.graphite/graphite.exp
    TIME 1458824083 (3) END [...]/libgomp.graphite/graphite.exp
    TIME 1458824083 START [...]/libgomp.hsa.c/c.exp
    TIME 1458824083 (0) END [...]/libgomp.hsa.c/c.exp
    TIME 1458824084 START [...]/libgomp.oacc-c/c.exp
    TIME 1458824109 (25) END [...]/libgomp.oacc-c/c.exp
    TIME 1458824109 START [...]/libgomp.oacc-c++/c++.exp
    TIME 1458824141 (32) END [...]/libgomp.oacc-c++/c++.exp
    TIME 1458824141 START [...]/libgomp.oacc-fortran/fortran.exp
    TIME 1458824215 (74) END [...]/libgomp.oacc-fortran/fortran.exp

Total: 680 s (OpenMP) + 130 s (OpenACC) = 810 s.

With OpenMP IntelMIC (emulated) and OpenACC nvptx offloading:

    TIME 1458824215 START [...]/libgomp.c/c.exp
    TIME 1458824461 (246) END [...]/libgomp.c/c.exp
    TIME 1458824461 START [...]/libgomp.c++/c++.exp
    TIME 1458824664 (203) END [...]/libgomp.c++/c++.exp
    TIME 1458824664 START [...]/libgomp.fortran/fortran.exp
    TIME 1458825269 (605) END [...]/libgomp.fortran/fortran.exp
    TIME 1458825269 START [...]/libgomp.graphite/graphite.exp
    TIME 1458825272 (3) END [...]/libgomp.graphite/graphite.exp
    TIME 1458825273 START [...]/libgomp.hsa.c/c.exp
    TIME 1458825273 (0) END [...]/libgomp.hsa.c/c.exp
    TIME 1458825273 START [...]/libgomp.oacc-c/c.exp
    TIME 1458825533 (260) END [...]/libgomp.oacc-c/c.exp
    TIME 1458825533 START [...]/libgomp.oacc-c++/c++.exp
    TIME 1458825860 (327) END [...]/libgomp.oacc-c++/c++.exp
    TIME 1458825860 START [...]/libgomp.oacc-fortran/fortran.exp
    TIME 1458826459 (599) END [...]/libgomp.oacc-fortran/fortran.exp

Total: 1050 s (OpenMP; + 54 %) + 1190 s (OpenACC; + 815 %) = 2240 s (+ 177 %).

Patched with "Also test -O0 for OpenACC C, C++ offloading test cases",
that results in the following changes (with offloading only):

    TIME 1458834409 START [...]/libgomp.oacc-c/c.exp
    TIME 1458834814 (405) END [...]/libgomp.oacc-c/c.exp
    TIME 1458834814 START [...]/libgomp.oacc-c++/c++.exp
    TIME 1458835338 (524) END [...]/libgomp.oacc-c++/c++.exp

Total: 1050 s (OpenMP) + 1530 s (OpenACC; + 29 %) = 2580 s (+ 15 %).

--- libgomp/testsuite/lib/libgomp-dg.exp
+++ libgomp/testsuite/lib/libgomp-dg.exp
@@ -1,3 +1,18 @@
+rename dg-init dg-init_
+proc dg-init { } {
+    dg-init_
+    global CLOCK_START
+    set CLOCK_START [clock seconds]
+    verbose "TIME $CLOCK_START START [info script]" 0
+}
+rename dg-finish dg-finish_
+proc dg-finish { } {
+    dg-finish_
+    set CLOCK [clock seconds]
+    global CLOCK_START
+    verbose "TIME $CLOCK ([expr $CLOCK - $CLOCK_START]) END [info script]" 0
+}
+
 proc libgomp-dg-test { prog do_what extra_tool_flags } {
     return [gcc-dg-test-1 libgomp_target_compile $prog $do_what $extra_tool_flags]
 }


Grüße
 Thomas

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

* Re: Also test -O0 for OpenACC C, C++ offloading test cases
  2016-03-24 23:33       ` Thomas Schwinge
@ 2016-03-29 13:35         ` Thomas Schwinge
  2016-04-01  8:56         ` [gomp4] " Thomas Schwinge
  1 sibling, 0 replies; 22+ messages in thread
From: Thomas Schwinge @ 2016-03-29 13:35 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek, Bernd Schmidt

Hi!

On Thu, 24 Mar 2016 22:31:29 +0100, I wrote:
> --- libgomp/testsuite/libgomp.oacc-c++/c++.exp
> +++ libgomp/testsuite/libgomp.oacc-c++/c++.exp

>  # Initialize dg.
>  dg-init
> +torture-init
>  
>  # Turn on OpenACC.
>  lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
> @@ -104,7 +101,26 @@ if { $lang_test_file_found } {
>  
>  	setenv ACC_DEVICE_TYPE $offload_target_openacc
>  
> -	dg-runtest $tests "$tagopt" "$libstdcxx_includes $DEFAULT_CFLAGS"
> +	# To get better test coverage for device-specific code that is only
> +	# ever used in offloading configurations, we'd like more thorough
> +	# testing for test cases that deal with offloading, which most of all
> +	# OpenACC test cases are.  We enable torture testing, but limit it to
> +	# -O0 and -O2 only, to avoid testing times exploding too much, under
> +	# the assumption that between -O0 and -O[something] there is the
> +	# biggest difference in the overall structure of the generated code.
> +	switch $offload_target_openacc {
> +	    host {
> +		set-torture-options [list \
> +					 { -O2 } ]
> +	    }
> +	    default {
> +		set-torture-options [list \
> +					 { -O0 } \
> +					 { -O2 } ]
> +	    }
> +	}
> +
> +	gcc-dg-runtest $tests "$tagopt" "$libstdcxx_includes"
>      }
>  }
>  
> @@ -112,4 +128,5 @@ if { $lang_test_file_found } {
>  set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST"
>  
>  # All done.
> +torture-finish
>  dg-finish

In a nvptx-none configuration (that is, without libstdc++), this caused:

     Running [...]/libgomp/testsuite/libgomp.oacc-c++/c++.exp ...
    +ERROR: tcl error sourcing [...]/libgomp/testsuite/libgomp.oacc-c++/c++.exp
    +ERROR: torture-finish: torture_without_loops is not defined
    +    while executing
    +"error "torture-finish: torture_without_loops is not defined""
    +    invoked from within
    +"if [info exists torture_without_loops] {
    +      unset torture_without_loops
    +    } else {
    +      error "torture-finish: torture_without_loops is not defined"
    +    }"
    +    (procedure "torture-finish" line 4)
    +    invoked from within
    +"torture-finish"
    +    (file "[...]/libgomp/testsuite/libgomp.oacc-c++/c++.exp" line 131)
    +    invoked from within
    +"source [...]/libgomp/testsuite/libgomp.oacc-c++/c++.exp"
    +    ("uplevel" body line 1)
    +    invoked from within
    +"uplevel #0 source [...]/libgomp/testsuite/libgomp.oacc-c++/c++.exp"
    +    invoked from within
    +"catch "uplevel #0 source $test_file_name""
     Running [...]/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp ...

torture_with_loops and torture_without_loops are set in
gcc/testsuite/lib/torture-options.exp:set-torture-options -- which we
don't call in libgomp.oacc-c++/c++.exp if skipping C++ testing.  As
obvious, fixed in r234519 as follows:

commit 53c452eee566d997bdef3ee0b20e7bb4485d77a4
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Tue Mar 29 13:24:22 2016 +0000

    Avoid ERROR in libgomp.oacc-c++/c++.exp in non-C++ configurations
    
    	libgomp/
    	* testsuite/libgomp.oacc-c++/c++.exp [!lang_test_file_found]: Call
    	set-torture-options.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234519 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog                          |    5 +++++
 libgomp/testsuite/libgomp.oacc-c++/c++.exp |    4 ++++
 2 files changed, 9 insertions(+)

diff --git libgomp/ChangeLog libgomp/ChangeLog
index e0cd567..f4f30fb 100644
--- libgomp/ChangeLog
+++ libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-29  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* testsuite/libgomp.oacc-c++/c++.exp [!lang_test_file_found]: Call
+	set-torture-options.
+
 2016-03-24  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* testsuite/libgomp.oacc-c++/c++.exp: Set up torture testing, use
diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
index bbdbe2f..608b298 100644
--- libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -122,6 +122,10 @@ if { $lang_test_file_found } {
 
 	gcc-dg-runtest $tests "$tagopt" "$libstdcxx_includes"
     }
+} else {
+    # Call this once, which placates the subsequent torture-finish.
+    set-torture-options [list \
+			     { INVALID } ]
 }
 
 # See above.


Grüße
 Thomas

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

* [gomp4] Also test -O0 for OpenACC C, C++ offloading test cases
  2016-03-24 23:33       ` Thomas Schwinge
  2016-03-29 13:35         ` Thomas Schwinge
@ 2016-04-01  8:56         ` Thomas Schwinge
  2016-04-07 16:30           ` Thomas Schwinge
  1 sibling, 1 reply; 22+ messages in thread
From: Thomas Schwinge @ 2016-04-01  8:56 UTC (permalink / raw)
  To: gcc-patches

Hi!

On Thu, 24 Mar 2016 22:31:29 +0100, I wrote:
> On Wed, 23 Mar 2016 19:57:50 +0100, Bernd Schmidt <bschmidt@redhat.com> wrote:
> > Ok with [...].
> 
> Thanks for the review; committed in r234471:

>     Also test -O0 for OpenACC C, C++ offloading test cases

Merged into gomp-4_0-branch in r234664:

commit 9973610b0d5cb41f380fa18eabacb5f967fe4d0e
Merge: e252cf1 0266264
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Apr 1 08:41:44 2016 +0000

    svn merge -r 234469:234471 svn+ssh://gcc.gnu.org/svn/gcc/trunk
    
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@234664 138bc75d-0d04-0410-961f-82ee72b054a4

 libgomp/ChangeLog                                  | 36 ++++++++++++++
 libgomp/testsuite/libgomp.oacc-c++/c++.exp         | 55 +++++++++-------------
 .../libgomp.oacc-c-c++-common/acc-on-device-2.c    |  5 +-
 .../libgomp.oacc-c-c++-common/acc-on-device.c      |  3 +-
 .../libgomp.oacc-c-c++-common/avoid-offloading-1.c |  3 ++
 .../libgomp.oacc-c-c++-common/avoid-offloading-2.c |  3 ++
 .../libgomp.oacc-c-c++-common/gang-static-2.c      |  4 +-
 .../libgomp.oacc-c-c++-common/host_data-1.c        |  1 +
 libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c |  2 +
 .../libgomp.oacc-c-c++-common/loop-auto-1.c        |  6 ++-
 .../loop-default-compile.c                         |  6 ++-
 .../loop-default-runtime.c                         |  6 ++-
 .../testsuite/libgomp.oacc-c-c++-common/loop-g-1.c |  6 ++-
 .../testsuite/libgomp.oacc-c-c++-common/loop-g-2.c |  6 ++-
 .../libgomp.oacc-c-c++-common/loop-gwv-1.c         |  5 +-
 .../libgomp.oacc-c-c++-common/loop-red-g-1.c       |  6 ++-
 .../libgomp.oacc-c-c++-common/loop-red-gwv-1.c     |  5 +-
 .../libgomp.oacc-c-c++-common/loop-red-v-1.c       |  5 +-
 .../libgomp.oacc-c-c++-common/loop-red-v-2.c       |  5 +-
 .../libgomp.oacc-c-c++-common/loop-red-w-1.c       |  6 ++-
 .../libgomp.oacc-c-c++-common/loop-red-w-2.c       |  6 ++-
 .../libgomp.oacc-c-c++-common/loop-red-wv-1.c      |  5 +-
 .../testsuite/libgomp.oacc-c-c++-common/loop-v-1.c |  5 +-
 .../testsuite/libgomp.oacc-c-c++-common/loop-w-1.c |  6 ++-
 .../libgomp.oacc-c-c++-common/loop-wv-1.c          |  5 +-
 .../libgomp.oacc-c-c++-common/routine-3.c          |  8 ++--
 .../libgomp.oacc-c-c++-common/routine-g-1.c        |  6 ++-
 .../libgomp.oacc-c-c++-common/routine-gwv-1.c      |  5 +-
 .../libgomp.oacc-c-c++-common/routine-v-1.c        |  5 +-
 .../libgomp.oacc-c-c++-common/routine-vec-1.c      |  5 +-
 .../libgomp.oacc-c-c++-common/routine-w-1.c        |  6 ++-
 .../libgomp.oacc-c-c++-common/routine-work-1.c     |  6 ++-
 .../libgomp.oacc-c-c++-common/routine-wv-1.c       |  5 +-
 .../libgomp.oacc-c-c++-common/routine-wv-2.c       |  5 +-
 .../libgomp.oacc-c-c++-common/worker-partn-8.c     |  2 -
 libgomp/testsuite/libgomp.oacc-c/c.exp             | 54 +++++++++------------
 36 files changed, 187 insertions(+), 121 deletions(-)

diff --git libgomp/ChangeLog libgomp/ChangeLog
index 5f2c401..e0cd567 100644
--- libgomp/ChangeLog
+++ libgomp/ChangeLog
@@ -1,3 +1,39 @@
+2016-03-24  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* testsuite/libgomp.oacc-c++/c++.exp: Set up torture testing, use
+	gcc-dg-runtest.
+	* testsuite/libgomp.oacc-c/c.exp: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c: Specify
+	-fno-builtin-acc_on_device instead of -O0.
+	* testsuite/libgomp.oacc-c-c++-common/acc-on-device.c: Skip for
+	-O0.
+	* testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c:
+	Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-g-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-g-2.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-v-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-w-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/routine-g-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/routine-v-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/routine-w-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c:
+	Don't specify -O2.
+	* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c:
+	Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c:
+	Likewise.
+
 2016-03-24  Martin Liska  <mliska@suse.cz>
 
 	* plugin/plugin-hsa.c (packet_store_release): New function
diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
index f513d87..5a07d6a 100644
--- libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -1,14 +1,8 @@
 # This whole file adapted from libgomp.c++/c++.exp.
 
-# To avoid testing time exploding too much, limit any torture testing to -O0
-# and -O2 only, under the assumption that between -O0 and -O[something] there
-# is the biggest difference in the overall structure of the generated code.
-set TORTURE_OPTIONS [list \
-    { -O0 } \
-    { -O2 } ]
-
 load_lib libgomp-dg.exp
 load_gcc_lib gcc-dg.exp
+load_gcc_lib torture-options.exp
 
 global shlib_ext
 
@@ -20,13 +14,9 @@ if [info exists lang_include_flags] then {
     unset lang_include_flags
 }
 
-# If a testcase doesn't have special options, use these.
-if ![info exists DEFAULT_CFLAGS] then {
-    set DEFAULT_CFLAGS "-O2"
-}
-
 # Initialize dg.
 dg-init
+torture-init
 
 # Turn on OpenACC.
 lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
@@ -64,22 +54,6 @@ if { $lang_test_file_found } {
     set tests [lsort [concat \
 			  [find $srcdir/$subdir *.C] \
 			  [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *.c]]]
-    # To get better test coverage for device-specific code that is only ever
-    # used in offloading configurations, we'd like more thorough (torture)
-    # testing for test cases that are dealing with the specifics of
-    # gang/worker/vector single/redundant/partitioned modes.  They're selected
-    # based on their file names -- not a perfect property to detect such test
-    # cases, but should be sufficient.
-    set ttests [lsort -unique [concat \
-				   [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *gang*.c] \
-				   [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *worker*.c] \
-				   [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *vec*.c]]]
-    # tests := tests - ttests.
-    foreach t $ttests {
-	set i [lsearch -exact $tests $t]
-	set tests [lreplace $tests $i $i]
-    }
-
 
     if { $blddir != "" } {
         set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
@@ -130,15 +104,32 @@ if { $lang_test_file_found } {
 	}
 	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared -foffload=$offload_target_openacc"
 
-	dg-runtest $tests "$tagopt" "$libstdcxx_includes $DEFAULT_CFLAGS"
-	gcc-dg-runtest $ttests "$tagopt" "$libstdcxx_includes"
+	# To get better test coverage for device-specific code that is only
+	# ever used in offloading configurations, we'd like more thorough
+	# testing for test cases that deal with offloading, which most of all
+	# OpenACC test cases are.  We enable torture testing, but limit it to
+	# -O0 and -O2 only, to avoid testing times exploding too much, under
+	# the assumption that between -O0 and -O[something] there is the
+	# biggest difference in the overall structure of the generated code.
+	switch -glob $offload_target_openacc {
+	    disable {
+		set-torture-options [list \
+					 { -O2 } ]
+	    }
+	    default {
+		set-torture-options [list \
+					 { -O0 } \
+					 { -O2 } ]
+	    }
+	}
+
+	gcc-dg-runtest $tests "$tagopt" "$libstdcxx_includes"
     }
 }
 
 # See above.
 set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST"
 
-unset TORTURE_OPTIONS
-
 # All done.
+torture-finish
 dg-finish
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c
index e5d9c36..bfcb67d 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c
@@ -1,9 +1,8 @@
-/* { dg-additional-options "-O0" } */
+/* Test the acc_on_device library function. */
+/* { dg-additional-options "-fno-builtin-acc_on_device" } */
 
 #include <openacc.h>
 
-/* acc_on_device might not be folded at -O0, but it should work. */
-
 int main ()
 {
   int dev;
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c
index 88c000e..e0d8710 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
-/* { dg-additional-options "-O2" } */
+/* We don't expect this to work with optimizations disabled.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <openacc.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-1.c
index 2037484..8f50ba3 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-1.c
@@ -1,5 +1,8 @@
 /* Test that the compiler decides to "avoid offloading".  */
 
+/* The warning is only triggered for -O2 and higher.
+   { dg-xfail-if "n/a" { openacc_nvidia_accel_selected } { "-O0" "-O1" } { "" } } */
+
 #include <openacc.h>
 
 int main(void)
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-2.c
index ee30aa6..41bd6d5 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-2.c
@@ -1,6 +1,9 @@
 /* Test that a user can override the compiler's "avoid offloading"
    decision.  */
 
+/* The warning is only triggered for -O2 and higher.
+   { dg-xfail-if "n/a" { openacc_nvidia_accel_selected } { "-O0" "-O1" } { "" } } */
+
 #include <openacc.h>
 
 int main(void)
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/gang-static-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/gang-static-2.c
index 20a866d..ce9632c 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/gang-static-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/gang-static-2.c
@@ -1,5 +1,7 @@
 /* { dg-do run { target openacc_nvidia_accel_selected } } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <assert.h>
 #include <openacc.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c
index 51745ba..b97d877 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c
@@ -1,5 +1,6 @@
 /* { dg-do run { target openacc_nvidia_accel_selected } } */
 /* { dg-additional-options "-lcuda -lcublas -lcudart" } */
+/* { dg-xfail-run-if "TODO" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdlib.h>
 #include <openacc.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
index 5398905..ade064d 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
@@ -1,3 +1,5 @@
+/* { dg-xfail-run-if "TODO" { *-*-* } { "-O0" } { "" } } */
+
 #include <openacc.h>
 #include <stdlib.h>
 #include <stdbool.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c
index 7081fe1..0248ad7 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 #include <openacc.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-default-compile.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-default-compile.c
index 640d827..ec3ca52 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-default-compile.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-default-compile.c
@@ -1,5 +1,7 @@
-
-/* { dg-additional-options "-O2 -fopenacc-dim=16:16" } */
+/* { dg-additional-options "-fopenacc-dim=16:16" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include "loop-default.h"
 #include <stdlib.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-default-runtime.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-default-runtime.c
index 79ab468..e61203d 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-default-runtime.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-default-runtime.c
@@ -1,5 +1,7 @@
-
-/* { dg-additional-options "-O2 -fopenacc-dim=-:-" } */
+/* { dg-additional-options "-fopenacc-dim=-:-" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include "loop-default.h"
 #include <stdlib.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
index 7afb89b..c7b43b7 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
index db83692..6c4c0d2 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
index 26b2df9..42b612a 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
index 129a8c8..6b86de6 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
index 3de8b09..3b104cf 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
index bae5c66..b77ae76 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
index ada92e3..16d8f9f 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
index fadf7d5..8b4dc45 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
index 68d3d7a..174a3ff 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c
index 398b7cc..eeeb1d7 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
index b9ec95b..2974807 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
index 28c6d0b..34c00a3 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
index fcb9079..578cfad 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-3.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-3.c
index a191758..2cdd6bf 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-3.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-3.c
@@ -1,6 +1,8 @@
-
-/* { dg-do run } */
-/* { dg-xfail-if "foo not found" { openacc_host_selected } } */
+/* At -O0, we do get the expected "undefined reference to `foo'" link-time
+   error message (but the check needs to be done differently; compare to
+   routine-nohost-1.c), but for -O2 we don't; presumably because the function
+   gets inlined.
+   { dg-xfail-if "TODO" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdlib.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c
index d38917b..33c8a62 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
index 8fc4cb5..ace2f49 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c
index fefeb93..2503e8d 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-vec-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-vec-1.c
index 8cbd2e7..fa1f96d 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-vec-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-vec-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O1" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 #include <openacc.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
index f21c0a2..c295e66 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-work-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-work-1.c
index a92cafc..daf9bea 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-work-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-work-1.c
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O1 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 #include <openacc.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c
index bd9f1df..5e45fad 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-2.c
index 6d0b455..b5cbc90 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-2.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O1" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+   not optimized away at -O0, and then confuses the target assembler.
+   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdio.h>
 #include <openacc.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/worker-partn-8.c libgomp/testsuite/libgomp.oacc-c-c++-common/worker-partn-8.c
index e787947..6ed736a 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/worker-partn-8.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/worker-partn-8.c
@@ -1,5 +1,3 @@
-/* { dg-additional-options "-O0" } */
-
 /* With -O0, variables are on the stack, not in registers.  Check that worker
    state propagation handles the stack frame.  */
 
diff --git libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
index 03fe3a4..e4be086 100644
--- libgomp/testsuite/libgomp.oacc-c/c.exp
+++ libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -11,23 +11,13 @@ if [info exists lang_include_flags] then {
     unset lang_include_flags
 }
 
-# To avoid testing time exploding too much, limit any torture testing to -O0
-# and -O2 only, under the assumption that between -O0 and -O[something] there
-# is the biggest difference in the overall structure of the generated code.
-set TORTURE_OPTIONS [list \
-    { -O0 } \
-    { -O2 } ]
-
 load_lib libgomp-dg.exp
 load_gcc_lib gcc-dg.exp
-
-# If a testcase doesn't have special options, use these.
-if ![info exists DEFAULT_CFLAGS] then {
-    set DEFAULT_CFLAGS "-O2"
-}
+load_gcc_lib torture-options.exp
 
 # Initialize dg.
 dg-init
+torture-init
 
 # Turn on OpenACC.
 lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
@@ -36,21 +26,6 @@ lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
 set tests [lsort [concat \
 		      [find $srcdir/$subdir *.c] \
 		      [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *.c]]]
-# To get better test coverage for device-specific code that is only ever
-# used in offloading configurations, we'd like more thorough (torture)
-# testing for test cases that are dealing with the specifics of
-# gang/worker/vector single/redundant/partitioned modes.  They're selected
-# based on their file names -- not a perfect property to detect such test
-# cases, but should be sufficient.
-set ttests [lsort -unique [concat \
-			       [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *gang*.c] \
-			       [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *worker*.c] \
-			       [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *vec*.c]]]
-# tests := tests - ttests.
-foreach t $ttests {
-    set i [lsearch -exact $tests $t]
-    set tests [lreplace $tests $i $i]
-}
 
 set ld_library_path $always_ld_library_path
 append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
@@ -90,11 +65,28 @@ foreach offload_target_openacc $offload_targets_s_openacc {
     }
     set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared -foffload=$offload_target_openacc"
 
-    dg-runtest $tests "$tagopt" $DEFAULT_CFLAGS
-    gcc-dg-runtest $ttests "$tagopt" ""
-}
+    # To get better test coverage for device-specific code that is only
+    # ever used in offloading configurations, we'd like more thorough
+    # testing for test cases that deal with offloading, which most of all
+    # OpenACC test cases are.  We enable torture testing, but limit it to
+    # -O0 and -O2 only, to avoid testing times exploding too much, under
+    # the assumption that between -O0 and -O[something] there is the
+    # biggest difference in the overall structure of the generated code.
+    switch -glob $offload_target_openacc {
+	disable {
+	    set-torture-options [list \
+				     { -O2 } ]
+	}
+	default {
+	    set-torture-options [list \
+				     { -O0 } \
+				     { -O2 } ]
+	}
+    }
 
-unset TORTURE_OPTIONS
+    gcc-dg-runtest $tests "$tagopt" ""
+}
 
 # All done.
+torture-finish
 dg-finish


Grüße
 Thomas

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

* Re: [gomp4] Also test -O0 for OpenACC C, C++ offloading test cases
  2016-04-01  8:56         ` [gomp4] " Thomas Schwinge
@ 2016-04-07 16:30           ` Thomas Schwinge
  2016-04-08  8:33             ` [gomp4] [PR testsuite/70579, PR testsuite/70580] Fix test cases failing because of the compiler's "avoid offloading" decision (was: Also test -O0 for OpenACC C, C++ offloading test cases) Thomas Schwinge
  0 siblings, 1 reply; 22+ messages in thread
From: Thomas Schwinge @ 2016-04-07 16:30 UTC (permalink / raw)
  To: gcc-patches

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

Hi!

On Fri, 1 Apr 2016 10:55:49 +0200, I wrote:
> On Thu, 24 Mar 2016 22:31:29 +0100, I wrote:
> > On Wed, 23 Mar 2016 19:57:50 +0100, Bernd Schmidt <bschmidt@redhat.com> wrote:
> > > Ok with [...].
> > 
> > Thanks for the review; committed in r234471:
> 
> >     Also test -O0 for OpenACC C, C++ offloading test cases
> 
> Merged into gomp-4_0-branch in r234664:

> --- libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c
> +++ libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c
> @@ -1,5 +1,6 @@
>  /* { dg-do run { target openacc_nvidia_accel_selected } } */
>  /* { dg-additional-options "-lcuda -lcublas -lcudart" } */
> +/* { dg-xfail-run-if "TODO" { *-*-* } { "-O0" } { "" } } */
>  
>  #include <stdlib.h>
>  #include <openacc.h>

Filed <https://gcc.gnu.org/PR70579>.

> --- libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
> +++ libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
> @@ -1,3 +1,5 @@
> +/* { dg-xfail-run-if "TODO" { *-*-* } { "-O0" } { "" } } */
> +
>  #include <openacc.h>
>  #include <stdlib.h>
>  #include <stdbool.h>

Filed <https://gcc.gnu.org/PR70580>.

The both PASS on trunk.

Currently unclear if it's the same underlying problem or not.


Grüße
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

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

* [gomp4] [PR testsuite/70579, PR testsuite/70580] Fix test cases failing because of the compiler's "avoid offloading" decision (was: Also test -O0 for OpenACC C, C++ offloading test cases)
  2016-04-07 16:30           ` Thomas Schwinge
@ 2016-04-08  8:33             ` Thomas Schwinge
  0 siblings, 0 replies; 22+ messages in thread
From: Thomas Schwinge @ 2016-04-08  8:33 UTC (permalink / raw)
  To: gcc-patches

Hi!

On Thu, 7 Apr 2016 18:29:45 +0200, I wrote:
> On Fri, 1 Apr 2016 10:55:49 +0200, I wrote:
> > On Thu, 24 Mar 2016 22:31:29 +0100, I wrote:
> > > On Wed, 23 Mar 2016 19:57:50 +0100, Bernd Schmidt <bschmidt@redhat.com> wrote:
> > > > Ok with [...].
> > > 
> > > Thanks for the review; committed in r234471:
> > 
> > >     Also test -O0 for OpenACC C, C++ offloading test cases
> > 
> > Merged into gomp-4_0-branch in r234664:
> 
> > --- libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c
> > +++ libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c
> > @@ -1,5 +1,6 @@
> >  /* { dg-do run { target openacc_nvidia_accel_selected } } */
> >  /* { dg-additional-options "-lcuda -lcublas -lcudart" } */
> > +/* { dg-xfail-run-if "TODO" { *-*-* } { "-O0" } { "" } } */
> >  
> >  #include <stdlib.h>
> >  #include <openacc.h>
> 
> Filed <https://gcc.gnu.org/PR70579>.
> 
> > --- libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
> > +++ libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
> > @@ -1,3 +1,5 @@
> > +/* { dg-xfail-run-if "TODO" { *-*-* } { "-O0" } { "" } } */
> > +
> >  #include <openacc.h>
> >  #include <stdlib.h>
> >  #include <stdbool.h>
> 
> Filed <https://gcc.gnu.org/PR70580>.
> 
> The both PASS on trunk.
> 
> Currently unclear if it's the same underlying problem or not.

Committed to gomp-4_0-branch in r234823:

commit 8a56a354bea62a280ec46db00a8956184403ff6e
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Apr 8 08:31:40 2016 +0000

    [PR testsuite/70579, PR testsuite/70580] Fix test cases failing because of the compiler's "avoid offloading" decision
    
    	libgomp/
    	PR testsuite/70579
    	PR testsuite/70580
    	* testsuite/libgomp.oacc-c-c++-common/host_data-1.c: Initialize
    	the runtime for acc_device_nvidia.
    	* testsuite/libgomp.oacc-c-c++-common/if-1.c: Cope with
    	"avoid offloading" situation.
    	* libgomp.texi (Enabling OpenACC): Elaborate on interactions of
    	"avoid offloading".
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@234823 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp                             |  11 +
 libgomp/libgomp.texi                               |   9 +
 .../libgomp.oacc-c-c++-common/host_data-1.c        |   4 +-
 libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c | 316 +++++++++++----------
 4 files changed, 184 insertions(+), 156 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index f54de33..1c99026 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,3 +1,14 @@
+2016-04-08  Thomas Schwinge  <thomas@codesourcery.com>
+
+	PR testsuite/70579
+	PR testsuite/70580
+	* testsuite/libgomp.oacc-c-c++-common/host_data-1.c: Initialize
+	the runtime for acc_device_nvidia.
+	* testsuite/libgomp.oacc-c-c++-common/if-1.c: Cope with
+	"avoid offloading" situation.
+	* libgomp.texi (Enabling OpenACC): Elaborate on interactions of
+	"avoid offloading".
+
 2016-04-04  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c: Don't XFAIL.
diff --git libgomp/libgomp.texi libgomp/libgomp.texi
index 350fb82..7cb677c 100644
--- libgomp/libgomp.texi
+++ libgomp/libgomp.texi
@@ -1824,6 +1824,15 @@ the option @option{-foffload-force} to force offloading in such cases.
 Alternatively, offloading is also enabled if a specific device type is
 requested, in a call to @code{acc_init} or by setting the
 @env{ACC_DEVICE_TYPE} environment variable, for example.
+If you expect code to be offloaded no matter the overhead, for
+example, when preparing data on a non-shared memory offloading device
+for later use in an OpenACC @code{host_data} construct, be sure to
+force offloading, to get the device memory initialized.
+For example, if calling into the cuBLAS library (@ref{OpenACC Library
+Interoperability}) from an OpenACC @code{host_data} construct, this
+program is portable only to @code{acc_device_nvidia} devices, so it's
+good practice then to initialize the runtime with an explicit
+@code{acc_init (acc_device_nvidia)} call.
 
 A complete description of all OpenACC directives accepted may be found in 
 the @uref{http://www.openacc.org/, OpenACC} Application Programming
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c
index b97d877..d19aa20 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c
@@ -1,6 +1,5 @@
 /* { dg-do run { target openacc_nvidia_accel_selected } } */
 /* { dg-additional-options "-lcuda -lcublas -lcudart" } */
-/* { dg-xfail-run-if "TODO" { *-*-* } { "-O0" } { "" } } */
 
 #include <stdlib.h>
 #include <openacc.h>
@@ -30,6 +29,9 @@ saxpy_target (int n, float a, float *x, float *y)
 int
 main(int argc, char **argv)
 {
+  /* We're using cuBLAS, so excpect to be using a Nvidia GPU.  */
+  acc_init (acc_device_nvidia);
+
 #define N 8
   int i;
   float x_ref[N], y_ref[N];
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
index ade064d..cc250f8 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
@@ -1,5 +1,3 @@
-/* { dg-xfail-run-if "TODO" { *-*-* } { "-O0" } { "" } } */
-
 #include <openacc.h>
 #include <stdlib.h>
 #include <stdbool.h>
@@ -23,6 +21,11 @@ main(int argc, char **argv)
     for (i = 0; i < N; i++)
         a[i] = 4.0;
 
+    /* Are we actually offloading?  */
+    bool offloading;
+#pragma acc parallel copyout(offloading)
+    offloading = acc_on_device (acc_device_not_host);
+
 #pragma acc parallel copyin(a[0:N]) copyout(b[0:N]) if(1)
     {
         int ii;
@@ -36,11 +39,10 @@ main(int argc, char **argv)
         }
     }
 
-#if ACC_MEM_SHARED
-    exp = 5.0;
-#else
-    exp = 4.0;
-#endif
+    if (offloading)
+      exp = 4.0;
+    else
+      exp = 5.0;
 
     for (i = 0; i < N; i++)
     {
@@ -86,11 +88,10 @@ main(int argc, char **argv)
         }
     }
 
-#if ACC_MEM_SHARED
-    exp = 9.0;
-#else
-    exp = 8.0;
-#endif
+    if (offloading)
+      exp = 8.0;
+    else
+      exp = 9.0;
 
     for (i = 0; i < N; i++)
     {
@@ -136,11 +137,10 @@ main(int argc, char **argv)
         }
     }
 
-#if ACC_MEM_SHARED
-    exp = 17.0;
-#else
-    exp = 16.0;
-#endif
+    if (offloading)
+      exp = 16.0;
+    else
+      exp = 17.0;
 
     for (i = 0; i < N; i++)
     {
@@ -188,11 +188,10 @@ main(int argc, char **argv)
         }
     }
 
-#if ACC_MEM_SHARED
-    exp = 23.0;
-#else
-    exp = 22.0;
-#endif
+    if (offloading)
+      exp = 22.0;
+    else
+      exp = 23.0;
 
     for (i = 0; i < N; i++)
     {
@@ -242,11 +241,10 @@ main(int argc, char **argv)
         }
     }
 
-#if ACC_MEM_SHARED
-    exp = 50.0;
-#else
-    exp = 49.0;
-#endif
+    if (offloading)
+      exp = 49.0;
+    else
+      exp = 50.0;
 
     for (i = 0; i < N; i++)
     {
@@ -294,11 +292,10 @@ main(int argc, char **argv)
         }
     }
 
-#if ACC_MEM_SHARED
-    exp = 92.0;
-#else
-    exp = 91.0;
-#endif
+    if (offloading)
+      exp = 91.0;
+    else
+      exp = 92.0;
 
     for (i = 0; i < N; i++)
     {
@@ -322,11 +319,10 @@ main(int argc, char **argv)
         }
     }
 
-#if ACC_MEM_SHARED
-    exp = 44.0;
-#else
-    exp = 43.0;
-#endif
+    if (offloading)
+      exp = 43.0;
+    else
+      exp = 44.0;
 
     for (i = 0; i < N; i++)
     {
@@ -362,15 +358,18 @@ main(int argc, char **argv)
         b[i] = 9.0;
     }
 
-#if ACC_MEM_SHARED
-    exp = 0.0;
-    exp2 = 0.0;
-#else
-    acc_map_data (a, d_a, N * sizeof (float));
-    acc_map_data (b, d_b, N * sizeof (float));
-    exp = 3.0;
-    exp2 = 9.0;
-#endif
+    if (offloading)
+      {
+	acc_map_data (a, d_a, N * sizeof (float));
+	acc_map_data (b, d_b, N * sizeof (float));
+	exp = 3.0;
+	exp2 = 9.0;
+      }
+    else
+      {
+	exp = 0.0;
+	exp2 = 0.0;
+      }
 
 #pragma acc update device(a[0:N], b[0:N]) if(1)
 
@@ -441,10 +440,11 @@ main(int argc, char **argv)
             abort();
     }
 
-#if !ACC_MEM_SHARED
-    acc_unmap_data (a);
-    acc_unmap_data (b);
-#endif
+    if (offloading)
+      {
+	acc_unmap_data (a);
+	acc_unmap_data (b);
+      }
 
     acc_free (d_a);
     acc_free (d_b);
@@ -481,17 +481,15 @@ main(int argc, char **argv)
     }
 
 #pragma acc data copyin(a[0:N]) copyout(b[0:N]) if(0)
-{
-#if !ACC_MEM_SHARED
-    if (acc_is_present (a, N * sizeof (float)))
-        abort ();
-#endif
-
-#if !ACC_MEM_SHARED
-    if (acc_is_present (b, N * sizeof (float)))
-        abort ();
-#endif
-}
+    {
+      if (offloading)
+	{
+	  if (acc_is_present (a, N * sizeof (float)))
+	    abort ();
+	  if (acc_is_present (b, N * sizeof (float)))
+	    abort ();
+	}
+    }
 
     for (i = 0; i < N; i++)
     {
@@ -500,18 +498,20 @@ main(int argc, char **argv)
     }
 
 #pragma acc data copyin(a[0:N]) if(1)
-{
-#if !ACC_MEM_SHARED
-    if (!acc_is_present (a, N * sizeof (float)))
-        abort ();
-#endif
+    {
+      if (offloading)
+	{
+	  if (!acc_is_present (a, N * sizeof (float)))
+	    abort ();
+	}
 
 #pragma acc data copyout(b[0:N]) if(0)
-    {
-#if !ACC_MEM_SHARED
-        if (acc_is_present (b, N * sizeof (float)))
-            abort ();
-#endif
+      {
+	if (offloading)
+	  {
+	    if (acc_is_present (b, N * sizeof (float)))
+	      abort ();
+	  }
 
 #pragma acc data copyout(b[0:N]) if(1)
         {
@@ -526,10 +526,11 @@ main(int argc, char **argv)
             }
         }
 
-#if !ACC_MEM_SHARED
-        if (acc_is_present (b, N * sizeof (float)))
-            abort ();
-#endif
+	if (offloading)
+	  {
+	    if (acc_is_present (b, N * sizeof (float)))
+	      abort ();
+	  }
     }
 }
 
@@ -541,72 +542,81 @@ main(int argc, char **argv)
 
 #pragma acc enter data copyin (b[0:N]) if (0)
 
-#if !ACC_MEM_SHARED
-    if (acc_is_present (b, N * sizeof (float)))
-	abort ();
-#endif
+    if (offloading)
+      {
+	if (acc_is_present (b, N * sizeof (float)))
+	  abort ();
+      }
 
 #pragma acc exit data delete (b[0:N]) if (0)
 
 #pragma acc enter data copyin (b[0:N]) if (1)
 
-#if !ACC_MEM_SHARED
-    if (!acc_is_present (b, N * sizeof (float)))
-	abort ();
-#endif
+    if (offloading)
+      {
+	if (!acc_is_present (b, N * sizeof (float)))
+	  abort ();
+      }
 
 #pragma acc exit data delete (b[0:N]) if (1)
 
-#if !ACC_MEM_SHARED
-    if (acc_is_present (b, N * sizeof (float)))
-	abort ();
-#endif
+    if (offloading)
+      {
+	if (acc_is_present (b, N * sizeof (float)))
+	  abort ();
+      }
 
 #pragma acc enter data copyin (b[0:N]) if (zero)
 
-#if !ACC_MEM_SHARED
-    if (acc_is_present (b, N * sizeof (float)))
-	abort ();
-#endif
+    if (offloading)
+      {
+	if (acc_is_present (b, N * sizeof (float)))
+	  abort ();
+      }
 
 #pragma acc exit data delete (b[0:N]) if (zero)
 
 #pragma acc enter data copyin (b[0:N]) if (one)
 
-#if !ACC_MEM_SHARED
-    if (!acc_is_present (b, N * sizeof (float)))
-	abort ();
-#endif
+    if (offloading)
+      {
+	if (!acc_is_present (b, N * sizeof (float)))
+	  abort ();
+      }
 
 #pragma acc exit data delete (b[0:N]) if (one)
 
-#if !ACC_MEM_SHARED
-    if (acc_is_present (b, N * sizeof (float)))
-	abort ();
-#endif
+    if (offloading)
+      {
+	if (acc_is_present (b, N * sizeof (float)))
+	  abort ();
+      }
 
 #pragma acc enter data copyin (b[0:N]) if (one == 0)
 
-#if !ACC_MEM_SHARED
-    if (acc_is_present (b, N * sizeof (float)))
-	abort ();
-#endif
+    if (offloading)
+      {
+	if (acc_is_present (b, N * sizeof (float)))
+	  abort ();
+      }
 
 #pragma acc exit data delete (b[0:N]) if (one == 0)
 
 #pragma acc enter data copyin (b[0:N]) if (one == 1)
 
-#if !ACC_MEM_SHARED
-    if (!acc_is_present (b, N * sizeof (float)))
-	abort ();
-#endif
+    if (offloading)
+      {
+	if (!acc_is_present (b, N * sizeof (float)))
+	  abort ();
+      }
 
 #pragma acc exit data delete (b[0:N]) if (one == 1)
 
-#if !ACC_MEM_SHARED
-    if (acc_is_present (b, N * sizeof (float)))
-	abort ();
-#endif
+    if (offloading)
+      {
+	if (acc_is_present (b, N * sizeof (float)))
+	  abort ();
+      }
 
     for (i = 0; i < N; i++)
         a[i] = 4.0;
@@ -624,11 +634,10 @@ main(int argc, char **argv)
         }
     }
 
-#if ACC_MEM_SHARED
-    exp = 5.0;
-#else
-    exp = 4.0;
-#endif
+    if (offloading)
+      exp = 4.0;
+    else
+      exp = 5.0;
 
     for (i = 0; i < N; i++)
     {
@@ -674,11 +683,10 @@ main(int argc, char **argv)
         }
     }
 
-#if ACC_MEM_SHARED
-    exp = 9.0;
-#else
-    exp = 8.0;
-#endif
+    if (offloading)
+      exp = 8.0;
+    else
+      exp = 9.0;
 
     for (i = 0; i < N; i++)
     {
@@ -724,11 +732,10 @@ main(int argc, char **argv)
         }
     }
 
-#if ACC_MEM_SHARED
-    exp = 17.0;
-#else
-    exp = 16.0;
-#endif
+    if (offloading)
+      exp = 16.0;
+    else
+      exp = 17.0;
 
     for (i = 0; i < N; i++)
     {
@@ -776,11 +783,10 @@ main(int argc, char **argv)
         }
     }
 
-#if ACC_MEM_SHARED
-    exp = 23.0;
-#else
-    exp = 22.0;
-#endif
+    if (offloading)
+      exp = 22.0;
+    else
+      exp = 23.0;
 
     for (i = 0; i < N; i++)
     {
@@ -830,11 +836,10 @@ main(int argc, char **argv)
         }
     }
 
-#if ACC_MEM_SHARED
-    exp = 50.0;
-#else
-    exp = 49.0;
-#endif
+    if (offloading)
+      exp = 49.0;
+    else
+      exp = 50.0;
 
     for (i = 0; i < N; i++)
     {
@@ -882,11 +887,10 @@ main(int argc, char **argv)
         }
     }
 
-#if ACC_MEM_SHARED
-    exp = 92.0;
-#else
-    exp = 91.0;
-#endif
+    if (offloading)
+      exp = 91.0;
+    else
+      exp = 92.0;
 
     for (i = 0; i < N; i++)
     {
@@ -910,11 +914,10 @@ main(int argc, char **argv)
         }
     }
 
-#if ACC_MEM_SHARED
-    exp = 44.0;
-#else
-    exp = 43.0;
-#endif
+    if (offloading)
+      exp = 43.0;
+    else
+      exp = 44.0;
 
     for (i = 0; i < N; i++)
     {
@@ -950,15 +953,18 @@ main(int argc, char **argv)
         b[i] = 9.0;
     }
 
-#if ACC_MEM_SHARED
-    exp = 0.0;
-    exp2 = 0.0;
-#else
-    acc_map_data (a, d_a, N * sizeof (float));
-    acc_map_data (b, d_b, N * sizeof (float));
-    exp = 3.0;
-    exp2 = 9.0;
-#endif
+    if (offloading)
+      {
+	acc_map_data (a, d_a, N * sizeof (float));
+	acc_map_data (b, d_b, N * sizeof (float));
+	exp = 3.0;
+	exp2 = 9.0;
+      }
+    else
+      {
+	exp = 0.0;
+	exp2 = 0.0;
+      }
 
     return 0;
 }


Grüße
 Thomas

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

* Re: check-target-libgomp wall time, without vs. with offloading
  2016-03-25  1:05   ` check-target-libgomp wall time, without vs. with offloading (was: Also test -O0 for OpenACC C, C++ offloading test cases) Thomas Schwinge
@ 2016-04-28 10:44     ` Thomas Schwinge
  2016-04-29  7:43       ` Jakub Jelinek
  0 siblings, 1 reply; 22+ messages in thread
From: Thomas Schwinge @ 2016-04-28 10:44 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

Hi!

On Thu, 24 Mar 2016 22:42:10 +0100, I wrote:
> On Wed, 23 Mar 2016 20:02:01 +0100, Jakub Jelinek <jakub@redhat.com> wrote:
> > On Tue, Mar 22, 2016 at 11:23:43AM +0100, Thomas Schwinge wrote:
> > > As discussed in
> > > <http://news.gmane.org/find-root.php?message_id=%3C87oaj3z280.fsf%40schwinge.name%3E>
> > > (and similar to what we're already doing for Fortran, and similar to what
> > > recently got committed to libgomp/testsuite/libgomp.hsa.c/c.exp), it has
> > > been helpful to also run C, C++ offloading test cases with -O0 in
> > > addition to the -O2 default.  Making my earlier gomp-4_0-branch patch
> > > conceptually simpler, I came up with the following; OK for trunk?
> > 
> > How big difference in make check-target-libgomp time is that?
> > Without PTX offloading I bet zero, but with PTX offloading configured, is it
> > 10% or 50% slower?
> 
> 15 %.  The major part of the total time is still spent in Fortran
> testing...  ;-/
> 
> Offloading compilation is slow; I suppose because of having to invoke
> several tools (LTO streaming -> mkoffload -> offload compilers,
> assemblers, linkers -> combine the resulting images; but I have not done
> a detailed analysis on that).

Here are three patches to improve that.  OK for gcc-6-branch and trunk?
Before:

    $ grep ^TIME < build-gcc/x86_64-pc-linux-gnu/libgomp/testsuite/libgomp.log
    TIME 1461826886 START [...]/libgomp.c/c.exp
    TIME 1461827229 (343) END [...]/libgomp.c/c.exp
    TIME 1461827230 START [...]/libgomp.c++/c++.exp
    TIME 1461827522 (292) END [...]/libgomp.c++/c++.exp
    TIME 1461827522 START [...]/libgomp.fortran/fortran.exp
    TIME 1461828279 (757) END [...]/libgomp.fortran/fortran.exp
    TIME 1461828280 START [...]/libgomp.graphite/graphite.exp
    TIME 1461828284 (4) END [...]/libgomp.graphite/graphite.exp
    TIME 1461828284 START [...]/libgomp.hsa.c/c.exp
    TIME 1461828285 (1) END [...]/libgomp.hsa.c/c.exp
    TIME 1461828285 START [...]/libgomp.oacc-c/c.exp
    TIME 1461828866 (581) END [...]/libgomp.oacc-c/c.exp
    TIME 1461828866 START [...]/libgomp.oacc-c++/c++.exp
    TIME 1461829685 (819) END [...]/libgomp.oacc-c++/c++.exp
    TIME 1461829685 START [...]/libgomp.oacc-fortran/fortran.exp
    TIME 1461831119 (1434) END [...]/libgomp.oacc-fortran/fortran.exp

After:

    TIME 1461832444 START [...]/libgomp.c/c.exp
    TIME 1461832935 (491) END [...]/libgomp.c/c.exp
    TIME 1461832935 START [...]/libgomp.c++/c++.exp
    TIME 1461833275 (340) END [...]/libgomp.c++/c++.exp
    TIME 1461833275 START [...]/libgomp.fortran/fortran.exp
    TIME 1461833983 (708) END [...]/libgomp.fortran/fortran.exp
    TIME 1461833983 START [...]/libgomp.graphite/graphite.exp
    TIME 1461833986 (3) END [...]/libgomp.graphite/graphite.exp
    TIME 1461833986 START [...]/libgomp.hsa.c/c.exp
    TIME 1461833986 (0) END [...]/libgomp.hsa.c/c.exp
    TIME 1461833986 START [...]/libgomp.oacc-c/c.exp
    TIME 1461834423 (437) END [...]/libgomp.oacc-c/c.exp
    TIME 1461834423 START [...]/libgomp.oacc-c++/c++.exp
    TIME 1461834918 (495) END [...]/libgomp.oacc-c++/c++.exp
    TIME 1461834918 START [...]/libgomp.oacc-fortran/fortran.exp
    TIME 1461835533 (615) END [...]/libgomp.oacc-fortran/fortran.exp

This is on a rather busy system; my patch can't have any effect on
libgomp OpenMP offloading testing (which has taken longer in the second
run, due to higher system load); in light of this, the reduced duration
of OpenACC testing "shines" ;-) even better.

commit 3b521f3e35fdb4b320e95b5f6a82b8d89399481a
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Thu Apr 21 11:36:39 2016 +0200

    libgomp: Unconfuse offload plugins vs. offload targets
---
 libgomp/Makefile.in                           |    2 +-
 libgomp/config.h.in                           |    4 +--
 libgomp/configure                             |   34 +++++++++++++------------
 libgomp/plugin/configfrag.ac                  |   34 +++++++++++++------------
 libgomp/target.c                              |    8 +++---
 libgomp/testsuite/Makefile.in                 |    2 +-
 libgomp/testsuite/lib/libgomp.exp             |   25 ++++++++----------
 libgomp/testsuite/libgomp-test-support.exp.in |    2 +-
 8 files changed, 56 insertions(+), 55 deletions(-)

diff --git libgomp/Makefile.in libgomp/Makefile.in
[snipped]
diff --git libgomp/config.h.in libgomp/config.h.in
[snipped]
diff --git libgomp/configure libgomp/configure
[snipped]
diff --git libgomp/plugin/configfrag.ac libgomp/plugin/configfrag.ac
index 88b4156..93d3a71 100644
--- libgomp/plugin/configfrag.ac
+++ libgomp/plugin/configfrag.ac
@@ -26,8 +26,6 @@
 # see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-offload_targets=
-AC_SUBST(offload_targets)
 plugin_support=yes
 AC_CHECK_LIB(dl, dlsym, , [plugin_support=no])
 if test x"$plugin_support" = xyes; then
@@ -142,7 +140,10 @@ AC_SUBST(PLUGIN_HSA_LIBS)
 
 
 
-# Get offload targets and path to install tree of offloading compiler.
+# Parse offload targets, and figure out libgomp plugin, and configure the
+# corresponding offload compiler.
+offload_plugins=
+AC_SUBST(offload_plugins)
 offload_additional_options=
 offload_additional_lib_paths=
 AC_SUBST(offload_additional_options)
@@ -151,13 +152,13 @@ if test x"$enable_offload_targets" != x; then
   for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
     tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
     tgt=`echo $tgt | sed 's/=.*//'`
-    tgt_name=
+    tgt_plugin=
     case $tgt in
       *-intelmic-* | *-intelmicemul-*)
-	tgt_name=intelmic
+	tgt_plugin=intelmic
 	;;
       nvptx*)
-        tgt_name=nvptx
+	tgt_plugin=nvptx
 	PLUGIN_NVPTX=$tgt
 	PLUGIN_NVPTX_CPPFLAGS=$CUDA_DRIVER_CPPFLAGS
 	PLUGIN_NVPTX_LDFLAGS=$CUDA_DRIVER_LDFLAGS
@@ -184,7 +185,7 @@ if test x"$enable_offload_targets" != x; then
 	    ;;
 	esac
 	;;
-      hsa*)
+      hsa)
 	case "${target}" in
 	  x86_64-*-*)
 	    case " ${CC} ${CFLAGS} " in
@@ -192,7 +193,7 @@ if test x"$enable_offload_targets" != x; then
 	        PLUGIN_HSA=0
 		;;
 	      *)
-	        tgt_name=hsa
+		tgt_plugin=hsa
 	        PLUGIN_HSA=$tgt
 	        PLUGIN_HSA_CPPFLAGS=$HSA_RUNTIME_CPPFLAGS
 	        PLUGIN_HSA_LDFLAGS="$HSA_RUNTIME_LDFLAGS $HSA_KMT_LDFLAGS"
@@ -214,7 +215,7 @@ if test x"$enable_offload_targets" != x; then
 	        LDFLAGS=$PLUGIN_HSA_save_LDFLAGS
 	        LIBS=$PLUGIN_HSA_save_LIBS
 	        case $PLUGIN_HSA in
-	          hsa*)
+		  hsa)
 	            HSA_PLUGIN=0
 	            AC_MSG_ERROR([HSA run-time package required for HSA support])
 	            ;;
@@ -231,16 +232,17 @@ if test x"$enable_offload_targets" != x; then
 	AC_MSG_ERROR([unknown offload target specified])
 	;;
     esac
-    if test x"$tgt_name" = x; then
+    if test x"$tgt_plugin" = x; then
       # Don't configure libgomp for this offloading target if we don't build
       # the corresponding plugin.
       continue
-    elif test x"$offload_targets" = x; then
-      offload_targets=$tgt_name
+    elif test x"$offload_plugins" = x; then
+      offload_plugins=$tgt_plugin
     else
-      offload_targets=$offload_targets,$tgt_name
+      offload_plugins=$offload_plugins,$tgt_plugin
     fi
-    if test "$tgt_name" = hsa; then
+    # Configure additional search paths.
+    if test "$tgt_plugin" = hsa; then
       # Offloading compilation is all handled by the target compiler.
       :
     elif test x"$tgt_dir" != x; then
@@ -252,8 +254,8 @@ if test x"$enable_offload_targets" != x; then
     fi
   done
 fi
-AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
-  [Define to offload targets, separated by commas.])
+AC_DEFINE_UNQUOTED(OFFLOAD_PLUGINS, "$offload_plugins",
+  [Define to offload plugins, separated by commas.])
 AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1])
 AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLUGIN_NVPTX],
   [Define to 1 if the NVIDIA plugin is built, 0 if not.])
diff --git libgomp/target.c libgomp/target.c
index e2dd0e0..c12c085 100644
--- libgomp/target.c
+++ libgomp/target.c
@@ -2467,9 +2467,9 @@ gomp_target_fini (void)
     }
 }
 
-/* This function initializes the runtime needed for offloading.
-   It parses the list of offload targets and tries to load the plugins for
-   these targets.  On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
+/* This function initializes the runtime for offloading.
+   It parses the list of offload plugins, and tries to load these.
+   On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
    will be set, and the array DEVICES initialized, containing descriptors for
    corresponding devices, first the GOMP_OFFLOAD_CAP_OPENMP_400 ones, follows
    by the others.  */
@@ -2486,7 +2486,7 @@ gomp_target_init (void)
   num_devices = 0;
   devices = NULL;
 
-  cur = OFFLOAD_TARGETS;
+  cur = OFFLOAD_PLUGINS;
   if (*cur)
     do
       {
diff --git libgomp/testsuite/Makefile.in libgomp/testsuite/Makefile.in
[snipped]
diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp
index 1cb4991..ae65e68 100644
--- libgomp/testsuite/lib/libgomp.exp
+++ libgomp/testsuite/lib/libgomp.exp
@@ -36,12 +36,11 @@ load_gcc_lib fortran-modules.exp
 # Try to load a test support file, built during libgomp configuration.
 load_file libgomp-test-support.exp
 
-# Populate offload_targets_s (offloading targets separated by a space), and
-# offload_targets_s_openacc (the same, but with OpenACC names; OpenACC spells
-# some of them a little differently).
-set offload_targets_s [split $offload_targets ","]
+# Populate offload_plugins_s (offloading plugins separated by a space), and
+# offload_targets_s_openacc (offload targets with OpenACC device type names).
+set offload_plugins_s [split $offload_plugins ","]
 set offload_targets_s_openacc {}
-foreach offload_target_openacc $offload_targets_s {
+foreach offload_target_openacc $offload_plugins_s {
     # Translate to OpenACC names, or skip if not yet supported.
     switch $offload_target_openacc {
 	intelmic {
@@ -135,9 +134,9 @@ proc libgomp_init { args } {
     set always_ld_library_path ".:${blddir}/.libs"
 
     # Add liboffloadmic build directory in LD_LIBRARY_PATH to support
-    # non-fallback testing for Intel MIC targets
-    global offload_targets
-    if { [string match "*,intelmic,*" ",$offload_targets,"] } {
+    # Intel MIC offloading testing.
+    global offload_plugins
+    if { [string match "*,intelmic,*" ",$offload_plugins,"] } {
 	append always_ld_library_path ":${blddir}/../liboffloadmic/.libs"
 	append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
 	# libstdc++ is required by liboffloadmic
@@ -245,8 +244,7 @@ proc libgomp_init { args } {
     # Disable color diagnostics
     lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
 
-    # Used for support non-fallback offloading.
-    # Help GCC to find target mkoffload.
+    # Help GCC to find offload compilers' mkoffload.
     global offload_additional_options
     if { $offload_additional_options != "" } {
 	lappend ALWAYS_CFLAGS "additional_flags=${offload_additional_options}"
@@ -373,9 +371,8 @@ proc check_effective_target_openacc_nvidia_accel_present { } {
     } "" ]
 }
 
-# Return 1 if at least one nvidia board is present, and the nvidia device type
-# is selected by default by means of setting the environment variable
-# ACC_DEVICE_TYPE.
+# Return 1 if at least one nvidia board is present, and the OpenACC "nvidia"
+# device type is selected.
 
 proc check_effective_target_openacc_nvidia_accel_selected { } {
     if { ![check_effective_target_openacc_nvidia_accel_present] } {
@@ -388,7 +385,7 @@ proc check_effective_target_openacc_nvidia_accel_selected { } {
     return 0;
 }
 
-# Return 1 if the host target is selected for offloaded
+# Return 1 if the OpenACC "host" device type is selected.
 
 proc check_effective_target_openacc_host_selected { } {
     global offload_target_openacc
diff --git libgomp/testsuite/libgomp-test-support.exp.in libgomp/testsuite/libgomp-test-support.exp.in
index 5a724fb..1068483 100644
--- libgomp/testsuite/libgomp-test-support.exp.in
+++ libgomp/testsuite/libgomp-test-support.exp.in
@@ -3,4 +3,4 @@ set cuda_driver_lib "@CUDA_DRIVER_LIB@"
 set hsa_runtime_lib "@HSA_RUNTIME_LIB@"
 set hsa_kmt_lib "@HSA_KMT_LIB@"
 
-set offload_targets "@offload_targets@"
+set offload_plugins "@offload_plugins@"

commit b7a0a14646663aaa25bf7c60e684317f935cd6ca
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Thu Apr 21 14:29:21 2016 +0200

    libgomp: In OpenACC testing, cycle though $offload_target
    
    Conflicts:
    	libgomp/configure
---
 libgomp/Makefile.in                                |    1 +
 libgomp/configure                                  |   12 +++-
 libgomp/plugin/configfrag.ac                       |    7 ++-
 libgomp/testsuite/Makefile.in                      |    1 +
 libgomp/testsuite/lib/libgomp.exp                  |   61 +++++++++-----------
 libgomp/testsuite/libgomp-test-support.exp.in      |    2 +-
 libgomp/testsuite/libgomp.oacc-c++/c++.exp         |   27 +++++----
 libgomp/testsuite/libgomp.oacc-c/c.exp             |   27 +++++----
 libgomp/testsuite/libgomp.oacc-fortran/fortran.exp |   19 +++---
 9 files changed, 90 insertions(+), 67 deletions(-)

diff --git libgomp/Makefile.in libgomp/Makefile.in
[snipped]
diff --git libgomp/configure libgomp/configure
[snipped]
diff --git libgomp/plugin/configfrag.ac libgomp/plugin/configfrag.ac
index 93d3a71..de0a6f6 100644
--- libgomp/plugin/configfrag.ac
+++ libgomp/plugin/configfrag.ac
@@ -141,9 +141,12 @@ AC_SUBST(PLUGIN_HSA_LIBS)
 
 
 # Parse offload targets, and figure out libgomp plugin, and configure the
-# corresponding offload compiler.
+# corresponding offload compiler.  offload_plugins and offload_targets will be
+# populated in the same order.
 offload_plugins=
+offload_targets=
 AC_SUBST(offload_plugins)
+AC_SUBST(offload_targets)
 offload_additional_options=
 offload_additional_lib_paths=
 AC_SUBST(offload_additional_options)
@@ -238,8 +241,10 @@ if test x"$enable_offload_targets" != x; then
       continue
     elif test x"$offload_plugins" = x; then
       offload_plugins=$tgt_plugin
+      offload_targets=$tgt
     else
       offload_plugins=$offload_plugins,$tgt_plugin
+      offload_targets=$offload_targets,$tgt
     fi
     # Configure additional search paths.
     if test "$tgt_plugin" = hsa; then
diff --git libgomp/testsuite/Makefile.in libgomp/testsuite/Makefile.in
[snipped]
diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp
index ae65e68..4a25421 100644
--- libgomp/testsuite/lib/libgomp.exp
+++ libgomp/testsuite/lib/libgomp.exp
@@ -36,27 +36,6 @@ load_gcc_lib fortran-modules.exp
 # Try to load a test support file, built during libgomp configuration.
 load_file libgomp-test-support.exp
 
-# Populate offload_plugins_s (offloading plugins separated by a space), and
-# offload_targets_s_openacc (offload targets with OpenACC device type names).
-set offload_plugins_s [split $offload_plugins ","]
-set offload_targets_s_openacc {}
-foreach offload_target_openacc $offload_plugins_s {
-    # Translate to OpenACC names, or skip if not yet supported.
-    switch $offload_target_openacc {
-	intelmic {
-	    continue
-	}
-	nvptx {
-	    set offload_target_openacc "nvidia"
-	}
-	hsa {
-	    continue
-	}
-    }
-    lappend offload_targets_s_openacc "$offload_target_openacc"
-}
-lappend offload_targets_s_openacc "host"
-
 set dg-do-what-default run
 
 #
@@ -135,8 +114,8 @@ proc libgomp_init { args } {
 
     # Add liboffloadmic build directory in LD_LIBRARY_PATH to support
     # Intel MIC offloading testing.
-    global offload_plugins
-    if { [string match "*,intelmic,*" ",$offload_plugins,"] } {
+    global offload_targets
+    if { [string match "*,*-intelmic*,*" ",$offload_targets,"] } {
 	append always_ld_library_path ":${blddir}/../liboffloadmic/.libs"
 	append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
 	# libstdc++ is required by liboffloadmic
@@ -320,6 +299,28 @@ proc libgomp_option_proc { option } {
     }
 }
 
+# Translate offload target to OpenACC device type.  Return the empty string if
+# not suitable or not yet supported, and "host" for offload target "disable".
+proc offload_target_to_openacc_device_type { offload_target } {
+    switch -glob $offload_target {
+	disable {
+	    return "host"
+	}
+	hsa {
+	    return ""
+	}
+	*-intelmic* {
+	    return ""
+	}
+	nvptx* {
+	    return "nvidia"
+	}
+	default {
+	    error "Unknwon offload target: $offload_target"
+	}
+    }
+}
+
 # Return 1 if offload device is available.
 proc check_effective_target_offload_device { } {
     return [check_runtime_nocache offload_device_available_ {
@@ -378,21 +379,15 @@ proc check_effective_target_openacc_nvidia_accel_selected { } {
     if { ![check_effective_target_openacc_nvidia_accel_present] } {
 	return 0;
     }
-    global offload_target_openacc
-    if { $offload_target_openacc == "nvidia" } {
-        return 1;
-    }
-    return 0;
+    global openacc_device_type
+    return [string match "nvidia" $openacc_device_type]
 }
 
 # Return 1 if the OpenACC "host" device type is selected.
 
 proc check_effective_target_openacc_host_selected { } {
-    global offload_target_openacc
-    if { $offload_target_openacc == "host" } {
-        return 1;
-    }
-    return 0;
+    global openacc_device_type
+    return [string match "host" $openacc_device_type]
 }
 
 # Return 1 if the selected OMP device is actually a HSA device
diff --git libgomp/testsuite/libgomp-test-support.exp.in libgomp/testsuite/libgomp-test-support.exp.in
index 1068483..5a724fb 100644
--- libgomp/testsuite/libgomp-test-support.exp.in
+++ libgomp/testsuite/libgomp-test-support.exp.in
@@ -3,4 +3,4 @@ set cuda_driver_lib "@CUDA_DRIVER_LIB@"
 set hsa_runtime_lib "@HSA_RUNTIME_LIB@"
 set hsa_kmt_lib "@HSA_KMT_LIB@"
 
-set offload_plugins "@offload_plugins@"
+set offload_targets "@offload_targets@"
diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
index 608b298..7c8a29b 100644
--- libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -70,18 +70,23 @@ if { $lang_test_file_found } {
 	set libstdcxx_includes ""
     }
 
-    # Test OpenACC with available accelerators.
-    foreach offload_target_openacc $offload_targets_s_openacc {
-	set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
+    # Test with all offload targets, and with offloading disabled.
+    foreach offload_target [concat [split $offload_targets ","] "disable"] {
+	set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
+	set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
 
-	switch $offload_target_openacc {
-	    host {
+	switch $openacc_device_type {
+	    "" {
+		untested "$subdir $offload_target offloading"
+		continue
+	    }
+	    "host" {
 		set acc_mem_shared 1
 	    }
-	    nvidia {
+	    "nvidia" {
 		if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		    # Don't bother; execution testing is going to FAIL.
-		    untested "$subdir $offload_target_openacc offloading"
+		    untested "$subdir $offload_target offloading"
 		    continue
 		}
 
@@ -94,12 +99,12 @@ if { $lang_test_file_found } {
 		set acc_mem_shared 0
 	    }
 	    default {
-		set acc_mem_shared 0
+		error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
 	    }
 	}
 	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
-	setenv ACC_DEVICE_TYPE $offload_target_openacc
+	setenv ACC_DEVICE_TYPE $openacc_device_type
 
 	# To get better test coverage for device-specific code that is only
 	# ever used in offloading configurations, we'd like more thorough
@@ -108,8 +113,8 @@ if { $lang_test_file_found } {
 	# -O0 and -O2 only, to avoid testing times exploding too much, under
 	# the assumption that between -O0 and -O[something] there is the
 	# biggest difference in the overall structure of the generated code.
-	switch $offload_target_openacc {
-	    host {
+	switch $offload_target {
+	    "disable" {
 		set-torture-options [list \
 					 { -O2 } ]
 	    }
diff --git libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
index b509a10..3f9a3c6 100644
--- libgomp/testsuite/libgomp.oacc-c/c.exp
+++ libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -31,20 +31,25 @@ set ld_library_path $always_ld_library_path
 append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
 set_ld_library_path_env_vars
 
-# Test OpenACC with available accelerators.
+# Test with all offload targets, and with offloading disabled.
 set SAVE_ALWAYS_CFLAGS "$ALWAYS_CFLAGS"
-foreach offload_target_openacc $offload_targets_s_openacc {
+foreach offload_target [concat [split $offload_targets ","] "disable"] {
     set ALWAYS_CFLAGS "$SAVE_ALWAYS_CFLAGS"
-    set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
+    set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
+    set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
 
-    switch $offload_target_openacc {
-	host {
+    switch $openacc_device_type {
+	"" {
+	    untested "$subdir $offload_target offloading"
+	    continue
+	}
+	"host" {
 	    set acc_mem_shared 1
 	}
-	nvidia {
+	"nvidia" {
 	    if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		# Don't bother; execution testing is going to FAIL.
-		untested "$subdir $offload_target_openacc offloading"
+		untested "$subdir $offload_target offloading"
 		continue
 	    }
 
@@ -57,12 +62,12 @@ foreach offload_target_openacc $offload_targets_s_openacc {
 	    set acc_mem_shared 0
 	}
 	default {
-	    set acc_mem_shared 0
+	    error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
 	}
     }
     set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
-    setenv ACC_DEVICE_TYPE $offload_target_openacc
+    setenv ACC_DEVICE_TYPE $openacc_device_type
 
     # To get better test coverage for device-specific code that is only
     # ever used in offloading configurations, we'd like more thorough
@@ -71,8 +76,8 @@ foreach offload_target_openacc $offload_targets_s_openacc {
     # -O0 and -O2 only, to avoid testing times exploding too much, under
     # the assumption that between -O0 and -O[something] there is the
     # biggest difference in the overall structure of the generated code.
-    switch $offload_target_openacc {
-	host {
+    switch $offload_target {
+	"disable" {
 	    set-torture-options [list \
 				     { -O2 } ]
 	}
diff --git libgomp/testsuite/libgomp.oacc-fortran/fortran.exp libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
index 2d6b647..7ce92c0 100644
--- libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
+++ libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
@@ -65,30 +65,35 @@ if { $lang_test_file_found } {
     append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
     set_ld_library_path_env_vars
 
-    # Test OpenACC with available accelerators.
-    foreach offload_target_openacc $offload_targets_s_openacc {
-	set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
+    # Test with all offload targets, and with offloading disabled.
+    foreach offload_target [concat [split $offload_targets ","] "disable"] {
+	set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
+	set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
 
-	switch $offload_target_openacc {
+	switch $openacc_device_type {
+	    "" {
+		untested "$subdir $offload_target offloading"
+		continue
+	    }
 	    host {
 		set acc_mem_shared 1
 	    }
 	    nvidia {
 		if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		    # Don't bother; execution testing is going to FAIL.
-		    untested "$subdir $offload_target_openacc offloading"
+		    untested "$subdir $offload_target offloading"
 		    continue
 		}
 
 		set acc_mem_shared 0
 	    }
 	    default {
-		set acc_mem_shared 0
+		error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
 	    }
 	}
 	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
-	setenv ACC_DEVICE_TYPE $offload_target_openacc
+	setenv ACC_DEVICE_TYPE $openacc_device_type
 
 	# For Fortran we're doing torture testing, as Fortran has far more tests
 	# with arrays etc. that testing just -O0 or -O2 is insufficient, that is

commit 08ee4f41d0ec562f7f2f7310b3439fe46c1dd0b4
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Thu Apr 21 15:10:08 2016 +0200

    libgomp: In OpenACC testing, by default only build for the offload target that we're actually going to test
---
 libgomp/testsuite/libgomp.oacc-c++/c++.exp         |    3 +++
 libgomp/testsuite/libgomp.oacc-c/c.exp             |    3 +++
 libgomp/testsuite/libgomp.oacc-fortran/fortran.exp |    3 +++
 3 files changed, 9 insertions(+)

diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
index 7c8a29b..befb921 100644
--- libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -104,6 +104,9 @@ if { $lang_test_file_found } {
 	}
 	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
+	# To avoid overhead, by default only build for the offload target that
+	# we're actually going to test.
+	set tagopt "$tagopt -foffload=$offload_target"
 	setenv ACC_DEVICE_TYPE $openacc_device_type
 
 	# To get better test coverage for device-specific code that is only
diff --git libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
index 3f9a3c6..5355b87 100644
--- libgomp/testsuite/libgomp.oacc-c/c.exp
+++ libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -67,6 +67,9 @@ foreach offload_target [concat [split $offload_targets ","] "disable"] {
     }
     set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
+    # To avoid overhead, by default only build for the offload target that
+    # we're actually going to test.
+    set tagopt "$tagopt -foffload=$offload_target"
     setenv ACC_DEVICE_TYPE $openacc_device_type
 
     # To get better test coverage for device-specific code that is only
diff --git libgomp/testsuite/libgomp.oacc-fortran/fortran.exp libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
index 7ce92c0..8507b67 100644
--- libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
+++ libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
@@ -93,6 +93,9 @@ if { $lang_test_file_found } {
 	}
 	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
+	# To avoid overhead, by default only build for the offload target that
+	# we're actually going to test.
+	set tagopt "$tagopt -foffload=$offload_target"
 	setenv ACC_DEVICE_TYPE $openacc_device_type
 
 	# For Fortran we're doing torture testing, as Fortran has far more tests


For reference:

> I used the following patch to gather the
> [...] numbers:

> --- libgomp/testsuite/lib/libgomp-dg.exp
> +++ libgomp/testsuite/lib/libgomp-dg.exp
> @@ -1,3 +1,18 @@
> +rename dg-init dg-init_
> +proc dg-init { } {
> +    dg-init_
> +    global CLOCK_START
> +    set CLOCK_START [clock seconds]
> +    verbose "TIME $CLOCK_START START [info script]" 0
> +}
> +rename dg-finish dg-finish_
> +proc dg-finish { } {
> +    dg-finish_
> +    set CLOCK [clock seconds]
> +    global CLOCK_START
> +    verbose "TIME $CLOCK ([expr $CLOCK - $CLOCK_START]) END [info script]" 0
> +}
> +
>  proc libgomp-dg-test { prog do_what extra_tool_flags } {
>      return [gcc-dg-test-1 libgomp_target_compile $prog $do_what $extra_tool_flags]
>  }


Grüße
 Thomas

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

* Re: check-target-libgomp wall time, without vs. with offloading
  2016-04-28 10:44     ` check-target-libgomp wall time, without vs. with offloading Thomas Schwinge
@ 2016-04-29  7:43       ` Jakub Jelinek
  2016-05-02  9:56         ` libgomp: In OpenACC testing, cycle though $offload_targets, and by default only build for the offload target that we're actually going to test (was: check-target-libgomp wall time, without vs. with offloading) Thomas Schwinge
  0 siblings, 1 reply; 22+ messages in thread
From: Jakub Jelinek @ 2016-04-29  7:43 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches

On Thu, Apr 28, 2016 at 12:43:43PM +0200, Thomas Schwinge wrote:
> commit 3b521f3e35fdb4b320e95b5f6a82b8d89399481a
> Author: Thomas Schwinge <thomas@codesourcery.com>
> Date:   Thu Apr 21 11:36:39 2016 +0200
> 
>     libgomp: Unconfuse offload plugins vs. offload targets

I don't like this patch at all, rather than unconfusing stuff it
makes stuff confusing.  Plugins are just a way to support various
offloading targets.

Can you please post just a short patch without all those changes
that does what you want, rather than renaming everything at the same time?

	Jakub

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

* libgomp: In OpenACC testing, cycle though $offload_targets, and by default only build for the offload target that we're actually going to test (was: check-target-libgomp wall time, without vs. with offloading)
  2016-04-29  7:43       ` Jakub Jelinek
@ 2016-05-02  9:56         ` Thomas Schwinge
  2016-05-11 13:45           ` libgomp: In OpenACC testing, cycle though $offload_targets, and by default only build for the offload target that we're actually going to test Thomas Schwinge
  0 siblings, 1 reply; 22+ messages in thread
From: Thomas Schwinge @ 2016-05-02  9:56 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

Hi Jakub!

On Fri, 29 Apr 2016 09:43:41 +0200, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Apr 28, 2016 at 12:43:43PM +0200, Thomas Schwinge wrote:
> > commit 3b521f3e35fdb4b320e95b5f6a82b8d89399481a
> > Author: Thomas Schwinge <thomas@codesourcery.com>
> > Date:   Thu Apr 21 11:36:39 2016 +0200
> > 
> >     libgomp: Unconfuse offload plugins vs. offload targets
> 
> I don't like this patch at all, rather than unconfusing stuff it
> makes stuff confusing.  Plugins are just a way to support various
> offloading targets.

Huh; my patch exactly clarifies that the offload_targets variable does
not actually list offload target names, but does list libgomp offload
plugin names...

> Can you please post just a short patch without all those changes
> that does what you want, rather than renaming everything at the same time?

I thought incremental, self-contained patches were easier to review.
Anyway, here's the three patches merged into one:

commit 8060ae3474072eef685381d80f566d1c0942c603
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Thu Apr 21 11:36:39 2016 +0200

    libgomp: In OpenACC testing, cycle though $offload_targets, and by default only build for the offload target that we're actually going to test
    
    	libgomp/
    	* plugin/configfrag.ac (offload_targets): Actually enumerate
    	offload targets, and add...
    	(offload_plugins): ... this one to enumerate offload plugins.
    	(OFFLOAD_PLUGINS): Renamed from OFFLOAD_TARGETS.
    	* target.c (gomp_target_init): Adjust to that.
    	* testsuite/lib/libgomp.exp: Likewise.
    	(offload_targets_s, offload_targets_s_openacc): Remove variables.
    	(offload_target_to_openacc_device_type): New proc.
    	(check_effective_target_openacc_nvidia_accel_selected)
    	(check_effective_target_openacc_host_selected): Examine
    	$openacc_device_type instead of $offload_target_openacc.
    	* Makefile.in: Regenerate.
    	* config.h.in: Likewise.
    	* configure: Likewise.
    	* testsuite/Makefile.in: Likewise.
    	* testsuite/libgomp.oacc-c++/c++.exp: Cycle through
    	$offload_targets (plus "disable") instead of
    	$offload_targets_s_openacc, and add "-foffload=$offload_target" to
    	tagopt.
    	* testsuite/libgomp.oacc-c/c.exp: Likewise.
    	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
---
 libgomp/Makefile.in                                |  1 +
 libgomp/config.h.in                                |  4 +-
 libgomp/configure                                  | 44 +++++++------
 libgomp/plugin/configfrag.ac                       | 39 +++++++-----
 libgomp/target.c                                   |  8 +--
 libgomp/testsuite/Makefile.in                      |  1 +
 libgomp/testsuite/lib/libgomp.exp                  | 72 ++++++++++------------
 libgomp/testsuite/libgomp.oacc-c++/c++.exp         | 30 +++++----
 libgomp/testsuite/libgomp.oacc-c/c.exp             | 30 +++++----
 libgomp/testsuite/libgomp.oacc-fortran/fortran.exp | 22 ++++---
 10 files changed, 142 insertions(+), 109 deletions(-)

diff --git libgomp/Makefile.in libgomp/Makefile.in
[snipped]
diff --git libgomp/config.h.in libgomp/config.h.in
[snipped]
diff --git libgomp/configure libgomp/configure
[snipped]
diff --git libgomp/plugin/configfrag.ac libgomp/plugin/configfrag.ac
index 88b4156..de0a6f6 100644
--- libgomp/plugin/configfrag.ac
+++ libgomp/plugin/configfrag.ac
@@ -26,8 +26,6 @@
 # see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-offload_targets=
-AC_SUBST(offload_targets)
 plugin_support=yes
 AC_CHECK_LIB(dl, dlsym, , [plugin_support=no])
 if test x"$plugin_support" = xyes; then
@@ -142,7 +140,13 @@ AC_SUBST(PLUGIN_HSA_LIBS)
 
 
 
-# Get offload targets and path to install tree of offloading compiler.
+# Parse offload targets, and figure out libgomp plugin, and configure the
+# corresponding offload compiler.  offload_plugins and offload_targets will be
+# populated in the same order.
+offload_plugins=
+offload_targets=
+AC_SUBST(offload_plugins)
+AC_SUBST(offload_targets)
 offload_additional_options=
 offload_additional_lib_paths=
 AC_SUBST(offload_additional_options)
@@ -151,13 +155,13 @@ if test x"$enable_offload_targets" != x; then
   for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
     tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
     tgt=`echo $tgt | sed 's/=.*//'`
-    tgt_name=
+    tgt_plugin=
     case $tgt in
       *-intelmic-* | *-intelmicemul-*)
-	tgt_name=intelmic
+	tgt_plugin=intelmic
 	;;
       nvptx*)
-        tgt_name=nvptx
+	tgt_plugin=nvptx
 	PLUGIN_NVPTX=$tgt
 	PLUGIN_NVPTX_CPPFLAGS=$CUDA_DRIVER_CPPFLAGS
 	PLUGIN_NVPTX_LDFLAGS=$CUDA_DRIVER_LDFLAGS
@@ -184,7 +188,7 @@ if test x"$enable_offload_targets" != x; then
 	    ;;
 	esac
 	;;
-      hsa*)
+      hsa)
 	case "${target}" in
 	  x86_64-*-*)
 	    case " ${CC} ${CFLAGS} " in
@@ -192,7 +196,7 @@ if test x"$enable_offload_targets" != x; then
 	        PLUGIN_HSA=0
 		;;
 	      *)
-	        tgt_name=hsa
+		tgt_plugin=hsa
 	        PLUGIN_HSA=$tgt
 	        PLUGIN_HSA_CPPFLAGS=$HSA_RUNTIME_CPPFLAGS
 	        PLUGIN_HSA_LDFLAGS="$HSA_RUNTIME_LDFLAGS $HSA_KMT_LDFLAGS"
@@ -214,7 +218,7 @@ if test x"$enable_offload_targets" != x; then
 	        LDFLAGS=$PLUGIN_HSA_save_LDFLAGS
 	        LIBS=$PLUGIN_HSA_save_LIBS
 	        case $PLUGIN_HSA in
-	          hsa*)
+		  hsa)
 	            HSA_PLUGIN=0
 	            AC_MSG_ERROR([HSA run-time package required for HSA support])
 	            ;;
@@ -231,16 +235,19 @@ if test x"$enable_offload_targets" != x; then
 	AC_MSG_ERROR([unknown offload target specified])
 	;;
     esac
-    if test x"$tgt_name" = x; then
+    if test x"$tgt_plugin" = x; then
       # Don't configure libgomp for this offloading target if we don't build
       # the corresponding plugin.
       continue
-    elif test x"$offload_targets" = x; then
-      offload_targets=$tgt_name
+    elif test x"$offload_plugins" = x; then
+      offload_plugins=$tgt_plugin
+      offload_targets=$tgt
     else
-      offload_targets=$offload_targets,$tgt_name
+      offload_plugins=$offload_plugins,$tgt_plugin
+      offload_targets=$offload_targets,$tgt
     fi
-    if test "$tgt_name" = hsa; then
+    # Configure additional search paths.
+    if test "$tgt_plugin" = hsa; then
       # Offloading compilation is all handled by the target compiler.
       :
     elif test x"$tgt_dir" != x; then
@@ -252,8 +259,8 @@ if test x"$enable_offload_targets" != x; then
     fi
   done
 fi
-AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
-  [Define to offload targets, separated by commas.])
+AC_DEFINE_UNQUOTED(OFFLOAD_PLUGINS, "$offload_plugins",
+  [Define to offload plugins, separated by commas.])
 AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1])
 AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLUGIN_NVPTX],
   [Define to 1 if the NVIDIA plugin is built, 0 if not.])
diff --git libgomp/target.c libgomp/target.c
index e2dd0e0..c12c085 100644
--- libgomp/target.c
+++ libgomp/target.c
@@ -2467,9 +2467,9 @@ gomp_target_fini (void)
     }
 }
 
-/* This function initializes the runtime needed for offloading.
-   It parses the list of offload targets and tries to load the plugins for
-   these targets.  On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
+/* This function initializes the runtime for offloading.
+   It parses the list of offload plugins, and tries to load these.
+   On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
    will be set, and the array DEVICES initialized, containing descriptors for
    corresponding devices, first the GOMP_OFFLOAD_CAP_OPENMP_400 ones, follows
    by the others.  */
@@ -2486,7 +2486,7 @@ gomp_target_init (void)
   num_devices = 0;
   devices = NULL;
 
-  cur = OFFLOAD_TARGETS;
+  cur = OFFLOAD_PLUGINS;
   if (*cur)
     do
       {
diff --git libgomp/testsuite/Makefile.in libgomp/testsuite/Makefile.in
[snipped]
diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp
index 1cb4991..4a25421 100644
--- libgomp/testsuite/lib/libgomp.exp
+++ libgomp/testsuite/lib/libgomp.exp
@@ -36,28 +36,6 @@ load_gcc_lib fortran-modules.exp
 # Try to load a test support file, built during libgomp configuration.
 load_file libgomp-test-support.exp
 
-# Populate offload_targets_s (offloading targets separated by a space), and
-# offload_targets_s_openacc (the same, but with OpenACC names; OpenACC spells
-# some of them a little differently).
-set offload_targets_s [split $offload_targets ","]
-set offload_targets_s_openacc {}
-foreach offload_target_openacc $offload_targets_s {
-    # Translate to OpenACC names, or skip if not yet supported.
-    switch $offload_target_openacc {
-	intelmic {
-	    continue
-	}
-	nvptx {
-	    set offload_target_openacc "nvidia"
-	}
-	hsa {
-	    continue
-	}
-    }
-    lappend offload_targets_s_openacc "$offload_target_openacc"
-}
-lappend offload_targets_s_openacc "host"
-
 set dg-do-what-default run
 
 #
@@ -135,9 +113,9 @@ proc libgomp_init { args } {
     set always_ld_library_path ".:${blddir}/.libs"
 
     # Add liboffloadmic build directory in LD_LIBRARY_PATH to support
-    # non-fallback testing for Intel MIC targets
+    # Intel MIC offloading testing.
     global offload_targets
-    if { [string match "*,intelmic,*" ",$offload_targets,"] } {
+    if { [string match "*,*-intelmic*,*" ",$offload_targets,"] } {
 	append always_ld_library_path ":${blddir}/../liboffloadmic/.libs"
 	append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
 	# libstdc++ is required by liboffloadmic
@@ -245,8 +223,7 @@ proc libgomp_init { args } {
     # Disable color diagnostics
     lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
 
-    # Used for support non-fallback offloading.
-    # Help GCC to find target mkoffload.
+    # Help GCC to find offload compilers' mkoffload.
     global offload_additional_options
     if { $offload_additional_options != "" } {
 	lappend ALWAYS_CFLAGS "additional_flags=${offload_additional_options}"
@@ -322,6 +299,28 @@ proc libgomp_option_proc { option } {
     }
 }
 
+# Translate offload target to OpenACC device type.  Return the empty string if
+# not suitable or not yet supported, and "host" for offload target "disable".
+proc offload_target_to_openacc_device_type { offload_target } {
+    switch -glob $offload_target {
+	disable {
+	    return "host"
+	}
+	hsa {
+	    return ""
+	}
+	*-intelmic* {
+	    return ""
+	}
+	nvptx* {
+	    return "nvidia"
+	}
+	default {
+	    error "Unknwon offload target: $offload_target"
+	}
+    }
+}
+
 # Return 1 if offload device is available.
 proc check_effective_target_offload_device { } {
     return [check_runtime_nocache offload_device_available_ {
@@ -373,29 +372,22 @@ proc check_effective_target_openacc_nvidia_accel_present { } {
     } "" ]
 }
 
-# Return 1 if at least one nvidia board is present, and the nvidia device type
-# is selected by default by means of setting the environment variable
-# ACC_DEVICE_TYPE.
+# Return 1 if at least one nvidia board is present, and the OpenACC "nvidia"
+# device type is selected.
 
 proc check_effective_target_openacc_nvidia_accel_selected { } {
     if { ![check_effective_target_openacc_nvidia_accel_present] } {
 	return 0;
     }
-    global offload_target_openacc
-    if { $offload_target_openacc == "nvidia" } {
-        return 1;
-    }
-    return 0;
+    global openacc_device_type
+    return [string match "nvidia" $openacc_device_type]
 }
 
-# Return 1 if the host target is selected for offloaded
+# Return 1 if the OpenACC "host" device type is selected.
 
 proc check_effective_target_openacc_host_selected { } {
-    global offload_target_openacc
-    if { $offload_target_openacc == "host" } {
-        return 1;
-    }
-    return 0;
+    global openacc_device_type
+    return [string match "host" $openacc_device_type]
 }
 
 # Return 1 if the selected OMP device is actually a HSA device
diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
index 608b298..befb921 100644
--- libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -70,18 +70,23 @@ if { $lang_test_file_found } {
 	set libstdcxx_includes ""
     }
 
-    # Test OpenACC with available accelerators.
-    foreach offload_target_openacc $offload_targets_s_openacc {
-	set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
+    # Test with all offload targets, and with offloading disabled.
+    foreach offload_target [concat [split $offload_targets ","] "disable"] {
+	set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
+	set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
 
-	switch $offload_target_openacc {
-	    host {
+	switch $openacc_device_type {
+	    "" {
+		untested "$subdir $offload_target offloading"
+		continue
+	    }
+	    "host" {
 		set acc_mem_shared 1
 	    }
-	    nvidia {
+	    "nvidia" {
 		if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		    # Don't bother; execution testing is going to FAIL.
-		    untested "$subdir $offload_target_openacc offloading"
+		    untested "$subdir $offload_target offloading"
 		    continue
 		}
 
@@ -94,12 +99,15 @@ if { $lang_test_file_found } {
 		set acc_mem_shared 0
 	    }
 	    default {
-		set acc_mem_shared 0
+		error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
 	    }
 	}
 	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
-	setenv ACC_DEVICE_TYPE $offload_target_openacc
+	# To avoid overhead, by default only build for the offload target that
+	# we're actually going to test.
+	set tagopt "$tagopt -foffload=$offload_target"
+	setenv ACC_DEVICE_TYPE $openacc_device_type
 
 	# To get better test coverage for device-specific code that is only
 	# ever used in offloading configurations, we'd like more thorough
@@ -108,8 +116,8 @@ if { $lang_test_file_found } {
 	# -O0 and -O2 only, to avoid testing times exploding too much, under
 	# the assumption that between -O0 and -O[something] there is the
 	# biggest difference in the overall structure of the generated code.
-	switch $offload_target_openacc {
-	    host {
+	switch $offload_target {
+	    "disable" {
 		set-torture-options [list \
 					 { -O2 } ]
 	    }
diff --git libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
index b509a10..5355b87 100644
--- libgomp/testsuite/libgomp.oacc-c/c.exp
+++ libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -31,20 +31,25 @@ set ld_library_path $always_ld_library_path
 append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
 set_ld_library_path_env_vars
 
-# Test OpenACC with available accelerators.
+# Test with all offload targets, and with offloading disabled.
 set SAVE_ALWAYS_CFLAGS "$ALWAYS_CFLAGS"
-foreach offload_target_openacc $offload_targets_s_openacc {
+foreach offload_target [concat [split $offload_targets ","] "disable"] {
     set ALWAYS_CFLAGS "$SAVE_ALWAYS_CFLAGS"
-    set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
+    set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
+    set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
 
-    switch $offload_target_openacc {
-	host {
+    switch $openacc_device_type {
+	"" {
+	    untested "$subdir $offload_target offloading"
+	    continue
+	}
+	"host" {
 	    set acc_mem_shared 1
 	}
-	nvidia {
+	"nvidia" {
 	    if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		# Don't bother; execution testing is going to FAIL.
-		untested "$subdir $offload_target_openacc offloading"
+		untested "$subdir $offload_target offloading"
 		continue
 	    }
 
@@ -57,12 +62,15 @@ foreach offload_target_openacc $offload_targets_s_openacc {
 	    set acc_mem_shared 0
 	}
 	default {
-	    set acc_mem_shared 0
+	    error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
 	}
     }
     set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
-    setenv ACC_DEVICE_TYPE $offload_target_openacc
+    # To avoid overhead, by default only build for the offload target that
+    # we're actually going to test.
+    set tagopt "$tagopt -foffload=$offload_target"
+    setenv ACC_DEVICE_TYPE $openacc_device_type
 
     # To get better test coverage for device-specific code that is only
     # ever used in offloading configurations, we'd like more thorough
@@ -71,8 +79,8 @@ foreach offload_target_openacc $offload_targets_s_openacc {
     # -O0 and -O2 only, to avoid testing times exploding too much, under
     # the assumption that between -O0 and -O[something] there is the
     # biggest difference in the overall structure of the generated code.
-    switch $offload_target_openacc {
-	host {
+    switch $offload_target {
+	"disable" {
 	    set-torture-options [list \
 				     { -O2 } ]
 	}
diff --git libgomp/testsuite/libgomp.oacc-fortran/fortran.exp libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
index 2d6b647..8507b67 100644
--- libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
+++ libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
@@ -65,30 +65,38 @@ if { $lang_test_file_found } {
     append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
     set_ld_library_path_env_vars
 
-    # Test OpenACC with available accelerators.
-    foreach offload_target_openacc $offload_targets_s_openacc {
-	set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
+    # Test with all offload targets, and with offloading disabled.
+    foreach offload_target [concat [split $offload_targets ","] "disable"] {
+	set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
+	set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
 
-	switch $offload_target_openacc {
+	switch $openacc_device_type {
+	    "" {
+		untested "$subdir $offload_target offloading"
+		continue
+	    }
 	    host {
 		set acc_mem_shared 1
 	    }
 	    nvidia {
 		if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		    # Don't bother; execution testing is going to FAIL.
-		    untested "$subdir $offload_target_openacc offloading"
+		    untested "$subdir $offload_target offloading"
 		    continue
 		}
 
 		set acc_mem_shared 0
 	    }
 	    default {
-		set acc_mem_shared 0
+		error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
 	    }
 	}
 	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
-	setenv ACC_DEVICE_TYPE $offload_target_openacc
+	# To avoid overhead, by default only build for the offload target that
+	# we're actually going to test.
+	set tagopt "$tagopt -foffload=$offload_target"
+	setenv ACC_DEVICE_TYPE $openacc_device_type
 
 	# For Fortran we're doing torture testing, as Fortran has far more tests
 	# with arrays etc. that testing just -O0 or -O2 is insufficient, that is


Grüße
 Thomas

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

* Re: libgomp: In OpenACC testing, cycle though $offload_targets, and by default only build for the offload target that we're actually going to test
  2016-05-02  9:56         ` libgomp: In OpenACC testing, cycle though $offload_targets, and by default only build for the offload target that we're actually going to test (was: check-target-libgomp wall time, without vs. with offloading) Thomas Schwinge
@ 2016-05-11 13:45           ` Thomas Schwinge
  2016-05-18 11:42             ` Thomas Schwinge
  0 siblings, 1 reply; 22+ messages in thread
From: Thomas Schwinge @ 2016-05-11 13:45 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

Hi!

Ping.

On Mon, 02 May 2016 11:54:27 +0200, I wrote:
> On Fri, 29 Apr 2016 09:43:41 +0200, Jakub Jelinek <jakub@redhat.com> wrote:
> > On Thu, Apr 28, 2016 at 12:43:43PM +0200, Thomas Schwinge wrote:
> > > commit 3b521f3e35fdb4b320e95b5f6a82b8d89399481a
> > > Author: Thomas Schwinge <thomas@codesourcery.com>
> > > Date:   Thu Apr 21 11:36:39 2016 +0200
> > > 
> > >     libgomp: Unconfuse offload plugins vs. offload targets
> > 
> > I don't like this patch at all, rather than unconfusing stuff it
> > makes stuff confusing.  Plugins are just a way to support various
> > offloading targets.
> 
> Huh; my patch exactly clarifies that the offload_targets variable does
> not actually list offload target names, but does list libgomp offload
> plugin names...
> 
> > Can you please post just a short patch without all those changes
> > that does what you want, rather than renaming everything at the same time?
> 
> I thought incremental, self-contained patches were easier to review.
> Anyway, here's the three patches merged into one:
> 
> commit 8060ae3474072eef685381d80f566d1c0942c603
> Author: Thomas Schwinge <thomas@codesourcery.com>
> Date:   Thu Apr 21 11:36:39 2016 +0200
> 
>     libgomp: In OpenACC testing, cycle though $offload_targets, and by default only build for the offload target that we're actually going to test
>     
>     	libgomp/
>     	* plugin/configfrag.ac (offload_targets): Actually enumerate
>     	offload targets, and add...
>     	(offload_plugins): ... this one to enumerate offload plugins.
>     	(OFFLOAD_PLUGINS): Renamed from OFFLOAD_TARGETS.
>     	* target.c (gomp_target_init): Adjust to that.
>     	* testsuite/lib/libgomp.exp: Likewise.
>     	(offload_targets_s, offload_targets_s_openacc): Remove variables.
>     	(offload_target_to_openacc_device_type): New proc.
>     	(check_effective_target_openacc_nvidia_accel_selected)
>     	(check_effective_target_openacc_host_selected): Examine
>     	$openacc_device_type instead of $offload_target_openacc.
>     	* Makefile.in: Regenerate.
>     	* config.h.in: Likewise.
>     	* configure: Likewise.
>     	* testsuite/Makefile.in: Likewise.
>     	* testsuite/libgomp.oacc-c++/c++.exp: Cycle through
>     	$offload_targets (plus "disable") instead of
>     	$offload_targets_s_openacc, and add "-foffload=$offload_target" to
>     	tagopt.
>     	* testsuite/libgomp.oacc-c/c.exp: Likewise.
>     	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
> ---
>  libgomp/Makefile.in                                |  1 +
>  libgomp/config.h.in                                |  4 +-
>  libgomp/configure                                  | 44 +++++++------
>  libgomp/plugin/configfrag.ac                       | 39 +++++++-----
>  libgomp/target.c                                   |  8 +--
>  libgomp/testsuite/Makefile.in                      |  1 +
>  libgomp/testsuite/lib/libgomp.exp                  | 72 ++++++++++------------
>  libgomp/testsuite/libgomp.oacc-c++/c++.exp         | 30 +++++----
>  libgomp/testsuite/libgomp.oacc-c/c.exp             | 30 +++++----
>  libgomp/testsuite/libgomp.oacc-fortran/fortran.exp | 22 ++++---
>  10 files changed, 142 insertions(+), 109 deletions(-)
> 
> diff --git libgomp/Makefile.in libgomp/Makefile.in
> [snipped]
> diff --git libgomp/config.h.in libgomp/config.h.in
> [snipped]
> diff --git libgomp/configure libgomp/configure
> [snipped]
> diff --git libgomp/plugin/configfrag.ac libgomp/plugin/configfrag.ac
> index 88b4156..de0a6f6 100644
> --- libgomp/plugin/configfrag.ac
> +++ libgomp/plugin/configfrag.ac
> @@ -26,8 +26,6 @@
>  # see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
>  # <http://www.gnu.org/licenses/>.
>  
> -offload_targets=
> -AC_SUBST(offload_targets)
>  plugin_support=yes
>  AC_CHECK_LIB(dl, dlsym, , [plugin_support=no])
>  if test x"$plugin_support" = xyes; then
> @@ -142,7 +140,13 @@ AC_SUBST(PLUGIN_HSA_LIBS)
>  
>  
>  
> -# Get offload targets and path to install tree of offloading compiler.
> +# Parse offload targets, and figure out libgomp plugin, and configure the
> +# corresponding offload compiler.  offload_plugins and offload_targets will be
> +# populated in the same order.
> +offload_plugins=
> +offload_targets=
> +AC_SUBST(offload_plugins)
> +AC_SUBST(offload_targets)
>  offload_additional_options=
>  offload_additional_lib_paths=
>  AC_SUBST(offload_additional_options)
> @@ -151,13 +155,13 @@ if test x"$enable_offload_targets" != x; then
>    for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
>      tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
>      tgt=`echo $tgt | sed 's/=.*//'`
> -    tgt_name=
> +    tgt_plugin=
>      case $tgt in
>        *-intelmic-* | *-intelmicemul-*)
> -	tgt_name=intelmic
> +	tgt_plugin=intelmic
>  	;;
>        nvptx*)
> -        tgt_name=nvptx
> +	tgt_plugin=nvptx
>  	PLUGIN_NVPTX=$tgt
>  	PLUGIN_NVPTX_CPPFLAGS=$CUDA_DRIVER_CPPFLAGS
>  	PLUGIN_NVPTX_LDFLAGS=$CUDA_DRIVER_LDFLAGS
> @@ -184,7 +188,7 @@ if test x"$enable_offload_targets" != x; then
>  	    ;;
>  	esac
>  	;;
> -      hsa*)
> +      hsa)
>  	case "${target}" in
>  	  x86_64-*-*)
>  	    case " ${CC} ${CFLAGS} " in
> @@ -192,7 +196,7 @@ if test x"$enable_offload_targets" != x; then
>  	        PLUGIN_HSA=0
>  		;;
>  	      *)
> -	        tgt_name=hsa
> +		tgt_plugin=hsa
>  	        PLUGIN_HSA=$tgt
>  	        PLUGIN_HSA_CPPFLAGS=$HSA_RUNTIME_CPPFLAGS
>  	        PLUGIN_HSA_LDFLAGS="$HSA_RUNTIME_LDFLAGS $HSA_KMT_LDFLAGS"
> @@ -214,7 +218,7 @@ if test x"$enable_offload_targets" != x; then
>  	        LDFLAGS=$PLUGIN_HSA_save_LDFLAGS
>  	        LIBS=$PLUGIN_HSA_save_LIBS
>  	        case $PLUGIN_HSA in
> -	          hsa*)
> +		  hsa)
>  	            HSA_PLUGIN=0
>  	            AC_MSG_ERROR([HSA run-time package required for HSA support])
>  	            ;;
> @@ -231,16 +235,19 @@ if test x"$enable_offload_targets" != x; then
>  	AC_MSG_ERROR([unknown offload target specified])
>  	;;
>      esac
> -    if test x"$tgt_name" = x; then
> +    if test x"$tgt_plugin" = x; then
>        # Don't configure libgomp for this offloading target if we don't build
>        # the corresponding plugin.
>        continue
> -    elif test x"$offload_targets" = x; then
> -      offload_targets=$tgt_name
> +    elif test x"$offload_plugins" = x; then
> +      offload_plugins=$tgt_plugin
> +      offload_targets=$tgt
>      else
> -      offload_targets=$offload_targets,$tgt_name
> +      offload_plugins=$offload_plugins,$tgt_plugin
> +      offload_targets=$offload_targets,$tgt
>      fi
> -    if test "$tgt_name" = hsa; then
> +    # Configure additional search paths.
> +    if test "$tgt_plugin" = hsa; then
>        # Offloading compilation is all handled by the target compiler.
>        :
>      elif test x"$tgt_dir" != x; then
> @@ -252,8 +259,8 @@ if test x"$enable_offload_targets" != x; then
>      fi
>    done
>  fi
> -AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
> -  [Define to offload targets, separated by commas.])
> +AC_DEFINE_UNQUOTED(OFFLOAD_PLUGINS, "$offload_plugins",
> +  [Define to offload plugins, separated by commas.])
>  AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1])
>  AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLUGIN_NVPTX],
>    [Define to 1 if the NVIDIA plugin is built, 0 if not.])
> diff --git libgomp/target.c libgomp/target.c
> index e2dd0e0..c12c085 100644
> --- libgomp/target.c
> +++ libgomp/target.c
> @@ -2467,9 +2467,9 @@ gomp_target_fini (void)
>      }
>  }
>  
> -/* This function initializes the runtime needed for offloading.
> -   It parses the list of offload targets and tries to load the plugins for
> -   these targets.  On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
> +/* This function initializes the runtime for offloading.
> +   It parses the list of offload plugins, and tries to load these.
> +   On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
>     will be set, and the array DEVICES initialized, containing descriptors for
>     corresponding devices, first the GOMP_OFFLOAD_CAP_OPENMP_400 ones, follows
>     by the others.  */
> @@ -2486,7 +2486,7 @@ gomp_target_init (void)
>    num_devices = 0;
>    devices = NULL;
>  
> -  cur = OFFLOAD_TARGETS;
> +  cur = OFFLOAD_PLUGINS;
>    if (*cur)
>      do
>        {
> diff --git libgomp/testsuite/Makefile.in libgomp/testsuite/Makefile.in
> [snipped]
> diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp
> index 1cb4991..4a25421 100644
> --- libgomp/testsuite/lib/libgomp.exp
> +++ libgomp/testsuite/lib/libgomp.exp
> @@ -36,28 +36,6 @@ load_gcc_lib fortran-modules.exp
>  # Try to load a test support file, built during libgomp configuration.
>  load_file libgomp-test-support.exp
>  
> -# Populate offload_targets_s (offloading targets separated by a space), and
> -# offload_targets_s_openacc (the same, but with OpenACC names; OpenACC spells
> -# some of them a little differently).
> -set offload_targets_s [split $offload_targets ","]
> -set offload_targets_s_openacc {}
> -foreach offload_target_openacc $offload_targets_s {
> -    # Translate to OpenACC names, or skip if not yet supported.
> -    switch $offload_target_openacc {
> -	intelmic {
> -	    continue
> -	}
> -	nvptx {
> -	    set offload_target_openacc "nvidia"
> -	}
> -	hsa {
> -	    continue
> -	}
> -    }
> -    lappend offload_targets_s_openacc "$offload_target_openacc"
> -}
> -lappend offload_targets_s_openacc "host"
> -
>  set dg-do-what-default run
>  
>  #
> @@ -135,9 +113,9 @@ proc libgomp_init { args } {
>      set always_ld_library_path ".:${blddir}/.libs"
>  
>      # Add liboffloadmic build directory in LD_LIBRARY_PATH to support
> -    # non-fallback testing for Intel MIC targets
> +    # Intel MIC offloading testing.
>      global offload_targets
> -    if { [string match "*,intelmic,*" ",$offload_targets,"] } {
> +    if { [string match "*,*-intelmic*,*" ",$offload_targets,"] } {
>  	append always_ld_library_path ":${blddir}/../liboffloadmic/.libs"
>  	append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
>  	# libstdc++ is required by liboffloadmic
> @@ -245,8 +223,7 @@ proc libgomp_init { args } {
>      # Disable color diagnostics
>      lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
>  
> -    # Used for support non-fallback offloading.
> -    # Help GCC to find target mkoffload.
> +    # Help GCC to find offload compilers' mkoffload.
>      global offload_additional_options
>      if { $offload_additional_options != "" } {
>  	lappend ALWAYS_CFLAGS "additional_flags=${offload_additional_options}"
> @@ -322,6 +299,28 @@ proc libgomp_option_proc { option } {
>      }
>  }
>  
> +# Translate offload target to OpenACC device type.  Return the empty string if
> +# not suitable or not yet supported, and "host" for offload target "disable".
> +proc offload_target_to_openacc_device_type { offload_target } {
> +    switch -glob $offload_target {
> +	disable {
> +	    return "host"
> +	}
> +	hsa {
> +	    return ""
> +	}
> +	*-intelmic* {
> +	    return ""
> +	}
> +	nvptx* {
> +	    return "nvidia"
> +	}
> +	default {
> +	    error "Unknwon offload target: $offload_target"
> +	}
> +    }
> +}
> +
>  # Return 1 if offload device is available.
>  proc check_effective_target_offload_device { } {
>      return [check_runtime_nocache offload_device_available_ {
> @@ -373,29 +372,22 @@ proc check_effective_target_openacc_nvidia_accel_present { } {
>      } "" ]
>  }
>  
> -# Return 1 if at least one nvidia board is present, and the nvidia device type
> -# is selected by default by means of setting the environment variable
> -# ACC_DEVICE_TYPE.
> +# Return 1 if at least one nvidia board is present, and the OpenACC "nvidia"
> +# device type is selected.
>  
>  proc check_effective_target_openacc_nvidia_accel_selected { } {
>      if { ![check_effective_target_openacc_nvidia_accel_present] } {
>  	return 0;
>      }
> -    global offload_target_openacc
> -    if { $offload_target_openacc == "nvidia" } {
> -        return 1;
> -    }
> -    return 0;
> +    global openacc_device_type
> +    return [string match "nvidia" $openacc_device_type]
>  }
>  
> -# Return 1 if the host target is selected for offloaded
> +# Return 1 if the OpenACC "host" device type is selected.
>  
>  proc check_effective_target_openacc_host_selected { } {
> -    global offload_target_openacc
> -    if { $offload_target_openacc == "host" } {
> -        return 1;
> -    }
> -    return 0;
> +    global openacc_device_type
> +    return [string match "host" $openacc_device_type]
>  }
>  
>  # Return 1 if the selected OMP device is actually a HSA device
> diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
> index 608b298..befb921 100644
> --- libgomp/testsuite/libgomp.oacc-c++/c++.exp
> +++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
> @@ -70,18 +70,23 @@ if { $lang_test_file_found } {
>  	set libstdcxx_includes ""
>      }
>  
> -    # Test OpenACC with available accelerators.
> -    foreach offload_target_openacc $offload_targets_s_openacc {
> -	set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
> +    # Test with all offload targets, and with offloading disabled.
> +    foreach offload_target [concat [split $offload_targets ","] "disable"] {
> +	set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
> +	set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
>  
> -	switch $offload_target_openacc {
> -	    host {
> +	switch $openacc_device_type {
> +	    "" {
> +		untested "$subdir $offload_target offloading"
> +		continue
> +	    }
> +	    "host" {
>  		set acc_mem_shared 1
>  	    }
> -	    nvidia {
> +	    "nvidia" {
>  		if { ![check_effective_target_openacc_nvidia_accel_present] } {
>  		    # Don't bother; execution testing is going to FAIL.
> -		    untested "$subdir $offload_target_openacc offloading"
> +		    untested "$subdir $offload_target offloading"
>  		    continue
>  		}
>  
> @@ -94,12 +99,15 @@ if { $lang_test_file_found } {
>  		set acc_mem_shared 0
>  	    }
>  	    default {
> -		set acc_mem_shared 0
> +		error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
>  	    }
>  	}
>  	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
>  
> -	setenv ACC_DEVICE_TYPE $offload_target_openacc
> +	# To avoid overhead, by default only build for the offload target that
> +	# we're actually going to test.
> +	set tagopt "$tagopt -foffload=$offload_target"
> +	setenv ACC_DEVICE_TYPE $openacc_device_type
>  
>  	# To get better test coverage for device-specific code that is only
>  	# ever used in offloading configurations, we'd like more thorough
> @@ -108,8 +116,8 @@ if { $lang_test_file_found } {
>  	# -O0 and -O2 only, to avoid testing times exploding too much, under
>  	# the assumption that between -O0 and -O[something] there is the
>  	# biggest difference in the overall structure of the generated code.
> -	switch $offload_target_openacc {
> -	    host {
> +	switch $offload_target {
> +	    "disable" {
>  		set-torture-options [list \
>  					 { -O2 } ]
>  	    }
> diff --git libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
> index b509a10..5355b87 100644
> --- libgomp/testsuite/libgomp.oacc-c/c.exp
> +++ libgomp/testsuite/libgomp.oacc-c/c.exp
> @@ -31,20 +31,25 @@ set ld_library_path $always_ld_library_path
>  append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
>  set_ld_library_path_env_vars
>  
> -# Test OpenACC with available accelerators.
> +# Test with all offload targets, and with offloading disabled.
>  set SAVE_ALWAYS_CFLAGS "$ALWAYS_CFLAGS"
> -foreach offload_target_openacc $offload_targets_s_openacc {
> +foreach offload_target [concat [split $offload_targets ","] "disable"] {
>      set ALWAYS_CFLAGS "$SAVE_ALWAYS_CFLAGS"
> -    set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
> +    set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
> +    set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
>  
> -    switch $offload_target_openacc {
> -	host {
> +    switch $openacc_device_type {
> +	"" {
> +	    untested "$subdir $offload_target offloading"
> +	    continue
> +	}
> +	"host" {
>  	    set acc_mem_shared 1
>  	}
> -	nvidia {
> +	"nvidia" {
>  	    if { ![check_effective_target_openacc_nvidia_accel_present] } {
>  		# Don't bother; execution testing is going to FAIL.
> -		untested "$subdir $offload_target_openacc offloading"
> +		untested "$subdir $offload_target offloading"
>  		continue
>  	    }
>  
> @@ -57,12 +62,15 @@ foreach offload_target_openacc $offload_targets_s_openacc {
>  	    set acc_mem_shared 0
>  	}
>  	default {
> -	    set acc_mem_shared 0
> +	    error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
>  	}
>      }
>      set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
>  
> -    setenv ACC_DEVICE_TYPE $offload_target_openacc
> +    # To avoid overhead, by default only build for the offload target that
> +    # we're actually going to test.
> +    set tagopt "$tagopt -foffload=$offload_target"
> +    setenv ACC_DEVICE_TYPE $openacc_device_type
>  
>      # To get better test coverage for device-specific code that is only
>      # ever used in offloading configurations, we'd like more thorough
> @@ -71,8 +79,8 @@ foreach offload_target_openacc $offload_targets_s_openacc {
>      # -O0 and -O2 only, to avoid testing times exploding too much, under
>      # the assumption that between -O0 and -O[something] there is the
>      # biggest difference in the overall structure of the generated code.
> -    switch $offload_target_openacc {
> -	host {
> +    switch $offload_target {
> +	"disable" {
>  	    set-torture-options [list \
>  				     { -O2 } ]
>  	}
> diff --git libgomp/testsuite/libgomp.oacc-fortran/fortran.exp libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
> index 2d6b647..8507b67 100644
> --- libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
> +++ libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
> @@ -65,30 +65,38 @@ if { $lang_test_file_found } {
>      append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
>      set_ld_library_path_env_vars
>  
> -    # Test OpenACC with available accelerators.
> -    foreach offload_target_openacc $offload_targets_s_openacc {
> -	set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
> +    # Test with all offload targets, and with offloading disabled.
> +    foreach offload_target [concat [split $offload_targets ","] "disable"] {
> +	set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
> +	set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
>  
> -	switch $offload_target_openacc {
> +	switch $openacc_device_type {
> +	    "" {
> +		untested "$subdir $offload_target offloading"
> +		continue
> +	    }
>  	    host {
>  		set acc_mem_shared 1
>  	    }
>  	    nvidia {
>  		if { ![check_effective_target_openacc_nvidia_accel_present] } {
>  		    # Don't bother; execution testing is going to FAIL.
> -		    untested "$subdir $offload_target_openacc offloading"
> +		    untested "$subdir $offload_target offloading"
>  		    continue
>  		}
>  
>  		set acc_mem_shared 0
>  	    }
>  	    default {
> -		set acc_mem_shared 0
> +		error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
>  	    }
>  	}
>  	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
>  
> -	setenv ACC_DEVICE_TYPE $offload_target_openacc
> +	# To avoid overhead, by default only build for the offload target that
> +	# we're actually going to test.
> +	set tagopt "$tagopt -foffload=$offload_target"
> +	setenv ACC_DEVICE_TYPE $openacc_device_type
>  
>  	# For Fortran we're doing torture testing, as Fortran has far more tests
>  	# with arrays etc. that testing just -O0 or -O2 is insufficient, that is


Grüße
 Thomas

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

* Re: libgomp: In OpenACC testing, cycle though $offload_targets, and by default only build for the offload target that we're actually going to test
  2016-05-11 13:45           ` libgomp: In OpenACC testing, cycle though $offload_targets, and by default only build for the offload target that we're actually going to test Thomas Schwinge
@ 2016-05-18 11:42             ` Thomas Schwinge
  2016-05-25  8:50               ` Thomas Schwinge
  0 siblings, 1 reply; 22+ messages in thread
From: Thomas Schwinge @ 2016-05-18 11:42 UTC (permalink / raw)
  To: Jakub Jelinek, gcc-patches

Hi!

Ping.

On Wed, 11 May 2016 15:45:13 +0200, I wrote:
> Ping.
> 
> On Mon, 02 May 2016 11:54:27 +0200, I wrote:
> > On Fri, 29 Apr 2016 09:43:41 +0200, Jakub Jelinek <jakub@redhat.com> wrote:
> > > On Thu, Apr 28, 2016 at 12:43:43PM +0200, Thomas Schwinge wrote:
> > > > commit 3b521f3e35fdb4b320e95b5f6a82b8d89399481a
> > > > Author: Thomas Schwinge <thomas@codesourcery.com>
> > > > Date:   Thu Apr 21 11:36:39 2016 +0200
> > > > 
> > > >     libgomp: Unconfuse offload plugins vs. offload targets
> > > 
> > > I don't like this patch at all, rather than unconfusing stuff it
> > > makes stuff confusing.  Plugins are just a way to support various
> > > offloading targets.
> > 
> > Huh; my patch exactly clarifies that the offload_targets variable does
> > not actually list offload target names, but does list libgomp offload
> > plugin names...
> > 
> > > Can you please post just a short patch without all those changes
> > > that does what you want, rather than renaming everything at the same time?
> > 
> > I thought incremental, self-contained patches were easier to review.
> > Anyway, here's the three patches merged into one:
> > 
> > commit 8060ae3474072eef685381d80f566d1c0942c603
> > Author: Thomas Schwinge <thomas@codesourcery.com>
> > Date:   Thu Apr 21 11:36:39 2016 +0200
> > 
> >     libgomp: In OpenACC testing, cycle though $offload_targets, and by default only build for the offload target that we're actually going to test
> >     
> >     	libgomp/
> >     	* plugin/configfrag.ac (offload_targets): Actually enumerate
> >     	offload targets, and add...
> >     	(offload_plugins): ... this one to enumerate offload plugins.
> >     	(OFFLOAD_PLUGINS): Renamed from OFFLOAD_TARGETS.
> >     	* target.c (gomp_target_init): Adjust to that.
> >     	* testsuite/lib/libgomp.exp: Likewise.
> >     	(offload_targets_s, offload_targets_s_openacc): Remove variables.
> >     	(offload_target_to_openacc_device_type): New proc.
> >     	(check_effective_target_openacc_nvidia_accel_selected)
> >     	(check_effective_target_openacc_host_selected): Examine
> >     	$openacc_device_type instead of $offload_target_openacc.
> >     	* Makefile.in: Regenerate.
> >     	* config.h.in: Likewise.
> >     	* configure: Likewise.
> >     	* testsuite/Makefile.in: Likewise.
> >     	* testsuite/libgomp.oacc-c++/c++.exp: Cycle through
> >     	$offload_targets (plus "disable") instead of
> >     	$offload_targets_s_openacc, and add "-foffload=$offload_target" to
> >     	tagopt.
> >     	* testsuite/libgomp.oacc-c/c.exp: Likewise.
> >     	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
> > ---
> >  libgomp/Makefile.in                                |  1 +
> >  libgomp/config.h.in                                |  4 +-
> >  libgomp/configure                                  | 44 +++++++------
> >  libgomp/plugin/configfrag.ac                       | 39 +++++++-----
> >  libgomp/target.c                                   |  8 +--
> >  libgomp/testsuite/Makefile.in                      |  1 +
> >  libgomp/testsuite/lib/libgomp.exp                  | 72 ++++++++++------------
> >  libgomp/testsuite/libgomp.oacc-c++/c++.exp         | 30 +++++----
> >  libgomp/testsuite/libgomp.oacc-c/c.exp             | 30 +++++----
> >  libgomp/testsuite/libgomp.oacc-fortran/fortran.exp | 22 ++++---
> >  10 files changed, 142 insertions(+), 109 deletions(-)
> > 
> > diff --git libgomp/Makefile.in libgomp/Makefile.in
> > [snipped]
> > diff --git libgomp/config.h.in libgomp/config.h.in
> > [snipped]
> > diff --git libgomp/configure libgomp/configure
> > [snipped]
> > diff --git libgomp/plugin/configfrag.ac libgomp/plugin/configfrag.ac
> > index 88b4156..de0a6f6 100644
> > --- libgomp/plugin/configfrag.ac
> > +++ libgomp/plugin/configfrag.ac
> > @@ -26,8 +26,6 @@
> >  # see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
> >  # <http://www.gnu.org/licenses/>.
> >  
> > -offload_targets=
> > -AC_SUBST(offload_targets)
> >  plugin_support=yes
> >  AC_CHECK_LIB(dl, dlsym, , [plugin_support=no])
> >  if test x"$plugin_support" = xyes; then
> > @@ -142,7 +140,13 @@ AC_SUBST(PLUGIN_HSA_LIBS)
> >  
> >  
> >  
> > -# Get offload targets and path to install tree of offloading compiler.
> > +# Parse offload targets, and figure out libgomp plugin, and configure the
> > +# corresponding offload compiler.  offload_plugins and offload_targets will be
> > +# populated in the same order.
> > +offload_plugins=
> > +offload_targets=
> > +AC_SUBST(offload_plugins)
> > +AC_SUBST(offload_targets)
> >  offload_additional_options=
> >  offload_additional_lib_paths=
> >  AC_SUBST(offload_additional_options)
> > @@ -151,13 +155,13 @@ if test x"$enable_offload_targets" != x; then
> >    for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
> >      tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
> >      tgt=`echo $tgt | sed 's/=.*//'`
> > -    tgt_name=
> > +    tgt_plugin=
> >      case $tgt in
> >        *-intelmic-* | *-intelmicemul-*)
> > -	tgt_name=intelmic
> > +	tgt_plugin=intelmic
> >  	;;
> >        nvptx*)
> > -        tgt_name=nvptx
> > +	tgt_plugin=nvptx
> >  	PLUGIN_NVPTX=$tgt
> >  	PLUGIN_NVPTX_CPPFLAGS=$CUDA_DRIVER_CPPFLAGS
> >  	PLUGIN_NVPTX_LDFLAGS=$CUDA_DRIVER_LDFLAGS
> > @@ -184,7 +188,7 @@ if test x"$enable_offload_targets" != x; then
> >  	    ;;
> >  	esac
> >  	;;
> > -      hsa*)
> > +      hsa)
> >  	case "${target}" in
> >  	  x86_64-*-*)
> >  	    case " ${CC} ${CFLAGS} " in
> > @@ -192,7 +196,7 @@ if test x"$enable_offload_targets" != x; then
> >  	        PLUGIN_HSA=0
> >  		;;
> >  	      *)
> > -	        tgt_name=hsa
> > +		tgt_plugin=hsa
> >  	        PLUGIN_HSA=$tgt
> >  	        PLUGIN_HSA_CPPFLAGS=$HSA_RUNTIME_CPPFLAGS
> >  	        PLUGIN_HSA_LDFLAGS="$HSA_RUNTIME_LDFLAGS $HSA_KMT_LDFLAGS"
> > @@ -214,7 +218,7 @@ if test x"$enable_offload_targets" != x; then
> >  	        LDFLAGS=$PLUGIN_HSA_save_LDFLAGS
> >  	        LIBS=$PLUGIN_HSA_save_LIBS
> >  	        case $PLUGIN_HSA in
> > -	          hsa*)
> > +		  hsa)
> >  	            HSA_PLUGIN=0
> >  	            AC_MSG_ERROR([HSA run-time package required for HSA support])
> >  	            ;;
> > @@ -231,16 +235,19 @@ if test x"$enable_offload_targets" != x; then
> >  	AC_MSG_ERROR([unknown offload target specified])
> >  	;;
> >      esac
> > -    if test x"$tgt_name" = x; then
> > +    if test x"$tgt_plugin" = x; then
> >        # Don't configure libgomp for this offloading target if we don't build
> >        # the corresponding plugin.
> >        continue
> > -    elif test x"$offload_targets" = x; then
> > -      offload_targets=$tgt_name
> > +    elif test x"$offload_plugins" = x; then
> > +      offload_plugins=$tgt_plugin
> > +      offload_targets=$tgt
> >      else
> > -      offload_targets=$offload_targets,$tgt_name
> > +      offload_plugins=$offload_plugins,$tgt_plugin
> > +      offload_targets=$offload_targets,$tgt
> >      fi
> > -    if test "$tgt_name" = hsa; then
> > +    # Configure additional search paths.
> > +    if test "$tgt_plugin" = hsa; then
> >        # Offloading compilation is all handled by the target compiler.
> >        :
> >      elif test x"$tgt_dir" != x; then
> > @@ -252,8 +259,8 @@ if test x"$enable_offload_targets" != x; then
> >      fi
> >    done
> >  fi
> > -AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
> > -  [Define to offload targets, separated by commas.])
> > +AC_DEFINE_UNQUOTED(OFFLOAD_PLUGINS, "$offload_plugins",
> > +  [Define to offload plugins, separated by commas.])
> >  AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1])
> >  AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLUGIN_NVPTX],
> >    [Define to 1 if the NVIDIA plugin is built, 0 if not.])
> > diff --git libgomp/target.c libgomp/target.c
> > index e2dd0e0..c12c085 100644
> > --- libgomp/target.c
> > +++ libgomp/target.c
> > @@ -2467,9 +2467,9 @@ gomp_target_fini (void)
> >      }
> >  }
> >  
> > -/* This function initializes the runtime needed for offloading.
> > -   It parses the list of offload targets and tries to load the plugins for
> > -   these targets.  On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
> > +/* This function initializes the runtime for offloading.
> > +   It parses the list of offload plugins, and tries to load these.
> > +   On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
> >     will be set, and the array DEVICES initialized, containing descriptors for
> >     corresponding devices, first the GOMP_OFFLOAD_CAP_OPENMP_400 ones, follows
> >     by the others.  */
> > @@ -2486,7 +2486,7 @@ gomp_target_init (void)
> >    num_devices = 0;
> >    devices = NULL;
> >  
> > -  cur = OFFLOAD_TARGETS;
> > +  cur = OFFLOAD_PLUGINS;
> >    if (*cur)
> >      do
> >        {
> > diff --git libgomp/testsuite/Makefile.in libgomp/testsuite/Makefile.in
> > [snipped]
> > diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp
> > index 1cb4991..4a25421 100644
> > --- libgomp/testsuite/lib/libgomp.exp
> > +++ libgomp/testsuite/lib/libgomp.exp
> > @@ -36,28 +36,6 @@ load_gcc_lib fortran-modules.exp
> >  # Try to load a test support file, built during libgomp configuration.
> >  load_file libgomp-test-support.exp
> >  
> > -# Populate offload_targets_s (offloading targets separated by a space), and
> > -# offload_targets_s_openacc (the same, but with OpenACC names; OpenACC spells
> > -# some of them a little differently).
> > -set offload_targets_s [split $offload_targets ","]
> > -set offload_targets_s_openacc {}
> > -foreach offload_target_openacc $offload_targets_s {
> > -    # Translate to OpenACC names, or skip if not yet supported.
> > -    switch $offload_target_openacc {
> > -	intelmic {
> > -	    continue
> > -	}
> > -	nvptx {
> > -	    set offload_target_openacc "nvidia"
> > -	}
> > -	hsa {
> > -	    continue
> > -	}
> > -    }
> > -    lappend offload_targets_s_openacc "$offload_target_openacc"
> > -}
> > -lappend offload_targets_s_openacc "host"
> > -
> >  set dg-do-what-default run
> >  
> >  #
> > @@ -135,9 +113,9 @@ proc libgomp_init { args } {
> >      set always_ld_library_path ".:${blddir}/.libs"
> >  
> >      # Add liboffloadmic build directory in LD_LIBRARY_PATH to support
> > -    # non-fallback testing for Intel MIC targets
> > +    # Intel MIC offloading testing.
> >      global offload_targets
> > -    if { [string match "*,intelmic,*" ",$offload_targets,"] } {
> > +    if { [string match "*,*-intelmic*,*" ",$offload_targets,"] } {
> >  	append always_ld_library_path ":${blddir}/../liboffloadmic/.libs"
> >  	append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
> >  	# libstdc++ is required by liboffloadmic
> > @@ -245,8 +223,7 @@ proc libgomp_init { args } {
> >      # Disable color diagnostics
> >      lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
> >  
> > -    # Used for support non-fallback offloading.
> > -    # Help GCC to find target mkoffload.
> > +    # Help GCC to find offload compilers' mkoffload.
> >      global offload_additional_options
> >      if { $offload_additional_options != "" } {
> >  	lappend ALWAYS_CFLAGS "additional_flags=${offload_additional_options}"
> > @@ -322,6 +299,28 @@ proc libgomp_option_proc { option } {
> >      }
> >  }
> >  
> > +# Translate offload target to OpenACC device type.  Return the empty string if
> > +# not suitable or not yet supported, and "host" for offload target "disable".
> > +proc offload_target_to_openacc_device_type { offload_target } {
> > +    switch -glob $offload_target {
> > +	disable {
> > +	    return "host"
> > +	}
> > +	hsa {
> > +	    return ""
> > +	}
> > +	*-intelmic* {
> > +	    return ""
> > +	}
> > +	nvptx* {
> > +	    return "nvidia"
> > +	}
> > +	default {
> > +	    error "Unknwon offload target: $offload_target"
> > +	}
> > +    }
> > +}
> > +
> >  # Return 1 if offload device is available.
> >  proc check_effective_target_offload_device { } {
> >      return [check_runtime_nocache offload_device_available_ {
> > @@ -373,29 +372,22 @@ proc check_effective_target_openacc_nvidia_accel_present { } {
> >      } "" ]
> >  }
> >  
> > -# Return 1 if at least one nvidia board is present, and the nvidia device type
> > -# is selected by default by means of setting the environment variable
> > -# ACC_DEVICE_TYPE.
> > +# Return 1 if at least one nvidia board is present, and the OpenACC "nvidia"
> > +# device type is selected.
> >  
> >  proc check_effective_target_openacc_nvidia_accel_selected { } {
> >      if { ![check_effective_target_openacc_nvidia_accel_present] } {
> >  	return 0;
> >      }
> > -    global offload_target_openacc
> > -    if { $offload_target_openacc == "nvidia" } {
> > -        return 1;
> > -    }
> > -    return 0;
> > +    global openacc_device_type
> > +    return [string match "nvidia" $openacc_device_type]
> >  }
> >  
> > -# Return 1 if the host target is selected for offloaded
> > +# Return 1 if the OpenACC "host" device type is selected.
> >  
> >  proc check_effective_target_openacc_host_selected { } {
> > -    global offload_target_openacc
> > -    if { $offload_target_openacc == "host" } {
> > -        return 1;
> > -    }
> > -    return 0;
> > +    global openacc_device_type
> > +    return [string match "host" $openacc_device_type]
> >  }
> >  
> >  # Return 1 if the selected OMP device is actually a HSA device
> > diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
> > index 608b298..befb921 100644
> > --- libgomp/testsuite/libgomp.oacc-c++/c++.exp
> > +++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
> > @@ -70,18 +70,23 @@ if { $lang_test_file_found } {
> >  	set libstdcxx_includes ""
> >      }
> >  
> > -    # Test OpenACC with available accelerators.
> > -    foreach offload_target_openacc $offload_targets_s_openacc {
> > -	set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
> > +    # Test with all offload targets, and with offloading disabled.
> > +    foreach offload_target [concat [split $offload_targets ","] "disable"] {
> > +	set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
> > +	set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
> >  
> > -	switch $offload_target_openacc {
> > -	    host {
> > +	switch $openacc_device_type {
> > +	    "" {
> > +		untested "$subdir $offload_target offloading"
> > +		continue
> > +	    }
> > +	    "host" {
> >  		set acc_mem_shared 1
> >  	    }
> > -	    nvidia {
> > +	    "nvidia" {
> >  		if { ![check_effective_target_openacc_nvidia_accel_present] } {
> >  		    # Don't bother; execution testing is going to FAIL.
> > -		    untested "$subdir $offload_target_openacc offloading"
> > +		    untested "$subdir $offload_target offloading"
> >  		    continue
> >  		}
> >  
> > @@ -94,12 +99,15 @@ if { $lang_test_file_found } {
> >  		set acc_mem_shared 0
> >  	    }
> >  	    default {
> > -		set acc_mem_shared 0
> > +		error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
> >  	    }
> >  	}
> >  	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
> >  
> > -	setenv ACC_DEVICE_TYPE $offload_target_openacc
> > +	# To avoid overhead, by default only build for the offload target that
> > +	# we're actually going to test.
> > +	set tagopt "$tagopt -foffload=$offload_target"
> > +	setenv ACC_DEVICE_TYPE $openacc_device_type
> >  
> >  	# To get better test coverage for device-specific code that is only
> >  	# ever used in offloading configurations, we'd like more thorough
> > @@ -108,8 +116,8 @@ if { $lang_test_file_found } {
> >  	# -O0 and -O2 only, to avoid testing times exploding too much, under
> >  	# the assumption that between -O0 and -O[something] there is the
> >  	# biggest difference in the overall structure of the generated code.
> > -	switch $offload_target_openacc {
> > -	    host {
> > +	switch $offload_target {
> > +	    "disable" {
> >  		set-torture-options [list \
> >  					 { -O2 } ]
> >  	    }
> > diff --git libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
> > index b509a10..5355b87 100644
> > --- libgomp/testsuite/libgomp.oacc-c/c.exp
> > +++ libgomp/testsuite/libgomp.oacc-c/c.exp
> > @@ -31,20 +31,25 @@ set ld_library_path $always_ld_library_path
> >  append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
> >  set_ld_library_path_env_vars
> >  
> > -# Test OpenACC with available accelerators.
> > +# Test with all offload targets, and with offloading disabled.
> >  set SAVE_ALWAYS_CFLAGS "$ALWAYS_CFLAGS"
> > -foreach offload_target_openacc $offload_targets_s_openacc {
> > +foreach offload_target [concat [split $offload_targets ","] "disable"] {
> >      set ALWAYS_CFLAGS "$SAVE_ALWAYS_CFLAGS"
> > -    set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
> > +    set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
> > +    set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
> >  
> > -    switch $offload_target_openacc {
> > -	host {
> > +    switch $openacc_device_type {
> > +	"" {
> > +	    untested "$subdir $offload_target offloading"
> > +	    continue
> > +	}
> > +	"host" {
> >  	    set acc_mem_shared 1
> >  	}
> > -	nvidia {
> > +	"nvidia" {
> >  	    if { ![check_effective_target_openacc_nvidia_accel_present] } {
> >  		# Don't bother; execution testing is going to FAIL.
> > -		untested "$subdir $offload_target_openacc offloading"
> > +		untested "$subdir $offload_target offloading"
> >  		continue
> >  	    }
> >  
> > @@ -57,12 +62,15 @@ foreach offload_target_openacc $offload_targets_s_openacc {
> >  	    set acc_mem_shared 0
> >  	}
> >  	default {
> > -	    set acc_mem_shared 0
> > +	    error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
> >  	}
> >      }
> >      set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
> >  
> > -    setenv ACC_DEVICE_TYPE $offload_target_openacc
> > +    # To avoid overhead, by default only build for the offload target that
> > +    # we're actually going to test.
> > +    set tagopt "$tagopt -foffload=$offload_target"
> > +    setenv ACC_DEVICE_TYPE $openacc_device_type
> >  
> >      # To get better test coverage for device-specific code that is only
> >      # ever used in offloading configurations, we'd like more thorough
> > @@ -71,8 +79,8 @@ foreach offload_target_openacc $offload_targets_s_openacc {
> >      # -O0 and -O2 only, to avoid testing times exploding too much, under
> >      # the assumption that between -O0 and -O[something] there is the
> >      # biggest difference in the overall structure of the generated code.
> > -    switch $offload_target_openacc {
> > -	host {
> > +    switch $offload_target {
> > +	"disable" {
> >  	    set-torture-options [list \
> >  				     { -O2 } ]
> >  	}
> > diff --git libgomp/testsuite/libgomp.oacc-fortran/fortran.exp libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
> > index 2d6b647..8507b67 100644
> > --- libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
> > +++ libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
> > @@ -65,30 +65,38 @@ if { $lang_test_file_found } {
> >      append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
> >      set_ld_library_path_env_vars
> >  
> > -    # Test OpenACC with available accelerators.
> > -    foreach offload_target_openacc $offload_targets_s_openacc {
> > -	set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
> > +    # Test with all offload targets, and with offloading disabled.
> > +    foreach offload_target [concat [split $offload_targets ","] "disable"] {
> > +	set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
> > +	set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
> >  
> > -	switch $offload_target_openacc {
> > +	switch $openacc_device_type {
> > +	    "" {
> > +		untested "$subdir $offload_target offloading"
> > +		continue
> > +	    }
> >  	    host {
> >  		set acc_mem_shared 1
> >  	    }
> >  	    nvidia {
> >  		if { ![check_effective_target_openacc_nvidia_accel_present] } {
> >  		    # Don't bother; execution testing is going to FAIL.
> > -		    untested "$subdir $offload_target_openacc offloading"
> > +		    untested "$subdir $offload_target offloading"
> >  		    continue
> >  		}
> >  
> >  		set acc_mem_shared 0
> >  	    }
> >  	    default {
> > -		set acc_mem_shared 0
> > +		error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
> >  	    }
> >  	}
> >  	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
> >  
> > -	setenv ACC_DEVICE_TYPE $offload_target_openacc
> > +	# To avoid overhead, by default only build for the offload target that
> > +	# we're actually going to test.
> > +	set tagopt "$tagopt -foffload=$offload_target"
> > +	setenv ACC_DEVICE_TYPE $openacc_device_type
> >  
> >  	# For Fortran we're doing torture testing, as Fortran has far more tests
> >  	# with arrays etc. that testing just -O0 or -O2 is insufficient, that is


Grüße
 Thomas

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

* Re: libgomp: In OpenACC testing, cycle though $offload_targets, and by default only build for the offload target that we're actually going to test
  2016-05-18 11:42             ` Thomas Schwinge
@ 2016-05-25  8:50               ` Thomas Schwinge
  2016-06-29  9:19                 ` [PING, two months] " Thomas Schwinge
  0 siblings, 1 reply; 22+ messages in thread
From: Thomas Schwinge @ 2016-05-25  8:50 UTC (permalink / raw)
  To: Jakub Jelinek, gcc-patches

Hi!

Ping...

On Wed, 18 May 2016 13:41:25 +0200, I wrote:
> Ping.
> 
> On Wed, 11 May 2016 15:45:13 +0200, I wrote:
> > Ping.
> > 
> > On Mon, 02 May 2016 11:54:27 +0200, I wrote:
> > > On Fri, 29 Apr 2016 09:43:41 +0200, Jakub Jelinek <jakub@redhat.com> wrote:
> > > > On Thu, Apr 28, 2016 at 12:43:43PM +0200, Thomas Schwinge wrote:
> > > > > commit 3b521f3e35fdb4b320e95b5f6a82b8d89399481a
> > > > > Author: Thomas Schwinge <thomas@codesourcery.com>
> > > > > Date:   Thu Apr 21 11:36:39 2016 +0200
> > > > > 
> > > > >     libgomp: Unconfuse offload plugins vs. offload targets
> > > > 
> > > > I don't like this patch at all, rather than unconfusing stuff it
> > > > makes stuff confusing.  Plugins are just a way to support various
> > > > offloading targets.
> > > 
> > > Huh; my patch exactly clarifies that the offload_targets variable does
> > > not actually list offload target names, but does list libgomp offload
> > > plugin names...
> > > 
> > > > Can you please post just a short patch without all those changes
> > > > that does what you want, rather than renaming everything at the same time?
> > > 
> > > I thought incremental, self-contained patches were easier to review.
> > > Anyway, here's the three patches merged into one:
> > > 
> > > commit 8060ae3474072eef685381d80f566d1c0942c603
> > > Author: Thomas Schwinge <thomas@codesourcery.com>
> > > Date:   Thu Apr 21 11:36:39 2016 +0200
> > > 
> > >     libgomp: In OpenACC testing, cycle though $offload_targets, and by default only build for the offload target that we're actually going to test
> > >     
> > >     	libgomp/
> > >     	* plugin/configfrag.ac (offload_targets): Actually enumerate
> > >     	offload targets, and add...
> > >     	(offload_plugins): ... this one to enumerate offload plugins.
> > >     	(OFFLOAD_PLUGINS): Renamed from OFFLOAD_TARGETS.
> > >     	* target.c (gomp_target_init): Adjust to that.
> > >     	* testsuite/lib/libgomp.exp: Likewise.
> > >     	(offload_targets_s, offload_targets_s_openacc): Remove variables.
> > >     	(offload_target_to_openacc_device_type): New proc.
> > >     	(check_effective_target_openacc_nvidia_accel_selected)
> > >     	(check_effective_target_openacc_host_selected): Examine
> > >     	$openacc_device_type instead of $offload_target_openacc.
> > >     	* Makefile.in: Regenerate.
> > >     	* config.h.in: Likewise.
> > >     	* configure: Likewise.
> > >     	* testsuite/Makefile.in: Likewise.
> > >     	* testsuite/libgomp.oacc-c++/c++.exp: Cycle through
> > >     	$offload_targets (plus "disable") instead of
> > >     	$offload_targets_s_openacc, and add "-foffload=$offload_target" to
> > >     	tagopt.
> > >     	* testsuite/libgomp.oacc-c/c.exp: Likewise.
> > >     	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
> > > ---
> > >  libgomp/Makefile.in                                |  1 +
> > >  libgomp/config.h.in                                |  4 +-
> > >  libgomp/configure                                  | 44 +++++++------
> > >  libgomp/plugin/configfrag.ac                       | 39 +++++++-----
> > >  libgomp/target.c                                   |  8 +--
> > >  libgomp/testsuite/Makefile.in                      |  1 +
> > >  libgomp/testsuite/lib/libgomp.exp                  | 72 ++++++++++------------
> > >  libgomp/testsuite/libgomp.oacc-c++/c++.exp         | 30 +++++----
> > >  libgomp/testsuite/libgomp.oacc-c/c.exp             | 30 +++++----
> > >  libgomp/testsuite/libgomp.oacc-fortran/fortran.exp | 22 ++++---
> > >  10 files changed, 142 insertions(+), 109 deletions(-)
> > > 
> > > diff --git libgomp/Makefile.in libgomp/Makefile.in
> > > [snipped]
> > > diff --git libgomp/config.h.in libgomp/config.h.in
> > > [snipped]
> > > diff --git libgomp/configure libgomp/configure
> > > [snipped]
> > > diff --git libgomp/plugin/configfrag.ac libgomp/plugin/configfrag.ac
> > > index 88b4156..de0a6f6 100644
> > > --- libgomp/plugin/configfrag.ac
> > > +++ libgomp/plugin/configfrag.ac
> > > @@ -26,8 +26,6 @@
> > >  # see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
> > >  # <http://www.gnu.org/licenses/>.
> > >  
> > > -offload_targets=
> > > -AC_SUBST(offload_targets)
> > >  plugin_support=yes
> > >  AC_CHECK_LIB(dl, dlsym, , [plugin_support=no])
> > >  if test x"$plugin_support" = xyes; then
> > > @@ -142,7 +140,13 @@ AC_SUBST(PLUGIN_HSA_LIBS)
> > >  
> > >  
> > >  
> > > -# Get offload targets and path to install tree of offloading compiler.
> > > +# Parse offload targets, and figure out libgomp plugin, and configure the
> > > +# corresponding offload compiler.  offload_plugins and offload_targets will be
> > > +# populated in the same order.
> > > +offload_plugins=
> > > +offload_targets=
> > > +AC_SUBST(offload_plugins)
> > > +AC_SUBST(offload_targets)
> > >  offload_additional_options=
> > >  offload_additional_lib_paths=
> > >  AC_SUBST(offload_additional_options)
> > > @@ -151,13 +155,13 @@ if test x"$enable_offload_targets" != x; then
> > >    for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
> > >      tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
> > >      tgt=`echo $tgt | sed 's/=.*//'`
> > > -    tgt_name=
> > > +    tgt_plugin=
> > >      case $tgt in
> > >        *-intelmic-* | *-intelmicemul-*)
> > > -	tgt_name=intelmic
> > > +	tgt_plugin=intelmic
> > >  	;;
> > >        nvptx*)
> > > -        tgt_name=nvptx
> > > +	tgt_plugin=nvptx
> > >  	PLUGIN_NVPTX=$tgt
> > >  	PLUGIN_NVPTX_CPPFLAGS=$CUDA_DRIVER_CPPFLAGS
> > >  	PLUGIN_NVPTX_LDFLAGS=$CUDA_DRIVER_LDFLAGS
> > > @@ -184,7 +188,7 @@ if test x"$enable_offload_targets" != x; then
> > >  	    ;;
> > >  	esac
> > >  	;;
> > > -      hsa*)
> > > +      hsa)
> > >  	case "${target}" in
> > >  	  x86_64-*-*)
> > >  	    case " ${CC} ${CFLAGS} " in
> > > @@ -192,7 +196,7 @@ if test x"$enable_offload_targets" != x; then
> > >  	        PLUGIN_HSA=0
> > >  		;;
> > >  	      *)
> > > -	        tgt_name=hsa
> > > +		tgt_plugin=hsa
> > >  	        PLUGIN_HSA=$tgt
> > >  	        PLUGIN_HSA_CPPFLAGS=$HSA_RUNTIME_CPPFLAGS
> > >  	        PLUGIN_HSA_LDFLAGS="$HSA_RUNTIME_LDFLAGS $HSA_KMT_LDFLAGS"
> > > @@ -214,7 +218,7 @@ if test x"$enable_offload_targets" != x; then
> > >  	        LDFLAGS=$PLUGIN_HSA_save_LDFLAGS
> > >  	        LIBS=$PLUGIN_HSA_save_LIBS
> > >  	        case $PLUGIN_HSA in
> > > -	          hsa*)
> > > +		  hsa)
> > >  	            HSA_PLUGIN=0
> > >  	            AC_MSG_ERROR([HSA run-time package required for HSA support])
> > >  	            ;;
> > > @@ -231,16 +235,19 @@ if test x"$enable_offload_targets" != x; then
> > >  	AC_MSG_ERROR([unknown offload target specified])
> > >  	;;
> > >      esac
> > > -    if test x"$tgt_name" = x; then
> > > +    if test x"$tgt_plugin" = x; then
> > >        # Don't configure libgomp for this offloading target if we don't build
> > >        # the corresponding plugin.
> > >        continue
> > > -    elif test x"$offload_targets" = x; then
> > > -      offload_targets=$tgt_name
> > > +    elif test x"$offload_plugins" = x; then
> > > +      offload_plugins=$tgt_plugin
> > > +      offload_targets=$tgt
> > >      else
> > > -      offload_targets=$offload_targets,$tgt_name
> > > +      offload_plugins=$offload_plugins,$tgt_plugin
> > > +      offload_targets=$offload_targets,$tgt
> > >      fi
> > > -    if test "$tgt_name" = hsa; then
> > > +    # Configure additional search paths.
> > > +    if test "$tgt_plugin" = hsa; then
> > >        # Offloading compilation is all handled by the target compiler.
> > >        :
> > >      elif test x"$tgt_dir" != x; then
> > > @@ -252,8 +259,8 @@ if test x"$enable_offload_targets" != x; then
> > >      fi
> > >    done
> > >  fi
> > > -AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
> > > -  [Define to offload targets, separated by commas.])
> > > +AC_DEFINE_UNQUOTED(OFFLOAD_PLUGINS, "$offload_plugins",
> > > +  [Define to offload plugins, separated by commas.])
> > >  AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1])
> > >  AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLUGIN_NVPTX],
> > >    [Define to 1 if the NVIDIA plugin is built, 0 if not.])
> > > diff --git libgomp/target.c libgomp/target.c
> > > index e2dd0e0..c12c085 100644
> > > --- libgomp/target.c
> > > +++ libgomp/target.c
> > > @@ -2467,9 +2467,9 @@ gomp_target_fini (void)
> > >      }
> > >  }
> > >  
> > > -/* This function initializes the runtime needed for offloading.
> > > -   It parses the list of offload targets and tries to load the plugins for
> > > -   these targets.  On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
> > > +/* This function initializes the runtime for offloading.
> > > +   It parses the list of offload plugins, and tries to load these.
> > > +   On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
> > >     will be set, and the array DEVICES initialized, containing descriptors for
> > >     corresponding devices, first the GOMP_OFFLOAD_CAP_OPENMP_400 ones, follows
> > >     by the others.  */
> > > @@ -2486,7 +2486,7 @@ gomp_target_init (void)
> > >    num_devices = 0;
> > >    devices = NULL;
> > >  
> > > -  cur = OFFLOAD_TARGETS;
> > > +  cur = OFFLOAD_PLUGINS;
> > >    if (*cur)
> > >      do
> > >        {
> > > diff --git libgomp/testsuite/Makefile.in libgomp/testsuite/Makefile.in
> > > [snipped]
> > > diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp
> > > index 1cb4991..4a25421 100644
> > > --- libgomp/testsuite/lib/libgomp.exp
> > > +++ libgomp/testsuite/lib/libgomp.exp
> > > @@ -36,28 +36,6 @@ load_gcc_lib fortran-modules.exp
> > >  # Try to load a test support file, built during libgomp configuration.
> > >  load_file libgomp-test-support.exp
> > >  
> > > -# Populate offload_targets_s (offloading targets separated by a space), and
> > > -# offload_targets_s_openacc (the same, but with OpenACC names; OpenACC spells
> > > -# some of them a little differently).
> > > -set offload_targets_s [split $offload_targets ","]
> > > -set offload_targets_s_openacc {}
> > > -foreach offload_target_openacc $offload_targets_s {
> > > -    # Translate to OpenACC names, or skip if not yet supported.
> > > -    switch $offload_target_openacc {
> > > -	intelmic {
> > > -	    continue
> > > -	}
> > > -	nvptx {
> > > -	    set offload_target_openacc "nvidia"
> > > -	}
> > > -	hsa {
> > > -	    continue
> > > -	}
> > > -    }
> > > -    lappend offload_targets_s_openacc "$offload_target_openacc"
> > > -}
> > > -lappend offload_targets_s_openacc "host"
> > > -
> > >  set dg-do-what-default run
> > >  
> > >  #
> > > @@ -135,9 +113,9 @@ proc libgomp_init { args } {
> > >      set always_ld_library_path ".:${blddir}/.libs"
> > >  
> > >      # Add liboffloadmic build directory in LD_LIBRARY_PATH to support
> > > -    # non-fallback testing for Intel MIC targets
> > > +    # Intel MIC offloading testing.
> > >      global offload_targets
> > > -    if { [string match "*,intelmic,*" ",$offload_targets,"] } {
> > > +    if { [string match "*,*-intelmic*,*" ",$offload_targets,"] } {
> > >  	append always_ld_library_path ":${blddir}/../liboffloadmic/.libs"
> > >  	append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
> > >  	# libstdc++ is required by liboffloadmic
> > > @@ -245,8 +223,7 @@ proc libgomp_init { args } {
> > >      # Disable color diagnostics
> > >      lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
> > >  
> > > -    # Used for support non-fallback offloading.
> > > -    # Help GCC to find target mkoffload.
> > > +    # Help GCC to find offload compilers' mkoffload.
> > >      global offload_additional_options
> > >      if { $offload_additional_options != "" } {
> > >  	lappend ALWAYS_CFLAGS "additional_flags=${offload_additional_options}"
> > > @@ -322,6 +299,28 @@ proc libgomp_option_proc { option } {
> > >      }
> > >  }
> > >  
> > > +# Translate offload target to OpenACC device type.  Return the empty string if
> > > +# not suitable or not yet supported, and "host" for offload target "disable".
> > > +proc offload_target_to_openacc_device_type { offload_target } {
> > > +    switch -glob $offload_target {
> > > +	disable {
> > > +	    return "host"
> > > +	}
> > > +	hsa {
> > > +	    return ""
> > > +	}
> > > +	*-intelmic* {
> > > +	    return ""
> > > +	}
> > > +	nvptx* {
> > > +	    return "nvidia"
> > > +	}
> > > +	default {
> > > +	    error "Unknwon offload target: $offload_target"
> > > +	}
> > > +    }
> > > +}
> > > +
> > >  # Return 1 if offload device is available.
> > >  proc check_effective_target_offload_device { } {
> > >      return [check_runtime_nocache offload_device_available_ {
> > > @@ -373,29 +372,22 @@ proc check_effective_target_openacc_nvidia_accel_present { } {
> > >      } "" ]
> > >  }
> > >  
> > > -# Return 1 if at least one nvidia board is present, and the nvidia device type
> > > -# is selected by default by means of setting the environment variable
> > > -# ACC_DEVICE_TYPE.
> > > +# Return 1 if at least one nvidia board is present, and the OpenACC "nvidia"
> > > +# device type is selected.
> > >  
> > >  proc check_effective_target_openacc_nvidia_accel_selected { } {
> > >      if { ![check_effective_target_openacc_nvidia_accel_present] } {
> > >  	return 0;
> > >      }
> > > -    global offload_target_openacc
> > > -    if { $offload_target_openacc == "nvidia" } {
> > > -        return 1;
> > > -    }
> > > -    return 0;
> > > +    global openacc_device_type
> > > +    return [string match "nvidia" $openacc_device_type]
> > >  }
> > >  
> > > -# Return 1 if the host target is selected for offloaded
> > > +# Return 1 if the OpenACC "host" device type is selected.
> > >  
> > >  proc check_effective_target_openacc_host_selected { } {
> > > -    global offload_target_openacc
> > > -    if { $offload_target_openacc == "host" } {
> > > -        return 1;
> > > -    }
> > > -    return 0;
> > > +    global openacc_device_type
> > > +    return [string match "host" $openacc_device_type]
> > >  }
> > >  
> > >  # Return 1 if the selected OMP device is actually a HSA device
> > > diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
> > > index 608b298..befb921 100644
> > > --- libgomp/testsuite/libgomp.oacc-c++/c++.exp
> > > +++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
> > > @@ -70,18 +70,23 @@ if { $lang_test_file_found } {
> > >  	set libstdcxx_includes ""
> > >      }
> > >  
> > > -    # Test OpenACC with available accelerators.
> > > -    foreach offload_target_openacc $offload_targets_s_openacc {
> > > -	set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
> > > +    # Test with all offload targets, and with offloading disabled.
> > > +    foreach offload_target [concat [split $offload_targets ","] "disable"] {
> > > +	set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
> > > +	set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
> > >  
> > > -	switch $offload_target_openacc {
> > > -	    host {
> > > +	switch $openacc_device_type {
> > > +	    "" {
> > > +		untested "$subdir $offload_target offloading"
> > > +		continue
> > > +	    }
> > > +	    "host" {
> > >  		set acc_mem_shared 1
> > >  	    }
> > > -	    nvidia {
> > > +	    "nvidia" {
> > >  		if { ![check_effective_target_openacc_nvidia_accel_present] } {
> > >  		    # Don't bother; execution testing is going to FAIL.
> > > -		    untested "$subdir $offload_target_openacc offloading"
> > > +		    untested "$subdir $offload_target offloading"
> > >  		    continue
> > >  		}
> > >  
> > > @@ -94,12 +99,15 @@ if { $lang_test_file_found } {
> > >  		set acc_mem_shared 0
> > >  	    }
> > >  	    default {
> > > -		set acc_mem_shared 0
> > > +		error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
> > >  	    }
> > >  	}
> > >  	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
> > >  
> > > -	setenv ACC_DEVICE_TYPE $offload_target_openacc
> > > +	# To avoid overhead, by default only build for the offload target that
> > > +	# we're actually going to test.
> > > +	set tagopt "$tagopt -foffload=$offload_target"
> > > +	setenv ACC_DEVICE_TYPE $openacc_device_type
> > >  
> > >  	# To get better test coverage for device-specific code that is only
> > >  	# ever used in offloading configurations, we'd like more thorough
> > > @@ -108,8 +116,8 @@ if { $lang_test_file_found } {
> > >  	# -O0 and -O2 only, to avoid testing times exploding too much, under
> > >  	# the assumption that between -O0 and -O[something] there is the
> > >  	# biggest difference in the overall structure of the generated code.
> > > -	switch $offload_target_openacc {
> > > -	    host {
> > > +	switch $offload_target {
> > > +	    "disable" {
> > >  		set-torture-options [list \
> > >  					 { -O2 } ]
> > >  	    }
> > > diff --git libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
> > > index b509a10..5355b87 100644
> > > --- libgomp/testsuite/libgomp.oacc-c/c.exp
> > > +++ libgomp/testsuite/libgomp.oacc-c/c.exp
> > > @@ -31,20 +31,25 @@ set ld_library_path $always_ld_library_path
> > >  append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
> > >  set_ld_library_path_env_vars
> > >  
> > > -# Test OpenACC with available accelerators.
> > > +# Test with all offload targets, and with offloading disabled.
> > >  set SAVE_ALWAYS_CFLAGS "$ALWAYS_CFLAGS"
> > > -foreach offload_target_openacc $offload_targets_s_openacc {
> > > +foreach offload_target [concat [split $offload_targets ","] "disable"] {
> > >      set ALWAYS_CFLAGS "$SAVE_ALWAYS_CFLAGS"
> > > -    set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
> > > +    set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
> > > +    set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
> > >  
> > > -    switch $offload_target_openacc {
> > > -	host {
> > > +    switch $openacc_device_type {
> > > +	"" {
> > > +	    untested "$subdir $offload_target offloading"
> > > +	    continue
> > > +	}
> > > +	"host" {
> > >  	    set acc_mem_shared 1
> > >  	}
> > > -	nvidia {
> > > +	"nvidia" {
> > >  	    if { ![check_effective_target_openacc_nvidia_accel_present] } {
> > >  		# Don't bother; execution testing is going to FAIL.
> > > -		untested "$subdir $offload_target_openacc offloading"
> > > +		untested "$subdir $offload_target offloading"
> > >  		continue
> > >  	    }
> > >  
> > > @@ -57,12 +62,15 @@ foreach offload_target_openacc $offload_targets_s_openacc {
> > >  	    set acc_mem_shared 0
> > >  	}
> > >  	default {
> > > -	    set acc_mem_shared 0
> > > +	    error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
> > >  	}
> > >      }
> > >      set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
> > >  
> > > -    setenv ACC_DEVICE_TYPE $offload_target_openacc
> > > +    # To avoid overhead, by default only build for the offload target that
> > > +    # we're actually going to test.
> > > +    set tagopt "$tagopt -foffload=$offload_target"
> > > +    setenv ACC_DEVICE_TYPE $openacc_device_type
> > >  
> > >      # To get better test coverage for device-specific code that is only
> > >      # ever used in offloading configurations, we'd like more thorough
> > > @@ -71,8 +79,8 @@ foreach offload_target_openacc $offload_targets_s_openacc {
> > >      # -O0 and -O2 only, to avoid testing times exploding too much, under
> > >      # the assumption that between -O0 and -O[something] there is the
> > >      # biggest difference in the overall structure of the generated code.
> > > -    switch $offload_target_openacc {
> > > -	host {
> > > +    switch $offload_target {
> > > +	"disable" {
> > >  	    set-torture-options [list \
> > >  				     { -O2 } ]
> > >  	}
> > > diff --git libgomp/testsuite/libgomp.oacc-fortran/fortran.exp libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
> > > index 2d6b647..8507b67 100644
> > > --- libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
> > > +++ libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
> > > @@ -65,30 +65,38 @@ if { $lang_test_file_found } {
> > >      append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
> > >      set_ld_library_path_env_vars
> > >  
> > > -    # Test OpenACC with available accelerators.
> > > -    foreach offload_target_openacc $offload_targets_s_openacc {
> > > -	set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
> > > +    # Test with all offload targets, and with offloading disabled.
> > > +    foreach offload_target [concat [split $offload_targets ","] "disable"] {
> > > +	set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
> > > +	set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
> > >  
> > > -	switch $offload_target_openacc {
> > > +	switch $openacc_device_type {
> > > +	    "" {
> > > +		untested "$subdir $offload_target offloading"
> > > +		continue
> > > +	    }
> > >  	    host {
> > >  		set acc_mem_shared 1
> > >  	    }
> > >  	    nvidia {
> > >  		if { ![check_effective_target_openacc_nvidia_accel_present] } {
> > >  		    # Don't bother; execution testing is going to FAIL.
> > > -		    untested "$subdir $offload_target_openacc offloading"
> > > +		    untested "$subdir $offload_target offloading"
> > >  		    continue
> > >  		}
> > >  
> > >  		set acc_mem_shared 0
> > >  	    }
> > >  	    default {
> > > -		set acc_mem_shared 0
> > > +		error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
> > >  	    }
> > >  	}
> > >  	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
> > >  
> > > -	setenv ACC_DEVICE_TYPE $offload_target_openacc
> > > +	# To avoid overhead, by default only build for the offload target that
> > > +	# we're actually going to test.
> > > +	set tagopt "$tagopt -foffload=$offload_target"
> > > +	setenv ACC_DEVICE_TYPE $openacc_device_type
> > >  
> > >  	# For Fortran we're doing torture testing, as Fortran has far more tests
> > >  	# with arrays etc. that testing just -O0 or -O2 is insufficient, that is
> 
> 
> Grüße
>  Thomas

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

* libgomp: Unconfuse offload plugins vs. offload targets
@ 2016-06-08 13:28 Thomas Schwinge
  2016-06-08 14:08 ` Jakub Jelinek
  0 siblings, 1 reply; 22+ messages in thread
From: Thomas Schwinge @ 2016-06-08 13:28 UTC (permalink / raw)
  To: Jakub Jelinek, gcc-patches

Hi!

This got me confused recently, so I took the effort to clean it up.  OK
to commit?

commit 5a1b2d8440a459fd2c623ba76fd6cab478ada54f
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Wed Jun 8 15:18:11 2016 +0200

    libgomp: Unconfuse offload plugins vs. offload targets
    
    	libgomp/
    	* plugin/configfrag.ac: Populate and AC_SUBST offload_plugins
    	instead of offload_targets, and AC_DEFINE_UNQUOTED OFFLOAD_PLUGINS
    	instead of OFFLOAD_TARGETS.
    	* target.c (gomp_target_init): Adjust to that.
    	* testsuite/lib/libgomp.exp: Likewise.
    	* testsuite/libgomp-test-support.exp.in: Likewise.
    	* Makefile.in: Regenerate.
    	* config.h.in: Regenerate.
    	* configure: Regenerate.
    	* testsuite/Makefile.in: Regenerate.
---
 libgomp/Makefile.in                           |  2 +-
 libgomp/config.h.in                           |  4 ++--
 libgomp/configure                             | 34 ++++++++++++++-------------
 libgomp/plugin/configfrag.ac                  | 34 ++++++++++++++-------------
 libgomp/target.c                              |  8 +++----
 libgomp/testsuite/Makefile.in                 |  2 +-
 libgomp/testsuite/lib/libgomp.exp             | 25 +++++++++-----------
 libgomp/testsuite/libgomp-test-support.exp.in |  2 +-
 8 files changed, 56 insertions(+), 55 deletions(-)

diff --git libgomp/Makefile.in libgomp/Makefile.in
[...]
diff --git libgomp/config.h.in libgomp/config.h.in
[...]
diff --git libgomp/configure libgomp/configure
[...]
diff --git libgomp/plugin/configfrag.ac libgomp/plugin/configfrag.ac
index 88b4156..93d3a71 100644
--- libgomp/plugin/configfrag.ac
+++ libgomp/plugin/configfrag.ac
@@ -26,8 +26,6 @@
 # see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-offload_targets=
-AC_SUBST(offload_targets)
 plugin_support=yes
 AC_CHECK_LIB(dl, dlsym, , [plugin_support=no])
 if test x"$plugin_support" = xyes; then
@@ -142,7 +140,10 @@ AC_SUBST(PLUGIN_HSA_LIBS)
 
 
 
-# Get offload targets and path to install tree of offloading compiler.
+# Parse offload targets, and figure out libgomp plugin, and configure the
+# corresponding offload compiler.
+offload_plugins=
+AC_SUBST(offload_plugins)
 offload_additional_options=
 offload_additional_lib_paths=
 AC_SUBST(offload_additional_options)
@@ -151,13 +152,13 @@ if test x"$enable_offload_targets" != x; then
   for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
     tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
     tgt=`echo $tgt | sed 's/=.*//'`
-    tgt_name=
+    tgt_plugin=
     case $tgt in
       *-intelmic-* | *-intelmicemul-*)
-	tgt_name=intelmic
+	tgt_plugin=intelmic
 	;;
       nvptx*)
-        tgt_name=nvptx
+	tgt_plugin=nvptx
 	PLUGIN_NVPTX=$tgt
 	PLUGIN_NVPTX_CPPFLAGS=$CUDA_DRIVER_CPPFLAGS
 	PLUGIN_NVPTX_LDFLAGS=$CUDA_DRIVER_LDFLAGS
@@ -184,7 +185,7 @@ if test x"$enable_offload_targets" != x; then
 	    ;;
 	esac
 	;;
-      hsa*)
+      hsa)
 	case "${target}" in
 	  x86_64-*-*)
 	    case " ${CC} ${CFLAGS} " in
@@ -192,7 +193,7 @@ if test x"$enable_offload_targets" != x; then
 	        PLUGIN_HSA=0
 		;;
 	      *)
-	        tgt_name=hsa
+		tgt_plugin=hsa
 	        PLUGIN_HSA=$tgt
 	        PLUGIN_HSA_CPPFLAGS=$HSA_RUNTIME_CPPFLAGS
 	        PLUGIN_HSA_LDFLAGS="$HSA_RUNTIME_LDFLAGS $HSA_KMT_LDFLAGS"
@@ -214,7 +215,7 @@ if test x"$enable_offload_targets" != x; then
 	        LDFLAGS=$PLUGIN_HSA_save_LDFLAGS
 	        LIBS=$PLUGIN_HSA_save_LIBS
 	        case $PLUGIN_HSA in
-	          hsa*)
+		  hsa)
 	            HSA_PLUGIN=0
 	            AC_MSG_ERROR([HSA run-time package required for HSA support])
 	            ;;
@@ -231,16 +232,17 @@ if test x"$enable_offload_targets" != x; then
 	AC_MSG_ERROR([unknown offload target specified])
 	;;
     esac
-    if test x"$tgt_name" = x; then
+    if test x"$tgt_plugin" = x; then
       # Don't configure libgomp for this offloading target if we don't build
       # the corresponding plugin.
       continue
-    elif test x"$offload_targets" = x; then
-      offload_targets=$tgt_name
+    elif test x"$offload_plugins" = x; then
+      offload_plugins=$tgt_plugin
     else
-      offload_targets=$offload_targets,$tgt_name
+      offload_plugins=$offload_plugins,$tgt_plugin
     fi
-    if test "$tgt_name" = hsa; then
+    # Configure additional search paths.
+    if test "$tgt_plugin" = hsa; then
       # Offloading compilation is all handled by the target compiler.
       :
     elif test x"$tgt_dir" != x; then
@@ -252,8 +254,8 @@ if test x"$enable_offload_targets" != x; then
     fi
   done
 fi
-AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
-  [Define to offload targets, separated by commas.])
+AC_DEFINE_UNQUOTED(OFFLOAD_PLUGINS, "$offload_plugins",
+  [Define to offload plugins, separated by commas.])
 AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1])
 AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLUGIN_NVPTX],
   [Define to 1 if the NVIDIA plugin is built, 0 if not.])
diff --git libgomp/target.c libgomp/target.c
index 48b9ab8..2b7e627 100644
--- libgomp/target.c
+++ libgomp/target.c
@@ -2474,9 +2474,9 @@ gomp_target_fini (void)
     }
 }
 
-/* This function initializes the runtime needed for offloading.
-   It parses the list of offload targets and tries to load the plugins for
-   these targets.  On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
+/* This function initializes the runtime for offloading.
+   It parses the list of offload plugins, and tries to load these.
+   On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
    will be set, and the array DEVICES initialized, containing descriptors for
    corresponding devices, first the GOMP_OFFLOAD_CAP_OPENMP_400 ones, follows
    by the others.  */
@@ -2493,7 +2493,7 @@ gomp_target_init (void)
   num_devices = 0;
   devices = NULL;
 
-  cur = OFFLOAD_TARGETS;
+  cur = OFFLOAD_PLUGINS;
   if (*cur)
     do
       {
diff --git libgomp/testsuite/Makefile.in libgomp/testsuite/Makefile.in
[...]
diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp
index 1cb4991..ae65e68 100644
--- libgomp/testsuite/lib/libgomp.exp
+++ libgomp/testsuite/lib/libgomp.exp
@@ -36,12 +36,11 @@ load_gcc_lib fortran-modules.exp
 # Try to load a test support file, built during libgomp configuration.
 load_file libgomp-test-support.exp
 
-# Populate offload_targets_s (offloading targets separated by a space), and
-# offload_targets_s_openacc (the same, but with OpenACC names; OpenACC spells
-# some of them a little differently).
-set offload_targets_s [split $offload_targets ","]
+# Populate offload_plugins_s (offloading plugins separated by a space), and
+# offload_targets_s_openacc (offload targets with OpenACC device type names).
+set offload_plugins_s [split $offload_plugins ","]
 set offload_targets_s_openacc {}
-foreach offload_target_openacc $offload_targets_s {
+foreach offload_target_openacc $offload_plugins_s {
     # Translate to OpenACC names, or skip if not yet supported.
     switch $offload_target_openacc {
 	intelmic {
@@ -135,9 +134,9 @@ proc libgomp_init { args } {
     set always_ld_library_path ".:${blddir}/.libs"
 
     # Add liboffloadmic build directory in LD_LIBRARY_PATH to support
-    # non-fallback testing for Intel MIC targets
-    global offload_targets
-    if { [string match "*,intelmic,*" ",$offload_targets,"] } {
+    # Intel MIC offloading testing.
+    global offload_plugins
+    if { [string match "*,intelmic,*" ",$offload_plugins,"] } {
 	append always_ld_library_path ":${blddir}/../liboffloadmic/.libs"
 	append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
 	# libstdc++ is required by liboffloadmic
@@ -245,8 +244,7 @@ proc libgomp_init { args } {
     # Disable color diagnostics
     lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
 
-    # Used for support non-fallback offloading.
-    # Help GCC to find target mkoffload.
+    # Help GCC to find offload compilers' mkoffload.
     global offload_additional_options
     if { $offload_additional_options != "" } {
 	lappend ALWAYS_CFLAGS "additional_flags=${offload_additional_options}"
@@ -373,9 +371,8 @@ proc check_effective_target_openacc_nvidia_accel_present { } {
     } "" ]
 }
 
-# Return 1 if at least one nvidia board is present, and the nvidia device type
-# is selected by default by means of setting the environment variable
-# ACC_DEVICE_TYPE.
+# Return 1 if at least one nvidia board is present, and the OpenACC "nvidia"
+# device type is selected.
 
 proc check_effective_target_openacc_nvidia_accel_selected { } {
     if { ![check_effective_target_openacc_nvidia_accel_present] } {
@@ -388,7 +385,7 @@ proc check_effective_target_openacc_nvidia_accel_selected { } {
     return 0;
 }
 
-# Return 1 if the host target is selected for offloaded
+# Return 1 if the OpenACC "host" device type is selected.
 
 proc check_effective_target_openacc_host_selected { } {
     global offload_target_openacc
diff --git libgomp/testsuite/libgomp-test-support.exp.in libgomp/testsuite/libgomp-test-support.exp.in
index 5a724fb..1068483 100644
--- libgomp/testsuite/libgomp-test-support.exp.in
+++ libgomp/testsuite/libgomp-test-support.exp.in
@@ -3,4 +3,4 @@ set cuda_driver_lib "@CUDA_DRIVER_LIB@"
 set hsa_runtime_lib "@HSA_RUNTIME_LIB@"
 set hsa_kmt_lib "@HSA_KMT_LIB@"
 
-set offload_targets "@offload_targets@"
+set offload_plugins "@offload_plugins@"


Grüße
 Thomas

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

* Re: libgomp: Unconfuse offload plugins vs. offload targets
  2016-06-08 13:28 libgomp: Unconfuse offload plugins vs. offload targets Thomas Schwinge
@ 2016-06-08 14:08 ` Jakub Jelinek
  2016-06-08 15:46   ` Thomas Schwinge
  0 siblings, 1 reply; 22+ messages in thread
From: Jakub Jelinek @ 2016-06-08 14:08 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches

On Wed, Jun 08, 2016 at 03:27:44PM +0200, Thomas Schwinge wrote:
> Hi!
> 
> This got me confused recently, so I took the effort to clean it up.  OK
> to commit?

As I said earlier, I don't find anything confusing on what we have there
and would strongly prefer not to change it.
Can you submit the actual testsuite change which got hidden in all the
renaming separately?

Thanks.

	Jakub

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

* Re: libgomp: Unconfuse offload plugins vs. offload targets
  2016-06-08 14:08 ` Jakub Jelinek
@ 2016-06-08 15:46   ` Thomas Schwinge
  0 siblings, 0 replies; 22+ messages in thread
From: Thomas Schwinge @ 2016-06-08 15:46 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

Hi!

On Wed, 8 Jun 2016 16:08:38 +0200, Jakub Jelinek <jakub@redhat.com> wrote:
> On Wed, Jun 08, 2016 at 03:27:44PM +0200, Thomas Schwinge wrote:
> > This got me confused recently, so I took the effort to clean it up.  OK
> > to commit?
> 
> As I said earlier, I don't find anything confusing on what we have there
> and would strongly prefer not to change it.

Please explain why you are rejecting clean-up patches that make the code
(variable names) actually match its semantics, make it easy for the
reader?

> Can you submit the actual testsuite change which got hidden in all the
> renaming separately?
> 
> Thanks.

I submitted that more than a month ago, and pinged it thrice,
<http://news.gmane.org/find-root.php?message_id=%3C871t4qu15e.fsf%40hertz.schwinge.homeip.net%3E>.
As you can see, there actually is a difference between offload_plugins
and offload_targets (for example, "intelmic"
vs. "x86_64-intelmicemul-linux-gnu"), and I'm using both variables -- to
avoid having to translate the more specific
"x86_64-intelmicemul-linux-gnu" (which we required in the test harness)
into the less specific "intelmic" (for plugin loading) in
libgomp/target.c.  I can do that, so that we can continue to use just a
single offload_targets variable, but I consider that a less elegant
solution.


Grüße
 Thomas

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

* [PING, two months] libgomp: In OpenACC testing, cycle though $offload_targets, and by default only build for the offload target that we're actually going to test
  2016-05-25  8:50               ` Thomas Schwinge
@ 2016-06-29  9:19                 ` Thomas Schwinge
  0 siblings, 0 replies; 22+ messages in thread
From: Thomas Schwinge @ 2016-06-29  9:19 UTC (permalink / raw)
  To: Jakub Jelinek, gcc-patches

Hi!

Ping...  Now waiting for review for two months.

Quoting my latest commentary from
<http://news.gmane.org/find-root.php?message_id=%3C87oa7br8ej.fsf%40hertz.schwinge.homeip.net%3E>:

| [...] there actually is a difference between offload_plugins and
| offload_targets (for example, "intelmic"
| vs. "x86_64-intelmicemul-linux-gnu"), and I'm using both variables --
| to avoid having to translate the more specific
| "x86_64-intelmicemul-linux-gnu" (which we required in the test harness)
| into the less specific "intelmic" (for plugin loading) in
| libgomp/target.c.  I can do that, so that we can continue to use just a
| single offload_targets variable, but I consider that a less elegant
| solution.


Grüße
 Thomas


On Wed, 25 May 2016 08:01:17 +0200, I wrote:
> Ping...
> 
> On Wed, 18 May 2016 13:41:25 +0200, I wrote:
> > Ping.
> > 
> > On Wed, 11 May 2016 15:45:13 +0200, I wrote:
> > > Ping.
> > > 
> > > On Mon, 02 May 2016 11:54:27 +0200, I wrote:
> > > > On Fri, 29 Apr 2016 09:43:41 +0200, Jakub Jelinek <jakub@redhat.com> wrote:
> > > > > On Thu, Apr 28, 2016 at 12:43:43PM +0200, Thomas Schwinge wrote:
> > > > > > commit 3b521f3e35fdb4b320e95b5f6a82b8d89399481a
> > > > > > Author: Thomas Schwinge <thomas@codesourcery.com>
> > > > > > Date:   Thu Apr 21 11:36:39 2016 +0200
> > > > > > 
> > > > > >     libgomp: Unconfuse offload plugins vs. offload targets
> > > > > 
> > > > > I don't like this patch at all, rather than unconfusing stuff it
> > > > > makes stuff confusing.  Plugins are just a way to support various
> > > > > offloading targets.
> > > > 
> > > > Huh; my patch exactly clarifies that the offload_targets variable does
> > > > not actually list offload target names, but does list libgomp offload
> > > > plugin names...
> > > > 
> > > > > Can you please post just a short patch without all those changes
> > > > > that does what you want, rather than renaming everything at the same time?
> > > > 
> > > > I thought incremental, self-contained patches were easier to review.
> > > > Anyway, here's the three patches merged into one:
> > > > 
> > > > commit 8060ae3474072eef685381d80f566d1c0942c603
> > > > Author: Thomas Schwinge <thomas@codesourcery.com>
> > > > Date:   Thu Apr 21 11:36:39 2016 +0200
> > > > 
> > > >     libgomp: In OpenACC testing, cycle though $offload_targets, and by default only build for the offload target that we're actually going to test
> > > >     
> > > >     	libgomp/
> > > >     	* plugin/configfrag.ac (offload_targets): Actually enumerate
> > > >     	offload targets, and add...
> > > >     	(offload_plugins): ... this one to enumerate offload plugins.
> > > >     	(OFFLOAD_PLUGINS): Renamed from OFFLOAD_TARGETS.
> > > >     	* target.c (gomp_target_init): Adjust to that.
> > > >     	* testsuite/lib/libgomp.exp: Likewise.
> > > >     	(offload_targets_s, offload_targets_s_openacc): Remove variables.
> > > >     	(offload_target_to_openacc_device_type): New proc.
> > > >     	(check_effective_target_openacc_nvidia_accel_selected)
> > > >     	(check_effective_target_openacc_host_selected): Examine
> > > >     	$openacc_device_type instead of $offload_target_openacc.
> > > >     	* Makefile.in: Regenerate.
> > > >     	* config.h.in: Likewise.
> > > >     	* configure: Likewise.
> > > >     	* testsuite/Makefile.in: Likewise.
> > > >     	* testsuite/libgomp.oacc-c++/c++.exp: Cycle through
> > > >     	$offload_targets (plus "disable") instead of
> > > >     	$offload_targets_s_openacc, and add "-foffload=$offload_target" to
> > > >     	tagopt.
> > > >     	* testsuite/libgomp.oacc-c/c.exp: Likewise.
> > > >     	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
> > > > ---
> > > >  libgomp/Makefile.in                                |  1 +
> > > >  libgomp/config.h.in                                |  4 +-
> > > >  libgomp/configure                                  | 44 +++++++------
> > > >  libgomp/plugin/configfrag.ac                       | 39 +++++++-----
> > > >  libgomp/target.c                                   |  8 +--
> > > >  libgomp/testsuite/Makefile.in                      |  1 +
> > > >  libgomp/testsuite/lib/libgomp.exp                  | 72 ++++++++++------------
> > > >  libgomp/testsuite/libgomp.oacc-c++/c++.exp         | 30 +++++----
> > > >  libgomp/testsuite/libgomp.oacc-c/c.exp             | 30 +++++----
> > > >  libgomp/testsuite/libgomp.oacc-fortran/fortran.exp | 22 ++++---
> > > >  10 files changed, 142 insertions(+), 109 deletions(-)
> > > > 
> > > > diff --git libgomp/Makefile.in libgomp/Makefile.in
> > > > [snipped]
> > > > diff --git libgomp/config.h.in libgomp/config.h.in
> > > > [snipped]
> > > > diff --git libgomp/configure libgomp/configure
> > > > [snipped]
> > > > diff --git libgomp/plugin/configfrag.ac libgomp/plugin/configfrag.ac
> > > > index 88b4156..de0a6f6 100644
> > > > --- libgomp/plugin/configfrag.ac
> > > > +++ libgomp/plugin/configfrag.ac
> > > > @@ -26,8 +26,6 @@
> > > >  # see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
> > > >  # <http://www.gnu.org/licenses/>.
> > > >  
> > > > -offload_targets=
> > > > -AC_SUBST(offload_targets)
> > > >  plugin_support=yes
> > > >  AC_CHECK_LIB(dl, dlsym, , [plugin_support=no])
> > > >  if test x"$plugin_support" = xyes; then
> > > > @@ -142,7 +140,13 @@ AC_SUBST(PLUGIN_HSA_LIBS)
> > > >  
> > > >  
> > > >  
> > > > -# Get offload targets and path to install tree of offloading compiler.
> > > > +# Parse offload targets, and figure out libgomp plugin, and configure the
> > > > +# corresponding offload compiler.  offload_plugins and offload_targets will be
> > > > +# populated in the same order.
> > > > +offload_plugins=
> > > > +offload_targets=
> > > > +AC_SUBST(offload_plugins)
> > > > +AC_SUBST(offload_targets)
> > > >  offload_additional_options=
> > > >  offload_additional_lib_paths=
> > > >  AC_SUBST(offload_additional_options)
> > > > @@ -151,13 +155,13 @@ if test x"$enable_offload_targets" != x; then
> > > >    for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
> > > >      tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
> > > >      tgt=`echo $tgt | sed 's/=.*//'`
> > > > -    tgt_name=
> > > > +    tgt_plugin=
> > > >      case $tgt in
> > > >        *-intelmic-* | *-intelmicemul-*)
> > > > -	tgt_name=intelmic
> > > > +	tgt_plugin=intelmic
> > > >  	;;
> > > >        nvptx*)
> > > > -        tgt_name=nvptx
> > > > +	tgt_plugin=nvptx
> > > >  	PLUGIN_NVPTX=$tgt
> > > >  	PLUGIN_NVPTX_CPPFLAGS=$CUDA_DRIVER_CPPFLAGS
> > > >  	PLUGIN_NVPTX_LDFLAGS=$CUDA_DRIVER_LDFLAGS
> > > > @@ -184,7 +188,7 @@ if test x"$enable_offload_targets" != x; then
> > > >  	    ;;
> > > >  	esac
> > > >  	;;
> > > > -      hsa*)
> > > > +      hsa)
> > > >  	case "${target}" in
> > > >  	  x86_64-*-*)
> > > >  	    case " ${CC} ${CFLAGS} " in
> > > > @@ -192,7 +196,7 @@ if test x"$enable_offload_targets" != x; then
> > > >  	        PLUGIN_HSA=0
> > > >  		;;
> > > >  	      *)
> > > > -	        tgt_name=hsa
> > > > +		tgt_plugin=hsa
> > > >  	        PLUGIN_HSA=$tgt
> > > >  	        PLUGIN_HSA_CPPFLAGS=$HSA_RUNTIME_CPPFLAGS
> > > >  	        PLUGIN_HSA_LDFLAGS="$HSA_RUNTIME_LDFLAGS $HSA_KMT_LDFLAGS"
> > > > @@ -214,7 +218,7 @@ if test x"$enable_offload_targets" != x; then
> > > >  	        LDFLAGS=$PLUGIN_HSA_save_LDFLAGS
> > > >  	        LIBS=$PLUGIN_HSA_save_LIBS
> > > >  	        case $PLUGIN_HSA in
> > > > -	          hsa*)
> > > > +		  hsa)
> > > >  	            HSA_PLUGIN=0
> > > >  	            AC_MSG_ERROR([HSA run-time package required for HSA support])
> > > >  	            ;;
> > > > @@ -231,16 +235,19 @@ if test x"$enable_offload_targets" != x; then
> > > >  	AC_MSG_ERROR([unknown offload target specified])
> > > >  	;;
> > > >      esac
> > > > -    if test x"$tgt_name" = x; then
> > > > +    if test x"$tgt_plugin" = x; then
> > > >        # Don't configure libgomp for this offloading target if we don't build
> > > >        # the corresponding plugin.
> > > >        continue
> > > > -    elif test x"$offload_targets" = x; then
> > > > -      offload_targets=$tgt_name
> > > > +    elif test x"$offload_plugins" = x; then
> > > > +      offload_plugins=$tgt_plugin
> > > > +      offload_targets=$tgt
> > > >      else
> > > > -      offload_targets=$offload_targets,$tgt_name
> > > > +      offload_plugins=$offload_plugins,$tgt_plugin
> > > > +      offload_targets=$offload_targets,$tgt
> > > >      fi
> > > > -    if test "$tgt_name" = hsa; then
> > > > +    # Configure additional search paths.
> > > > +    if test "$tgt_plugin" = hsa; then
> > > >        # Offloading compilation is all handled by the target compiler.
> > > >        :
> > > >      elif test x"$tgt_dir" != x; then
> > > > @@ -252,8 +259,8 @@ if test x"$enable_offload_targets" != x; then
> > > >      fi
> > > >    done
> > > >  fi
> > > > -AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
> > > > -  [Define to offload targets, separated by commas.])
> > > > +AC_DEFINE_UNQUOTED(OFFLOAD_PLUGINS, "$offload_plugins",
> > > > +  [Define to offload plugins, separated by commas.])
> > > >  AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1])
> > > >  AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLUGIN_NVPTX],
> > > >    [Define to 1 if the NVIDIA plugin is built, 0 if not.])
> > > > diff --git libgomp/target.c libgomp/target.c
> > > > index e2dd0e0..c12c085 100644
> > > > --- libgomp/target.c
> > > > +++ libgomp/target.c
> > > > @@ -2467,9 +2467,9 @@ gomp_target_fini (void)
> > > >      }
> > > >  }
> > > >  
> > > > -/* This function initializes the runtime needed for offloading.
> > > > -   It parses the list of offload targets and tries to load the plugins for
> > > > -   these targets.  On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
> > > > +/* This function initializes the runtime for offloading.
> > > > +   It parses the list of offload plugins, and tries to load these.
> > > > +   On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
> > > >     will be set, and the array DEVICES initialized, containing descriptors for
> > > >     corresponding devices, first the GOMP_OFFLOAD_CAP_OPENMP_400 ones, follows
> > > >     by the others.  */
> > > > @@ -2486,7 +2486,7 @@ gomp_target_init (void)
> > > >    num_devices = 0;
> > > >    devices = NULL;
> > > >  
> > > > -  cur = OFFLOAD_TARGETS;
> > > > +  cur = OFFLOAD_PLUGINS;
> > > >    if (*cur)
> > > >      do
> > > >        {
> > > > diff --git libgomp/testsuite/Makefile.in libgomp/testsuite/Makefile.in
> > > > [snipped]
> > > > diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp
> > > > index 1cb4991..4a25421 100644
> > > > --- libgomp/testsuite/lib/libgomp.exp
> > > > +++ libgomp/testsuite/lib/libgomp.exp
> > > > @@ -36,28 +36,6 @@ load_gcc_lib fortran-modules.exp
> > > >  # Try to load a test support file, built during libgomp configuration.
> > > >  load_file libgomp-test-support.exp
> > > >  
> > > > -# Populate offload_targets_s (offloading targets separated by a space), and
> > > > -# offload_targets_s_openacc (the same, but with OpenACC names; OpenACC spells
> > > > -# some of them a little differently).
> > > > -set offload_targets_s [split $offload_targets ","]
> > > > -set offload_targets_s_openacc {}
> > > > -foreach offload_target_openacc $offload_targets_s {
> > > > -    # Translate to OpenACC names, or skip if not yet supported.
> > > > -    switch $offload_target_openacc {
> > > > -	intelmic {
> > > > -	    continue
> > > > -	}
> > > > -	nvptx {
> > > > -	    set offload_target_openacc "nvidia"
> > > > -	}
> > > > -	hsa {
> > > > -	    continue
> > > > -	}
> > > > -    }
> > > > -    lappend offload_targets_s_openacc "$offload_target_openacc"
> > > > -}
> > > > -lappend offload_targets_s_openacc "host"
> > > > -
> > > >  set dg-do-what-default run
> > > >  
> > > >  #
> > > > @@ -135,9 +113,9 @@ proc libgomp_init { args } {
> > > >      set always_ld_library_path ".:${blddir}/.libs"
> > > >  
> > > >      # Add liboffloadmic build directory in LD_LIBRARY_PATH to support
> > > > -    # non-fallback testing for Intel MIC targets
> > > > +    # Intel MIC offloading testing.
> > > >      global offload_targets
> > > > -    if { [string match "*,intelmic,*" ",$offload_targets,"] } {
> > > > +    if { [string match "*,*-intelmic*,*" ",$offload_targets,"] } {
> > > >  	append always_ld_library_path ":${blddir}/../liboffloadmic/.libs"
> > > >  	append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
> > > >  	# libstdc++ is required by liboffloadmic
> > > > @@ -245,8 +223,7 @@ proc libgomp_init { args } {
> > > >      # Disable color diagnostics
> > > >      lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
> > > >  
> > > > -    # Used for support non-fallback offloading.
> > > > -    # Help GCC to find target mkoffload.
> > > > +    # Help GCC to find offload compilers' mkoffload.
> > > >      global offload_additional_options
> > > >      if { $offload_additional_options != "" } {
> > > >  	lappend ALWAYS_CFLAGS "additional_flags=${offload_additional_options}"
> > > > @@ -322,6 +299,28 @@ proc libgomp_option_proc { option } {
> > > >      }
> > > >  }
> > > >  
> > > > +# Translate offload target to OpenACC device type.  Return the empty string if
> > > > +# not suitable or not yet supported, and "host" for offload target "disable".
> > > > +proc offload_target_to_openacc_device_type { offload_target } {
> > > > +    switch -glob $offload_target {
> > > > +	disable {
> > > > +	    return "host"
> > > > +	}
> > > > +	hsa {
> > > > +	    return ""
> > > > +	}
> > > > +	*-intelmic* {
> > > > +	    return ""
> > > > +	}
> > > > +	nvptx* {
> > > > +	    return "nvidia"
> > > > +	}
> > > > +	default {
> > > > +	    error "Unknwon offload target: $offload_target"
> > > > +	}
> > > > +    }
> > > > +}
> > > > +
> > > >  # Return 1 if offload device is available.
> > > >  proc check_effective_target_offload_device { } {
> > > >      return [check_runtime_nocache offload_device_available_ {
> > > > @@ -373,29 +372,22 @@ proc check_effective_target_openacc_nvidia_accel_present { } {
> > > >      } "" ]
> > > >  }
> > > >  
> > > > -# Return 1 if at least one nvidia board is present, and the nvidia device type
> > > > -# is selected by default by means of setting the environment variable
> > > > -# ACC_DEVICE_TYPE.
> > > > +# Return 1 if at least one nvidia board is present, and the OpenACC "nvidia"
> > > > +# device type is selected.
> > > >  
> > > >  proc check_effective_target_openacc_nvidia_accel_selected { } {
> > > >      if { ![check_effective_target_openacc_nvidia_accel_present] } {
> > > >  	return 0;
> > > >      }
> > > > -    global offload_target_openacc
> > > > -    if { $offload_target_openacc == "nvidia" } {
> > > > -        return 1;
> > > > -    }
> > > > -    return 0;
> > > > +    global openacc_device_type
> > > > +    return [string match "nvidia" $openacc_device_type]
> > > >  }
> > > >  
> > > > -# Return 1 if the host target is selected for offloaded
> > > > +# Return 1 if the OpenACC "host" device type is selected.
> > > >  
> > > >  proc check_effective_target_openacc_host_selected { } {
> > > > -    global offload_target_openacc
> > > > -    if { $offload_target_openacc == "host" } {
> > > > -        return 1;
> > > > -    }
> > > > -    return 0;
> > > > +    global openacc_device_type
> > > > +    return [string match "host" $openacc_device_type]
> > > >  }
> > > >  
> > > >  # Return 1 if the selected OMP device is actually a HSA device
> > > > diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
> > > > index 608b298..befb921 100644
> > > > --- libgomp/testsuite/libgomp.oacc-c++/c++.exp
> > > > +++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
> > > > @@ -70,18 +70,23 @@ if { $lang_test_file_found } {
> > > >  	set libstdcxx_includes ""
> > > >      }
> > > >  
> > > > -    # Test OpenACC with available accelerators.
> > > > -    foreach offload_target_openacc $offload_targets_s_openacc {
> > > > -	set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
> > > > +    # Test with all offload targets, and with offloading disabled.
> > > > +    foreach offload_target [concat [split $offload_targets ","] "disable"] {
> > > > +	set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
> > > > +	set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
> > > >  
> > > > -	switch $offload_target_openacc {
> > > > -	    host {
> > > > +	switch $openacc_device_type {
> > > > +	    "" {
> > > > +		untested "$subdir $offload_target offloading"
> > > > +		continue
> > > > +	    }
> > > > +	    "host" {
> > > >  		set acc_mem_shared 1
> > > >  	    }
> > > > -	    nvidia {
> > > > +	    "nvidia" {
> > > >  		if { ![check_effective_target_openacc_nvidia_accel_present] } {
> > > >  		    # Don't bother; execution testing is going to FAIL.
> > > > -		    untested "$subdir $offload_target_openacc offloading"
> > > > +		    untested "$subdir $offload_target offloading"
> > > >  		    continue
> > > >  		}
> > > >  
> > > > @@ -94,12 +99,15 @@ if { $lang_test_file_found } {
> > > >  		set acc_mem_shared 0
> > > >  	    }
> > > >  	    default {
> > > > -		set acc_mem_shared 0
> > > > +		error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
> > > >  	    }
> > > >  	}
> > > >  	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
> > > >  
> > > > -	setenv ACC_DEVICE_TYPE $offload_target_openacc
> > > > +	# To avoid overhead, by default only build for the offload target that
> > > > +	# we're actually going to test.
> > > > +	set tagopt "$tagopt -foffload=$offload_target"
> > > > +	setenv ACC_DEVICE_TYPE $openacc_device_type
> > > >  
> > > >  	# To get better test coverage for device-specific code that is only
> > > >  	# ever used in offloading configurations, we'd like more thorough
> > > > @@ -108,8 +116,8 @@ if { $lang_test_file_found } {
> > > >  	# -O0 and -O2 only, to avoid testing times exploding too much, under
> > > >  	# the assumption that between -O0 and -O[something] there is the
> > > >  	# biggest difference in the overall structure of the generated code.
> > > > -	switch $offload_target_openacc {
> > > > -	    host {
> > > > +	switch $offload_target {
> > > > +	    "disable" {
> > > >  		set-torture-options [list \
> > > >  					 { -O2 } ]
> > > >  	    }
> > > > diff --git libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
> > > > index b509a10..5355b87 100644
> > > > --- libgomp/testsuite/libgomp.oacc-c/c.exp
> > > > +++ libgomp/testsuite/libgomp.oacc-c/c.exp
> > > > @@ -31,20 +31,25 @@ set ld_library_path $always_ld_library_path
> > > >  append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
> > > >  set_ld_library_path_env_vars
> > > >  
> > > > -# Test OpenACC with available accelerators.
> > > > +# Test with all offload targets, and with offloading disabled.
> > > >  set SAVE_ALWAYS_CFLAGS "$ALWAYS_CFLAGS"
> > > > -foreach offload_target_openacc $offload_targets_s_openacc {
> > > > +foreach offload_target [concat [split $offload_targets ","] "disable"] {
> > > >      set ALWAYS_CFLAGS "$SAVE_ALWAYS_CFLAGS"
> > > > -    set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
> > > > +    set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
> > > > +    set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
> > > >  
> > > > -    switch $offload_target_openacc {
> > > > -	host {
> > > > +    switch $openacc_device_type {
> > > > +	"" {
> > > > +	    untested "$subdir $offload_target offloading"
> > > > +	    continue
> > > > +	}
> > > > +	"host" {
> > > >  	    set acc_mem_shared 1
> > > >  	}
> > > > -	nvidia {
> > > > +	"nvidia" {
> > > >  	    if { ![check_effective_target_openacc_nvidia_accel_present] } {
> > > >  		# Don't bother; execution testing is going to FAIL.
> > > > -		untested "$subdir $offload_target_openacc offloading"
> > > > +		untested "$subdir $offload_target offloading"
> > > >  		continue
> > > >  	    }
> > > >  
> > > > @@ -57,12 +62,15 @@ foreach offload_target_openacc $offload_targets_s_openacc {
> > > >  	    set acc_mem_shared 0
> > > >  	}
> > > >  	default {
> > > > -	    set acc_mem_shared 0
> > > > +	    error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
> > > >  	}
> > > >      }
> > > >      set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
> > > >  
> > > > -    setenv ACC_DEVICE_TYPE $offload_target_openacc
> > > > +    # To avoid overhead, by default only build for the offload target that
> > > > +    # we're actually going to test.
> > > > +    set tagopt "$tagopt -foffload=$offload_target"
> > > > +    setenv ACC_DEVICE_TYPE $openacc_device_type
> > > >  
> > > >      # To get better test coverage for device-specific code that is only
> > > >      # ever used in offloading configurations, we'd like more thorough
> > > > @@ -71,8 +79,8 @@ foreach offload_target_openacc $offload_targets_s_openacc {
> > > >      # -O0 and -O2 only, to avoid testing times exploding too much, under
> > > >      # the assumption that between -O0 and -O[something] there is the
> > > >      # biggest difference in the overall structure of the generated code.
> > > > -    switch $offload_target_openacc {
> > > > -	host {
> > > > +    switch $offload_target {
> > > > +	"disable" {
> > > >  	    set-torture-options [list \
> > > >  				     { -O2 } ]
> > > >  	}
> > > > diff --git libgomp/testsuite/libgomp.oacc-fortran/fortran.exp libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
> > > > index 2d6b647..8507b67 100644
> > > > --- libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
> > > > +++ libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
> > > > @@ -65,30 +65,38 @@ if { $lang_test_file_found } {
> > > >      append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
> > > >      set_ld_library_path_env_vars
> > > >  
> > > > -    # Test OpenACC with available accelerators.
> > > > -    foreach offload_target_openacc $offload_targets_s_openacc {
> > > > -	set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
> > > > +    # Test with all offload targets, and with offloading disabled.
> > > > +    foreach offload_target [concat [split $offload_targets ","] "disable"] {
> > > > +	set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
> > > > +	set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
> > > >  
> > > > -	switch $offload_target_openacc {
> > > > +	switch $openacc_device_type {
> > > > +	    "" {
> > > > +		untested "$subdir $offload_target offloading"
> > > > +		continue
> > > > +	    }
> > > >  	    host {
> > > >  		set acc_mem_shared 1
> > > >  	    }
> > > >  	    nvidia {
> > > >  		if { ![check_effective_target_openacc_nvidia_accel_present] } {
> > > >  		    # Don't bother; execution testing is going to FAIL.
> > > > -		    untested "$subdir $offload_target_openacc offloading"
> > > > +		    untested "$subdir $offload_target offloading"
> > > >  		    continue
> > > >  		}
> > > >  
> > > >  		set acc_mem_shared 0
> > > >  	    }
> > > >  	    default {
> > > > -		set acc_mem_shared 0
> > > > +		error "Unknwon OpenACC device type: $openacc_device_type (offload target: $offload_target)"
> > > >  	    }
> > > >  	}
> > > >  	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
> > > >  
> > > > -	setenv ACC_DEVICE_TYPE $offload_target_openacc
> > > > +	# To avoid overhead, by default only build for the offload target that
> > > > +	# we're actually going to test.
> > > > +	set tagopt "$tagopt -foffload=$offload_target"
> > > > +	setenv ACC_DEVICE_TYPE $openacc_device_type
> > > >  
> > > >  	# For Fortran we're doing torture testing, as Fortran has far more tests
> > > >  	# with arrays etc. that testing just -O0 or -O2 is insufficient, that is
> > 
> > 
> > Grüße
> >  Thomas

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

end of thread, other threads:[~2016-06-29  9:18 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-22 12:14 Also test -O0 for OpenACC C, C++ offloading test cases Thomas Schwinge
2016-03-22 13:04 ` Thomas Schwinge
2016-03-23  0:03 ` Bernd Schmidt
2016-03-23  7:35   ` Thomas Schwinge
2016-03-23 19:19     ` Bernd Schmidt
2016-03-24 23:33       ` Thomas Schwinge
2016-03-29 13:35         ` Thomas Schwinge
2016-04-01  8:56         ` [gomp4] " Thomas Schwinge
2016-04-07 16:30           ` Thomas Schwinge
2016-04-08  8:33             ` [gomp4] [PR testsuite/70579, PR testsuite/70580] Fix test cases failing because of the compiler's "avoid offloading" decision (was: Also test -O0 for OpenACC C, C++ offloading test cases) Thomas Schwinge
2016-03-23 19:47 ` Also test -O0 for OpenACC C, C++ offloading test cases Jakub Jelinek
2016-03-25  1:05   ` check-target-libgomp wall time, without vs. with offloading (was: Also test -O0 for OpenACC C, C++ offloading test cases) Thomas Schwinge
2016-04-28 10:44     ` check-target-libgomp wall time, without vs. with offloading Thomas Schwinge
2016-04-29  7:43       ` Jakub Jelinek
2016-05-02  9:56         ` libgomp: In OpenACC testing, cycle though $offload_targets, and by default only build for the offload target that we're actually going to test (was: check-target-libgomp wall time, without vs. with offloading) Thomas Schwinge
2016-05-11 13:45           ` libgomp: In OpenACC testing, cycle though $offload_targets, and by default only build for the offload target that we're actually going to test Thomas Schwinge
2016-05-18 11:42             ` Thomas Schwinge
2016-05-25  8:50               ` Thomas Schwinge
2016-06-29  9:19                 ` [PING, two months] " Thomas Schwinge
2016-06-08 13:28 libgomp: Unconfuse offload plugins vs. offload targets Thomas Schwinge
2016-06-08 14:08 ` Jakub Jelinek
2016-06-08 15:46   ` 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).