[libgomp] In OpenACC testing, cycle though all offload targets
authorThomas Schwinge <thomas@codesourcery.com>
Fri, 22 Feb 2019 10:51:20 +0000 (11:51 +0100)
committerThomas Schwinge <tschwinge@gcc.gnu.org>
Fri, 22 Feb 2019 10:51:20 +0000 (11:51 +0100)
... instead of through offload plugins.

libgomp/
* plugin/configfrag.ac: Populate and AC_SUBST offload_targets.
* testsuite/libgomp-test-support.exp.in: Adjust.
* testsuite/lib/libgomp.exp: Likewise.  Don't populate
openacc_device_types_s.
(offload_target_to_openacc_device_type): New proc.
* testsuite/libgomp.oacc-c++/c++.exp: Adjust.
* testsuite/libgomp.oacc-c/c.exp: Likewise.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
* Makefile.in: Regenerate.
* configure: Likewise.
* testsuite/Makefile.in: Likewise.

From-SVN: r269108

libgomp/ChangeLog
libgomp/Makefile.in
libgomp/configure
libgomp/plugin/configfrag.ac
libgomp/testsuite/Makefile.in
libgomp/testsuite/lib/libgomp.exp
libgomp/testsuite/libgomp-test-support.exp.in
libgomp/testsuite/libgomp.oacc-c++/c++.exp
libgomp/testsuite/libgomp.oacc-c/c.exp
libgomp/testsuite/libgomp.oacc-fortran/fortran.exp

index 344e83f082f4d265e5628746041e59f90e2dcb34..53a5511b0330f27c9841f20515e885e65fe67f6d 100644 (file)
@@ -1,5 +1,17 @@
 2019-02-22  Thomas Schwinge  <thomas@codesourcery.com>
 
+       * plugin/configfrag.ac: Populate and AC_SUBST offload_targets.
+       * testsuite/libgomp-test-support.exp.in: Adjust.
+       * testsuite/lib/libgomp.exp: Likewise.  Don't populate
+       openacc_device_types_s.
+       (offload_target_to_openacc_device_type): New proc.
+       * testsuite/libgomp.oacc-c++/c++.exp: Adjust.
+       * testsuite/libgomp.oacc-c/c.exp: Likewise.
+       * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
+       * Makefile.in: Regenerate.
+       * configure: Likewise.
+       * testsuite/Makefile.in: Likewise.
+
        * plugin/configfrag.ac: Populate and AC_SUBST offload_plugins
        instead of offload_targets, and AC_DEFINE_UNQUOTED OFFLOAD_PLUGINS
        instead of OFFLOAD_TARGETS.
index 12ce8d05c19ffbb681259c5fbe4bfc1156792796..c7e63f120fdb502cfc37d454ae4bb9f136827be3 100644 (file)
@@ -494,6 +494,7 @@ multi_basedir = @multi_basedir@
 offload_additional_lib_paths = @offload_additional_lib_paths@
 offload_additional_options = @offload_additional_options@
 offload_plugins = @offload_plugins@
+offload_targets = @offload_targets@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
 prefix = @prefix@
index 1033ae4d988d0748161af92bc866c62ea0e4ff65..b4bc4f4362892eb16c9fed1f301bca47f3450d44 100755 (executable)
@@ -667,6 +667,7 @@ PLUGIN_NVPTX_FALSE
 PLUGIN_NVPTX_TRUE
 offload_additional_lib_paths
 offload_additional_options
+offload_targets
 offload_plugins
 PLUGIN_HSA_LIBS
 PLUGIN_HSA_LDFLAGS
@@ -11392,7 +11393,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11395 "configure"
+#line 11396 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11498,7 +11499,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11501 "configure"
+#line 11502 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15621,7 +15622,10 @@ PLUGIN_HSA_LIBS=
 
 # Parse '--enable-offload-targets', figure out the corresponding libgomp
 # plugins, and configure to find the corresponding offload compilers.
+# 'offload_plugins' and 'offload_targets' will be populated in the same order.
 offload_plugins=
+offload_targets=
+
 
 offload_additional_options=
 offload_additional_lib_paths=
@@ -15737,8 +15741,10 @@ rm -f core conftest.err conftest.$ac_objext \
       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
index c49d17991e6b8a542092fe86fb7eddceb0bb30db..9718ac752e2d51bd19b1cb53131da9dedbb4b551 100644 (file)
@@ -139,8 +139,11 @@ AC_SUBST(PLUGIN_HSA_LIBS)
 
 # Parse '--enable-offload-targets', figure out the corresponding libgomp
 # plugins, and configure to find the corresponding offload compilers.
+# '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)
@@ -244,8 +247,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
index 7e0e830b240698a665e434b6d714a47e59b09f78..80315b15a7d58315ac9fbc6ff3e508c87ca49acb 100644 (file)
@@ -272,6 +272,7 @@ multi_basedir = @multi_basedir@
 offload_additional_lib_paths = @offload_additional_lib_paths@
 offload_additional_options = @offload_additional_options@
 offload_plugins = @offload_plugins@
+offload_targets = @offload_targets@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
 prefix = @prefix@
index 766e9ddd95b9691d8558e9f32052fd0bfd7369e9..cb75e06c585269ad98cc1f1b7d0a32a50aa45948 100644 (file)
@@ -41,31 +41,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 (offload plugins, separated by a space), and
-# openacc_device_types_s (OpenACC device type names for suitable offload
-# plugins, separated by a space).
-set offload_plugins_s [split $offload_plugins ","]
-set openacc_device_types_s {}
-foreach offload_plugin $offload_plugins_s {
-    # Translate to OpenACC names, or skip if not yet supported.
-    switch $offload_plugin {
-       intelmic {
-           continue
-       }
-       nvptx {
-           set offload_plugin "nvidia"
-       }
-       hsa {
-           continue
-       }
-       default {
-           error "Unknown offload target: $offload_target_openacc"
-       }
-    }
-    lappend openacc_device_types_s "$offload_plugin"
-}
-lappend openacc_device_types_s "host"
-
 set dg-do-what-default run
 
 #
@@ -325,6 +300,28 @@ proc libgomp_option_proc { option } {
     }
 }
 
+# Translate offload target to OpenACC device type.  Return the empty string if
+# not 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 "Unknown offload target: $offload_target"
+       }
+    }
+}
+
 # Return 1 if offload device is available.
 proc check_effective_target_offload_device { } {
     return [check_runtime_nocache offload_device_available_ {
@@ -368,8 +365,8 @@ proc check_effective_target_offload_device_shared_as { } {
 # Return 1 if configured for 'nvptx' offloading.
 
 proc check_effective_target_openacc_nvidia_accel_configured { } {
-    global offload_plugins
-    if { ![string match "*,nvptx,*" ",$offload_plugins,"] } {
+    global offload_targets
+    if { ![string match "*,nvptx*,*" ",$offload_targets,"] } {
         return 0
     }
     # PR libgomp/65099: Currently, we only support offloading in 64-bit
index 6cf31ae4bf9a786708322a17f3115820cae0c3e2..98fb442b5370e078e1e0d5c0c864774930d83a47 100644 (file)
@@ -3,3 +3,4 @@ set cuda_driver_lib "@CUDA_DRIVER_LIB@"
 set hsa_runtime_lib "@HSA_RUNTIME_LIB@"
 
 set offload_plugins "@offload_plugins@"
+set offload_targets "@offload_targets@"
index 0854f60c8faaa2a0f9d4020a50522f1364ab4f8b..29805c67bade204376c336309a8eea26535a3dd8 100644 (file)
@@ -77,19 +77,24 @@ if { $lang_test_file_found } {
        set libstdcxx_includes ""
     }
 
-    # Test with available OpenACC device types.
-    global openacc_device_type
-    foreach openacc_device_type $openacc_device_types_s {
+    # Test with all available offload targets, and with offloading disabled.
+    foreach offload_target [concat [split $offload_targets ","] "disable"] {
+       global openacc_device_type
+       set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
        set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
 
        switch $openacc_device_type {
+           "" {
+               unsupported "$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 $openacc_device_type offloading: supported, but hardware not accessible"
+                   untested "$subdir $offload_target offloading: supported, but hardware not accessible"
                    continue
                }
 
@@ -102,7 +107,7 @@ if { $lang_test_file_found } {
                set acc_mem_shared 0
            }
            default {
-               error "Unknown OpenACC device type: $openacc_device_type"
+               error "Unknown OpenACC device type: $openacc_device_type (offload target: $offload_target)"
            }
        }
        set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
@@ -116,8 +121,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 $openacc_device_type {
-           host {
+       switch -glob $offload_target {
+           disable {
                set-torture-options [list \
                                         { -O2 } ]
            }
index 2e0c050d6dec949fe4ae7dedac09c98bb0047699..2cd75be0cc7292ca1b7f573123b674fe67ad2177 100644 (file)
@@ -38,21 +38,26 @@ 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 with available OpenACC device types.
+# Test with all available offload targets, and with offloading disabled.
 set SAVE_ALWAYS_CFLAGS "$ALWAYS_CFLAGS"
-global openacc_device_type
-foreach openacc_device_type $openacc_device_types_s {
+foreach offload_target [concat [split $offload_targets ","] "disable"] {
     set ALWAYS_CFLAGS "$SAVE_ALWAYS_CFLAGS"
+    global openacc_device_type
+    set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
     set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
 
     switch $openacc_device_type {
+       "" {
+           unsupported "$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 $openacc_device_type offloading: supported, but hardware not accessible"
+               untested "$subdir $offload_target offloading: supported, but hardware not accessible"
                continue
            }
 
@@ -65,7 +70,7 @@ foreach openacc_device_type $openacc_device_types_s {
            set acc_mem_shared 0
        }
        default {
-           error "Unknown OpenACC device type: $openacc_device_type"
+           error "Unknown OpenACC device type: $openacc_device_type (offload target: $offload_target)"
        }
     }
     set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
@@ -79,8 +84,8 @@ foreach openacc_device_type $openacc_device_types_s {
     # -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 $openacc_device_type {
-       host {
+    switch -glob $offload_target {
+       disable {
            set-torture-options [list \
                                     { -O2 } ]
        }
index 83f4f6b47d8adfe091f6a2401227f7c45d224abd..b2baa73d91a42485950a2b438275a98357c6ff4c 100644 (file)
@@ -65,26 +65,31 @@ if { $lang_test_file_found } {
     append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
     set_ld_library_path_env_vars
 
-    # Test with available OpenACC device types.
-    global openacc_device_type
-    foreach openacc_device_type $openacc_device_types_s {
+    # Test with all available offload targets, and with offloading disabled.
+    foreach offload_target [concat [split $offload_targets ","] "disable"] {
+       global openacc_device_type
+       set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
        set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
 
        switch $openacc_device_type {
+           "" {
+               unsupported "$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 $openacc_device_type offloading: supported, but hardware not accessible"
+                   untested "$subdir $offload_target offloading: supported, but hardware not accessible"
                    continue
                }
 
                set acc_mem_shared 0
            }
            default {
-               error "Unknown OpenACC device type: $openacc_device_type"
+               error "Unknown OpenACC device type: $openacc_device_type (offload target: $offload_target)"
            }
        }
        set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"