[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
This commit is contained in:
Thomas Schwinge 2019-02-22 11:51:20 +01:00 committed by Thomas Schwinge
parent ee332b4a9a
commit 0a0384b43a
10 changed files with 86 additions and 48 deletions

View 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.

View 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@

10
libgomp/configure vendored
View File

@ -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

View 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

View 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@

View 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

View 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@"

View 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 } ]
}

View 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 } ]
}

View 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"