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/libgomp.oacc-c++/c++.exp: Likewise. Report if
"offloading: supported, but hardware not accessible".
multi_basedir = @multi_basedir@
offload_additional_lib_paths = @offload_additional_lib_paths@
offload_additional_options = @offload_additional_options@
-offload_targets = @offload_targets@
+offload_plugins = @offload_plugins@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
*/
#undef LT_OBJDIR
-/* Define to offload targets, separated by commas. */
-#undef OFFLOAD_TARGETS
+/* Define to offload plugins, separated by commas. */
+#undef OFFLOAD_PLUGINS
/* Name of package */
#undef PACKAGE
PLUGIN_NVPTX_TRUE
offload_additional_lib_paths
offload_additional_options
+offload_plugins
PLUGIN_HSA_LIBS
PLUGIN_HSA_LDFLAGS
PLUGIN_HSA_CPPFLAGS
PLUGIN_NVPTX
CUDA_DRIVER_LIB
CUDA_DRIVER_INCLUDE
-offload_targets
libtool_VERSION
ac_ct_FC
FCFLAGS
# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# <http://www.gnu.org/licenses/>.
-offload_targets=
-
plugin_support=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5
$as_echo_n "checking for dlsym in -ldl... " >&6; }
-# 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_lib_paths=
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
if test "x$CUDA_DRIVER_LIB" != xno \
&& test "x$CUDA_DRIVER_LIB" != xno; 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"
LDFLAGS=$PLUGIN_HSA_save_LDFLAGS
LIBS=$PLUGIN_HSA_save_LIBS
case $PLUGIN_HSA in
- hsa*)
+ hsa*)
HSA_PLUGIN=0
as_fn_error $? "HSA run-time package required for HSA support" "$LINENO" 5
;;
as_fn_error $? "unknown offload target specified" "$LINENO" 5
;;
esac
- if test x"$tgt_name" = x; then
- # Don't configure libgomp for this offloading target if we don't build
- # the corresponding plugin.
+ if test x"$tgt_plugin" = x; then
+ # Not configuring libgomp for this offload target if we're not building
+ # the corresponding offload 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
fi
cat >>confdefs.h <<_ACEOF
-#define OFFLOAD_TARGETS "$offload_targets"
+#define OFFLOAD_PLUGINS "$offload_plugins"
_ACEOF
if test $PLUGIN_NVPTX = 1; then
# 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
AC_SUBST(PLUGIN_HSA_LDFLAGS)
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_lib_paths=
AC_SUBST(offload_additional_options)
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
if test "x$CUDA_DRIVER_LIB" != xno \
&& test "x$CUDA_DRIVER_LIB" != xno; 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"
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])
;;
AC_MSG_ERROR([unknown offload target specified])
;;
esac
- if test x"$tgt_name" = x; then
- # Don't configure libgomp for this offloading target if we don't build
- # the corresponding plugin.
+ if test x"$tgt_plugin" = x; then
+ # Not configuring libgomp for this offload target if we're not building
+ # the corresponding offload 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
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.])
}
}
-/* 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. */
num_devices = 0;
devices = NULL;
- cur = OFFLOAD_TARGETS;
+ cur = OFFLOAD_PLUGINS;
if (*cur)
do
{
multi_basedir = @multi_basedir@
offload_additional_lib_paths = @offload_additional_lib_paths@
offload_additional_options = @offload_additional_options@
-offload_targets = @offload_targets@
+offload_plugins = @offload_plugins@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
# 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 {
+# 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_target_openacc {
+ switch $offload_plugin {
intelmic {
continue
}
nvptx {
- set offload_target_openacc "nvidia"
+ set offload_plugin "nvidia"
}
hsa {
continue
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 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
# 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}"
} ]
}
-# Return 1 if configured for nvptx offloading.
+# Return 1 if configured for 'nvptx' offloading.
proc check_effective_target_openacc_nvidia_accel_configured { } {
- global offload_targets
- if { ![string match "*,nvptx,*" ",$offload_targets,"] } {
+ global offload_plugins
+ if { ![string match "*,nvptx,*" ",$offload_plugins,"] } {
return 0
}
# PR libgomp/65099: Currently, we only support offloading in 64-bit
} "" ]
}
-# Return 1 if at least one Nvidia GPU is accessible, 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 GPU is accessible, 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
set cuda_driver_lib "@CUDA_DRIVER_LIB@"
set hsa_runtime_lib "@HSA_RUNTIME_LIB@"
-set offload_targets "@offload_targets@"
+set offload_plugins "@offload_plugins@"
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 available OpenACC device types.
+ global openacc_device_type
+ 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 {
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: supported, but hardware not accessible"
+ untested "$subdir $openacc_device_type offloading: supported, but hardware not accessible"
continue
}
set acc_mem_shared 0
}
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"
- 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
# -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 {
+ switch $openacc_device_type {
host {
set-torture-options [list \
{ -O2 } ]
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 available OpenACC device types.
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 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 {
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: supported, but hardware not accessible"
+ untested "$subdir $openacc_device_type offloading: supported, but hardware not accessible"
continue
}
set acc_mem_shared 0
}
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"
- 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
# -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 {
+ switch $openacc_device_type {
host {
set-torture-options [list \
{ -O2 } ]
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 available OpenACC device types.
+ global openacc_device_type
+ 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 {
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: supported, but hardware not accessible"
+ untested "$subdir $openacc_device_type offloading: supported, but hardware not accessible"
continue
}
set acc_mem_shared 0
}
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"
- 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