From 0a0384b43ad3f5abb1382bbd2ad2ade5fea7ff77 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Fri, 22 Feb 2019 11:51:20 +0100 Subject: [PATCH] [libgomp] In OpenACC testing, cycle though all offload targets ... 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 | 12 +++++ libgomp/Makefile.in | 1 + libgomp/configure | 10 +++- libgomp/plugin/configfrag.ac | 5 ++ libgomp/testsuite/Makefile.in | 1 + libgomp/testsuite/lib/libgomp.exp | 51 +++++++++---------- libgomp/testsuite/libgomp-test-support.exp.in | 1 + libgomp/testsuite/libgomp.oacc-c++/c++.exp | 19 ++++--- libgomp/testsuite/libgomp.oacc-c/c.exp | 19 ++++--- .../libgomp.oacc-fortran/fortran.exp | 15 ++++-- 10 files changed, 86 insertions(+), 48 deletions(-) diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 344e83f082f..53a5511b033 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,5 +1,17 @@ 2019-02-22 Thomas Schwinge + * 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. diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in index 12ce8d05c19..c7e63f120fd 100644 --- a/libgomp/Makefile.in +++ b/libgomp/Makefile.in @@ -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@ diff --git a/libgomp/configure b/libgomp/configure index 1033ae4d988..b4bc4f43628 100755 --- a/libgomp/configure +++ b/libgomp/configure @@ -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 diff --git a/libgomp/plugin/configfrag.ac b/libgomp/plugin/configfrag.ac index c49d17991e6..9718ac752e2 100644 --- a/libgomp/plugin/configfrag.ac +++ b/libgomp/plugin/configfrag.ac @@ -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 diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in index 7e0e830b240..80315b15a7d 100644 --- a/libgomp/testsuite/Makefile.in +++ b/libgomp/testsuite/Makefile.in @@ -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@ diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp index 766e9ddd95b..cb75e06c585 100644 --- a/libgomp/testsuite/lib/libgomp.exp +++ b/libgomp/testsuite/lib/libgomp.exp @@ -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 diff --git a/libgomp/testsuite/libgomp-test-support.exp.in b/libgomp/testsuite/libgomp-test-support.exp.in index 6cf31ae4bf9..98fb442b537 100644 --- a/libgomp/testsuite/libgomp-test-support.exp.in +++ b/libgomp/testsuite/libgomp-test-support.exp.in @@ -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@" diff --git a/libgomp/testsuite/libgomp.oacc-c++/c++.exp b/libgomp/testsuite/libgomp.oacc-c++/c++.exp index 0854f60c8fa..29805c67bad 100644 --- a/libgomp/testsuite/libgomp.oacc-c++/c++.exp +++ b/libgomp/testsuite/libgomp.oacc-c++/c++.exp @@ -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 } ] } diff --git a/libgomp/testsuite/libgomp.oacc-c/c.exp b/libgomp/testsuite/libgomp.oacc-c/c.exp index 2e0c050d6de..2cd75be0cc7 100644 --- a/libgomp/testsuite/libgomp.oacc-c/c.exp +++ b/libgomp/testsuite/libgomp.oacc-c/c.exp @@ -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 } ] } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp index 83f4f6b47d8..b2baa73d91a 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp +++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp @@ -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" -- 2.30.2