[libgomp] Clarify difference between offload target, offload plugin, and OpenACC device type

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.
	* testsuite/libgomp-test-support.exp.in: Likewise.
	* testsuite/lib/libgomp.exp: Likewise.  Populate
	openacc_device_types_s instead of offload_targets_s_openacc.
	(check_effective_target_openacc_nvidia_accel_selected)
	(check_effective_target_openacc_host_selected): Adjust.
	* testsuite/libgomp.oacc-c++/c++.exp: Likewise.
	* testsuite/libgomp.oacc-c/c.exp: Likewise.
	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
	* Makefile.in: Regenerate.
	* config.h.in: Likewise.
	* configure: Likewise.
	* testsuite/Makefile.in: Likewise.

From-SVN: r269107
This commit is contained in:
Thomas Schwinge 2019-02-22 11:51:05 +01:00 committed by Thomas Schwinge
parent 1241136c71
commit ee332b4a9a
12 changed files with 114 additions and 98 deletions

View File

@ -1,5 +1,22 @@
2019-02-22 Thomas Schwinge <thomas@codesourcery.com> 2019-02-22 Thomas Schwinge <thomas@codesourcery.com>
* 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.
* testsuite/libgomp-test-support.exp.in: Likewise.
* testsuite/lib/libgomp.exp: Likewise. Populate
openacc_device_types_s instead of offload_targets_s_openacc.
(check_effective_target_openacc_nvidia_accel_selected)
(check_effective_target_openacc_host_selected): Adjust.
* testsuite/libgomp.oacc-c++/c++.exp: Likewise.
* testsuite/libgomp.oacc-c/c.exp: Likewise.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
* Makefile.in: Regenerate.
* config.h.in: Likewise.
* configure: Likewise.
* testsuite/Makefile.in: Likewise.
* testsuite/lib/libgomp.exp: Error out for unknown offload target. * testsuite/lib/libgomp.exp: Error out for unknown offload target.
* testsuite/libgomp.oacc-c++/c++.exp: Likewise. Report if * testsuite/libgomp.oacc-c++/c++.exp: Likewise. Report if
"offloading: supported, but hardware not accessible". "offloading: supported, but hardware not accessible".

View File

@ -493,7 +493,7 @@ mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@ multi_basedir = @multi_basedir@
offload_additional_lib_paths = @offload_additional_lib_paths@ offload_additional_lib_paths = @offload_additional_lib_paths@
offload_additional_options = @offload_additional_options@ offload_additional_options = @offload_additional_options@
offload_targets = @offload_targets@ offload_plugins = @offload_plugins@
oldincludedir = @oldincludedir@ oldincludedir = @oldincludedir@
pdfdir = @pdfdir@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@

View File

@ -146,8 +146,8 @@
*/ */
#undef LT_OBJDIR #undef LT_OBJDIR
/* Define to offload targets, separated by commas. */ /* Define to offload plugins, separated by commas. */
#undef OFFLOAD_TARGETS #undef OFFLOAD_PLUGINS
/* Name of package */ /* Name of package */
#undef PACKAGE #undef PACKAGE

36
libgomp/configure vendored
View File

@ -667,6 +667,7 @@ PLUGIN_NVPTX_FALSE
PLUGIN_NVPTX_TRUE PLUGIN_NVPTX_TRUE
offload_additional_lib_paths offload_additional_lib_paths
offload_additional_options offload_additional_options
offload_plugins
PLUGIN_HSA_LIBS PLUGIN_HSA_LIBS
PLUGIN_HSA_LDFLAGS PLUGIN_HSA_LDFLAGS
PLUGIN_HSA_CPPFLAGS PLUGIN_HSA_CPPFLAGS
@ -679,7 +680,6 @@ PLUGIN_NVPTX_CPPFLAGS
PLUGIN_NVPTX PLUGIN_NVPTX
CUDA_DRIVER_LIB CUDA_DRIVER_LIB
CUDA_DRIVER_INCLUDE CUDA_DRIVER_INCLUDE
offload_targets
libtool_VERSION libtool_VERSION
ac_ct_FC ac_ct_FC
FCFLAGS FCFLAGS
@ -15401,8 +15401,6 @@ fi
# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
offload_targets=
plugin_support=yes plugin_support=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5
$as_echo_n "checking for dlsym in -ldl... " >&6; } $as_echo_n "checking for dlsym in -ldl... " >&6; }
@ -15621,7 +15619,10 @@ PLUGIN_HSA_LIBS=
# Get offload targets and path to install tree of offloading compiler. # Parse '--enable-offload-targets', figure out the corresponding libgomp
# plugins, and configure to find the corresponding offload compilers.
offload_plugins=
offload_additional_options= offload_additional_options=
offload_additional_lib_paths= offload_additional_lib_paths=
@ -15630,13 +15631,13 @@ if test x"$enable_offload_targets" != x; then
for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'` tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
tgt=`echo $tgt | sed 's/=.*//'` tgt=`echo $tgt | sed 's/=.*//'`
tgt_name= tgt_plugin=
case $tgt in case $tgt in
*-intelmic-* | *-intelmicemul-*) *-intelmic-* | *-intelmicemul-*)
tgt_name=intelmic tgt_plugin=intelmic
;; ;;
nvptx*) nvptx*)
tgt_name=nvptx tgt_plugin=nvptx
PLUGIN_NVPTX=$tgt PLUGIN_NVPTX=$tgt
if test "x$CUDA_DRIVER_LIB" != xno \ if test "x$CUDA_DRIVER_LIB" != xno \
&& test "x$CUDA_DRIVER_LIB" != xno; then && test "x$CUDA_DRIVER_LIB" != xno; then
@ -15695,7 +15696,7 @@ rm -f core conftest.err conftest.$ac_objext \
PLUGIN_HSA=0 PLUGIN_HSA=0
;; ;;
*) *)
tgt_name=hsa tgt_plugin=hsa
PLUGIN_HSA=$tgt PLUGIN_HSA=$tgt
PLUGIN_HSA_CPPFLAGS=$HSA_RUNTIME_CPPFLAGS PLUGIN_HSA_CPPFLAGS=$HSA_RUNTIME_CPPFLAGS
PLUGIN_HSA_LDFLAGS="$HSA_RUNTIME_LDFLAGS" PLUGIN_HSA_LDFLAGS="$HSA_RUNTIME_LDFLAGS"
@ -15713,7 +15714,7 @@ rm -f core conftest.err conftest.$ac_objext \
LDFLAGS=$PLUGIN_HSA_save_LDFLAGS LDFLAGS=$PLUGIN_HSA_save_LDFLAGS
LIBS=$PLUGIN_HSA_save_LIBS LIBS=$PLUGIN_HSA_save_LIBS
case $PLUGIN_HSA in case $PLUGIN_HSA in
hsa*) hsa*)
HSA_PLUGIN=0 HSA_PLUGIN=0
as_fn_error $? "HSA run-time package required for HSA support" "$LINENO" 5 as_fn_error $? "HSA run-time package required for HSA support" "$LINENO" 5
;; ;;
@ -15730,16 +15731,17 @@ rm -f core conftest.err conftest.$ac_objext \
as_fn_error $? "unknown offload target specified" "$LINENO" 5 as_fn_error $? "unknown offload target specified" "$LINENO" 5
;; ;;
esac 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 # Not configuring libgomp for this offload target if we're not building
# the corresponding plugin. # the corresponding offload plugin.
continue continue
elif test x"$offload_targets" = x; then elif test x"$offload_plugins" = x; then
offload_targets=$tgt_name offload_plugins=$tgt_plugin
else else
offload_targets=$offload_targets,$tgt_name offload_plugins=$offload_plugins,$tgt_plugin
fi 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. # Offloading compilation is all handled by the target compiler.
: :
elif test x"$tgt_dir" != x; then elif test x"$tgt_dir" != x; then
@ -15753,7 +15755,7 @@ rm -f core conftest.err conftest.$ac_objext \
fi fi
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
#define OFFLOAD_TARGETS "$offload_targets" #define OFFLOAD_PLUGINS "$offload_plugins"
_ACEOF _ACEOF
if test $PLUGIN_NVPTX = 1; then if test $PLUGIN_NVPTX = 1; then

View File

@ -26,8 +26,6 @@
# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
offload_targets=
AC_SUBST(offload_targets)
plugin_support=yes plugin_support=yes
AC_CHECK_LIB(dl, dlsym, , [plugin_support=no]) AC_CHECK_LIB(dl, dlsym, , [plugin_support=no])
if test x"$plugin_support" = xyes; then if test x"$plugin_support" = xyes; then
@ -139,7 +137,10 @@ AC_SUBST(PLUGIN_HSA_CPPFLAGS)
AC_SUBST(PLUGIN_HSA_LDFLAGS) AC_SUBST(PLUGIN_HSA_LDFLAGS)
AC_SUBST(PLUGIN_HSA_LIBS) AC_SUBST(PLUGIN_HSA_LIBS)
# Get offload targets and path to install tree of offloading compiler. # Parse '--enable-offload-targets', figure out the corresponding libgomp
# plugins, and configure to find the corresponding offload compilers.
offload_plugins=
AC_SUBST(offload_plugins)
offload_additional_options= offload_additional_options=
offload_additional_lib_paths= offload_additional_lib_paths=
AC_SUBST(offload_additional_options) AC_SUBST(offload_additional_options)
@ -148,13 +149,13 @@ if test x"$enable_offload_targets" != x; then
for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'` tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
tgt=`echo $tgt | sed 's/=.*//'` tgt=`echo $tgt | sed 's/=.*//'`
tgt_name= tgt_plugin=
case $tgt in case $tgt in
*-intelmic-* | *-intelmicemul-*) *-intelmic-* | *-intelmicemul-*)
tgt_name=intelmic tgt_plugin=intelmic
;; ;;
nvptx*) nvptx*)
tgt_name=nvptx tgt_plugin=nvptx
PLUGIN_NVPTX=$tgt PLUGIN_NVPTX=$tgt
if test "x$CUDA_DRIVER_LIB" != xno \ if test "x$CUDA_DRIVER_LIB" != xno \
&& test "x$CUDA_DRIVER_LIB" != xno; then && test "x$CUDA_DRIVER_LIB" != xno; then
@ -202,7 +203,7 @@ if test x"$enable_offload_targets" != x; then
PLUGIN_HSA=0 PLUGIN_HSA=0
;; ;;
*) *)
tgt_name=hsa tgt_plugin=hsa
PLUGIN_HSA=$tgt PLUGIN_HSA=$tgt
PLUGIN_HSA_CPPFLAGS=$HSA_RUNTIME_CPPFLAGS PLUGIN_HSA_CPPFLAGS=$HSA_RUNTIME_CPPFLAGS
PLUGIN_HSA_LDFLAGS="$HSA_RUNTIME_LDFLAGS" PLUGIN_HSA_LDFLAGS="$HSA_RUNTIME_LDFLAGS"
@ -220,7 +221,7 @@ if test x"$enable_offload_targets" != x; then
LDFLAGS=$PLUGIN_HSA_save_LDFLAGS LDFLAGS=$PLUGIN_HSA_save_LDFLAGS
LIBS=$PLUGIN_HSA_save_LIBS LIBS=$PLUGIN_HSA_save_LIBS
case $PLUGIN_HSA in case $PLUGIN_HSA in
hsa*) hsa*)
HSA_PLUGIN=0 HSA_PLUGIN=0
AC_MSG_ERROR([HSA run-time package required for HSA support]) AC_MSG_ERROR([HSA run-time package required for HSA support])
;; ;;
@ -237,16 +238,17 @@ if test x"$enable_offload_targets" != x; then
AC_MSG_ERROR([unknown offload target specified]) AC_MSG_ERROR([unknown offload target specified])
;; ;;
esac 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 # Not configuring libgomp for this offload target if we're not building
# the corresponding plugin. # the corresponding offload plugin.
continue continue
elif test x"$offload_targets" = x; then elif test x"$offload_plugins" = x; then
offload_targets=$tgt_name offload_plugins=$tgt_plugin
else else
offload_targets=$offload_targets,$tgt_name offload_plugins=$offload_plugins,$tgt_plugin
fi 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. # Offloading compilation is all handled by the target compiler.
: :
elif test x"$tgt_dir" != x; then elif test x"$tgt_dir" != x; then
@ -258,8 +260,8 @@ if test x"$enable_offload_targets" != x; then
fi fi
done done
fi fi
AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets", AC_DEFINE_UNQUOTED(OFFLOAD_PLUGINS, "$offload_plugins",
[Define to offload targets, separated by commas.]) [Define to offload plugins, separated by commas.])
AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1]) AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1])
AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLUGIN_NVPTX], AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLUGIN_NVPTX],
[Define to 1 if the NVIDIA plugin is built, 0 if not.]) [Define to 1 if the NVIDIA plugin is built, 0 if not.])

View File

@ -2710,9 +2710,9 @@ gomp_target_fini (void)
} }
} }
/* This function initializes the runtime needed for offloading. /* This function initializes the runtime for offloading.
It parses the list of offload targets and tries to load the plugins for It parses the list of offload plugins, and tries to load these.
these targets. On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
will be set, and the array DEVICES initialized, containing descriptors for will be set, and the array DEVICES initialized, containing descriptors for
corresponding devices, first the GOMP_OFFLOAD_CAP_OPENMP_400 ones, follows corresponding devices, first the GOMP_OFFLOAD_CAP_OPENMP_400 ones, follows
by the others. */ by the others. */
@ -2729,7 +2729,7 @@ gomp_target_init (void)
num_devices = 0; num_devices = 0;
devices = NULL; devices = NULL;
cur = OFFLOAD_TARGETS; cur = OFFLOAD_PLUGINS;
if (*cur) if (*cur)
do do
{ {

View File

@ -271,7 +271,7 @@ mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@ multi_basedir = @multi_basedir@
offload_additional_lib_paths = @offload_additional_lib_paths@ offload_additional_lib_paths = @offload_additional_lib_paths@
offload_additional_options = @offload_additional_options@ offload_additional_options = @offload_additional_options@
offload_targets = @offload_targets@ offload_plugins = @offload_plugins@
oldincludedir = @oldincludedir@ oldincludedir = @oldincludedir@
pdfdir = @pdfdir@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@

View File

@ -41,19 +41,19 @@ load_gcc_lib fortran-modules.exp
# Try to load a test support file, built during libgomp configuration. # Try to load a test support file, built during libgomp configuration.
load_file libgomp-test-support.exp load_file libgomp-test-support.exp
# Populate offload_targets_s (offloading targets separated by a space), and # Populate offload_plugins_s (offload plugins, separated by a space), and
# offload_targets_s_openacc (the same, but with OpenACC names; OpenACC spells # openacc_device_types_s (OpenACC device type names for suitable offload
# some of them a little differently). # plugins, separated by a space).
set offload_targets_s [split $offload_targets ","] set offload_plugins_s [split $offload_plugins ","]
set offload_targets_s_openacc {} set openacc_device_types_s {}
foreach offload_target_openacc $offload_targets_s { foreach offload_plugin $offload_plugins_s {
# Translate to OpenACC names, or skip if not yet supported. # Translate to OpenACC names, or skip if not yet supported.
switch $offload_target_openacc { switch $offload_plugin {
intelmic { intelmic {
continue continue
} }
nvptx { nvptx {
set offload_target_openacc "nvidia" set offload_plugin "nvidia"
} }
hsa { hsa {
continue continue
@ -62,9 +62,9 @@ foreach offload_target_openacc $offload_targets_s {
error "Unknown offload target: $offload_target_openacc" error "Unknown offload target: $offload_target_openacc"
} }
} }
lappend offload_targets_s_openacc "$offload_target_openacc" lappend openacc_device_types_s "$offload_plugin"
} }
lappend offload_targets_s_openacc "host" lappend openacc_device_types_s "host"
set dg-do-what-default run set dg-do-what-default run
@ -143,9 +143,9 @@ proc libgomp_init { args } {
set always_ld_library_path ".:${blddir}/.libs" set always_ld_library_path ".:${blddir}/.libs"
# Add liboffloadmic build directory in LD_LIBRARY_PATH to support # Add liboffloadmic build directory in LD_LIBRARY_PATH to support
# non-fallback testing for Intel MIC targets # Intel MIC offloading testing.
global offload_targets global offload_plugins
if { [string match "*,intelmic,*" ",$offload_targets,"] } { if { [string match "*,intelmic,*" ",$offload_plugins,"] } {
append always_ld_library_path ":${blddir}/../liboffloadmic/.libs" append always_ld_library_path ":${blddir}/../liboffloadmic/.libs"
append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs" append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
# libstdc++ is required by liboffloadmic # libstdc++ is required by liboffloadmic
@ -249,8 +249,7 @@ proc libgomp_init { args } {
# Disable color diagnostics # Disable color diagnostics
lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never" lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
# Used for support non-fallback offloading. # Help GCC to find offload compilers' 'mkoffload'.
# Help GCC to find target mkoffload.
global offload_additional_options global offload_additional_options
if { $offload_additional_options != "" } { if { $offload_additional_options != "" } {
lappend ALWAYS_CFLAGS "additional_flags=${offload_additional_options}" lappend ALWAYS_CFLAGS "additional_flags=${offload_additional_options}"
@ -366,11 +365,11 @@ proc check_effective_target_offload_device_shared_as { } {
} ] } ]
} }
# Return 1 if configured for nvptx offloading. # Return 1 if configured for 'nvptx' offloading.
proc check_effective_target_openacc_nvidia_accel_configured { } { proc check_effective_target_openacc_nvidia_accel_configured { } {
global offload_targets global offload_plugins
if { ![string match "*,nvptx,*" ",$offload_targets,"] } { if { ![string match "*,nvptx,*" ",$offload_plugins,"] } {
return 0 return 0
} }
# PR libgomp/65099: Currently, we only support offloading in 64-bit # PR libgomp/65099: Currently, we only support offloading in 64-bit
@ -389,29 +388,22 @@ proc check_effective_target_openacc_nvidia_accel_present { } {
} "" ] } "" ]
} }
# Return 1 if at least one Nvidia GPU is accessible, and the nvidia device type # Return 1 if at least one Nvidia GPU is accessible, and the OpenACC 'nvidia'
# is selected by default by means of setting the environment variable # device type is selected.
# ACC_DEVICE_TYPE.
proc check_effective_target_openacc_nvidia_accel_selected { } { proc check_effective_target_openacc_nvidia_accel_selected { } {
if { ![check_effective_target_openacc_nvidia_accel_present] } { if { ![check_effective_target_openacc_nvidia_accel_present] } {
return 0; return 0;
} }
global offload_target_openacc global openacc_device_type
if { $offload_target_openacc == "nvidia" } { return [string match "nvidia" $openacc_device_type]
return 1;
}
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 { } { proc check_effective_target_openacc_host_selected { } {
global offload_target_openacc global openacc_device_type
if { $offload_target_openacc == "host" } { return [string match "host" $openacc_device_type]
return 1;
}
return 0;
} }
# Return 1 if the selected OMP device is actually a HSA device # Return 1 if the selected OMP device is actually a HSA device

View File

@ -2,4 +2,4 @@ set cuda_driver_include "@CUDA_DRIVER_INCLUDE@"
set cuda_driver_lib "@CUDA_DRIVER_LIB@" set cuda_driver_lib "@CUDA_DRIVER_LIB@"
set hsa_runtime_lib "@HSA_RUNTIME_LIB@" set hsa_runtime_lib "@HSA_RUNTIME_LIB@"
set offload_targets "@offload_targets@" set offload_plugins "@offload_plugins@"

View File

@ -77,18 +77,19 @@ if { $lang_test_file_found } {
set libstdcxx_includes "" set libstdcxx_includes ""
} }
# Test OpenACC with available accelerators. # Test with available OpenACC device types.
foreach offload_target_openacc $offload_targets_s_openacc { global openacc_device_type
set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1" foreach openacc_device_type $openacc_device_types_s {
set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
switch $offload_target_openacc { switch $openacc_device_type {
host { host {
set acc_mem_shared 1 set acc_mem_shared 1
} }
nvidia { nvidia {
if { ![check_effective_target_openacc_nvidia_accel_present] } { if { ![check_effective_target_openacc_nvidia_accel_present] } {
# Don't bother; execution testing is going to FAIL. # Don't bother; execution testing is going to FAIL.
untested "$subdir $offload_target_openacc offloading: supported, but hardware not accessible" untested "$subdir $openacc_device_type offloading: supported, but hardware not accessible"
continue continue
} }
@ -101,12 +102,12 @@ if { $lang_test_file_found } {
set acc_mem_shared 0 set acc_mem_shared 0
} }
default { default {
error "Unknown OpenACC device type: $offload_target_openacc" error "Unknown OpenACC device type: $openacc_device_type"
} }
} }
set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared" 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 # To get better test coverage for device-specific code that is only
# ever used in offloading configurations, we'd like more thorough # ever used in offloading configurations, we'd like more thorough
@ -115,7 +116,7 @@ if { $lang_test_file_found } {
# -O0 and -O2 only, to avoid testing times exploding too much, under # -O0 and -O2 only, to avoid testing times exploding too much, under
# the assumption that between -O0 and -O[something] there is the # the assumption that between -O0 and -O[something] there is the
# biggest difference in the overall structure of the generated code. # biggest difference in the overall structure of the generated code.
switch $offload_target_openacc { switch $openacc_device_type {
host { host {
set-torture-options [list \ set-torture-options [list \
{ -O2 } ] { -O2 } ]

View File

@ -38,20 +38,21 @@ set ld_library_path $always_ld_library_path
append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
set_ld_library_path_env_vars set_ld_library_path_env_vars
# Test OpenACC with available accelerators. # Test with available OpenACC device types.
set SAVE_ALWAYS_CFLAGS "$ALWAYS_CFLAGS" set SAVE_ALWAYS_CFLAGS "$ALWAYS_CFLAGS"
foreach offload_target_openacc $offload_targets_s_openacc { global openacc_device_type
foreach openacc_device_type $openacc_device_types_s {
set ALWAYS_CFLAGS "$SAVE_ALWAYS_CFLAGS" set ALWAYS_CFLAGS "$SAVE_ALWAYS_CFLAGS"
set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1" set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
switch $offload_target_openacc { switch $openacc_device_type {
host { host {
set acc_mem_shared 1 set acc_mem_shared 1
} }
nvidia { nvidia {
if { ![check_effective_target_openacc_nvidia_accel_present] } { if { ![check_effective_target_openacc_nvidia_accel_present] } {
# Don't bother; execution testing is going to FAIL. # Don't bother; execution testing is going to FAIL.
untested "$subdir $offload_target_openacc offloading: supported, but hardware not accessible" untested "$subdir $openacc_device_type offloading: supported, but hardware not accessible"
continue continue
} }
@ -64,12 +65,12 @@ foreach offload_target_openacc $offload_targets_s_openacc {
set acc_mem_shared 0 set acc_mem_shared 0
} }
default { default {
error "Unknown OpenACC device type: $offload_target_openacc" error "Unknown OpenACC device type: $openacc_device_type"
} }
} }
set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared" 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 # To get better test coverage for device-specific code that is only
# ever used in offloading configurations, we'd like more thorough # ever used in offloading configurations, we'd like more thorough
@ -78,7 +79,7 @@ foreach offload_target_openacc $offload_targets_s_openacc {
# -O0 and -O2 only, to avoid testing times exploding too much, under # -O0 and -O2 only, to avoid testing times exploding too much, under
# the assumption that between -O0 and -O[something] there is the # the assumption that between -O0 and -O[something] there is the
# biggest difference in the overall structure of the generated code. # biggest difference in the overall structure of the generated code.
switch $offload_target_openacc { switch $openacc_device_type {
host { host {
set-torture-options [list \ set-torture-options [list \
{ -O2 } ] { -O2 } ]

View File

@ -65,30 +65,31 @@ if { $lang_test_file_found } {
append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
set_ld_library_path_env_vars set_ld_library_path_env_vars
# Test OpenACC with available accelerators. # Test with available OpenACC device types.
foreach offload_target_openacc $offload_targets_s_openacc { global openacc_device_type
set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1" foreach openacc_device_type $openacc_device_types_s {
set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
switch $offload_target_openacc { switch $openacc_device_type {
host { host {
set acc_mem_shared 1 set acc_mem_shared 1
} }
nvidia { nvidia {
if { ![check_effective_target_openacc_nvidia_accel_present] } { if { ![check_effective_target_openacc_nvidia_accel_present] } {
# Don't bother; execution testing is going to FAIL. # Don't bother; execution testing is going to FAIL.
untested "$subdir $offload_target_openacc offloading: supported, but hardware not accessible" untested "$subdir $openacc_device_type offloading: supported, but hardware not accessible"
continue continue
} }
set acc_mem_shared 0 set acc_mem_shared 0
} }
default { default {
error "Unknown OpenACC device type: $offload_target_openacc" error "Unknown OpenACC device type: $openacc_device_type"
} }
} }
set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared" 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 # 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 # with arrays etc. that testing just -O0 or -O2 is insufficient, that is