Skip to content

Commit

Permalink
[PATCH 1/7] OpenMP 4.0 offloading infrastructure: configure and make
Browse files Browse the repository at this point in the history
	* configure: Regenerate.
	* configure.ac (--enable-as-accelerator-for)
	(--enable-offload-targets): New configure options.
gcc/
	* Makefile.in (real_target_noncanonical, accel_dir_suffix)
	(enable_as_accelerator): New variables substituted by configure.
	(libsubdir, libexecsubdir, unlibsubdir): Tweak for the possibility of
	being configured as an offload compiler.
	(DRIVER_DEFINES): Pass new defines DEFAULT_REAL_TARGET_MACHINE and
	ACCEL_DIR_SUFFIX.
	(install-cpp, install-common, install_driver, install-gcc-ar): Do not
	install for the offload compiler.
	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac (real_target_noncanonical, accel_dir_suffix)
	(enable_as_accelerator): Compute new variables.
	(ACCEL_COMPILER): Define if the compiler is built as the accel compiler.
	(OFFLOAD_TARGETS): List of target names suitable for offloading.
	(ENABLE_OFFLOADING): Define if list of offload targets is not empty.
gcc/cp/
	* Make-lang.in (c++.install-common): Do not install for the offload
	compiler.
gcc/doc/
	* install.texi (Options specification): Document
	--enable-as-accelerator-for and --enable-offload-targets.
gcc/fortran/
	* Make-lang.in (fortran.install-common): Do not install for the offload
	compiler.
libgcc/
	* Makefile.in (crtoffloadbegin$(objext)): New rule.
	(crtoffloadend$(objext)): Likewise.
	* configure: Regenerate.
	* configure.ac (accel_dir_suffix): Compute new variable.
	(extra_parts): Add crtoffloadbegin.o and crtoffloadend.o
	if enable_offload_targets is not empty.
	* offloadstuff.c: New file.
libgomp/
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Check for libdl, required for plugin support.
	(PLUGIN_SUPPORT): Define if plugins are supported.
	(enable_offload_targets): Support Intel MIC targets.
	(OFFLOAD_TARGETS): List of target names suitable for offloading.
lto-plugin/
	* Makefile.am (libexecsubdir): Tweak for the possibility of being
	configured for offload compiler.
	(accel_dir_suffix, real_target_noncanonical): New variables substituted
	by configure.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac (accel_dir_suffix, real_target_noncanonical): Compute new
	variables.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217485 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
kyukhin committed Nov 13, 2014
1 parent 139e42e commit a3d93be
Show file tree
Hide file tree
Showing 27 changed files with 603 additions and 66 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2014-11-13 Bernd Schmidt <bernds@codesourcery.com>
Thomas Schwinge <thomas@codesourcery.com>
Ilya Verbin <ilya.verbin@intel.com>
Andrey Turetskiy <andrey.turetskiy@intel.com>

* configure: Regenerate.
* configure.ac (--enable-as-accelerator-for)
(--enable-offload-targets): New configure options.

2014-11-11 Tobias Burnus <burnus@net-b.de>

* Makefile.def: Make all-gcc depend on all-isl.
Expand Down
29 changes: 29 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,8 @@ ospace_frag'
ac_user_opts='
enable_option_checking
with_build_libsubdir
enable_as_accelerator_for
enable_offload_targets
enable_gold
enable_ld
enable_libquadmath
Expand Down Expand Up @@ -1460,6 +1462,13 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-as-accelerator-for=ARG
build as offload target compiler. Specify offload
host triple by ARG
--enable-offload-targets=LIST
enable offloading to devices from comma-separated
LIST of TARGET[=DIR]. Use optional path to find
offload target compiler during the build
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-ld[=ARG] build ld [ARG={default,yes,no}]
--disable-libquadmath do not build libquadmath directory
Expand Down Expand Up @@ -2877,6 +2886,26 @@ case ${with_newlib} in
yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
esac

# Check whether --enable-as-accelerator-for was given.
if test "${enable_as_accelerator_for+set}" = set; then :
enableval=$enable_as_accelerator_for; ENABLE_AS_ACCELERATOR_FOR=$enableval
else
ENABLE_AS_ACCELERATOR_FOR=no
fi


# Check whether --enable-offload-targets was given.
if test "${enable_offload_targets+set}" = set; then :
enableval=$enable_offload_targets;
if test x"$enable_offload_targets" = x; then
as_fn_error "no offload targets specified" "$LINENO" 5
fi

else
enable_offload_targets=
fi


# Handle --enable-gold, --enable-ld.
# --disable-gold [--enable-ld]
# Build only ld. Default option.
Expand Down
18 changes: 18 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,24 @@ case ${with_newlib} in
yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
esac

AC_ARG_ENABLE(as-accelerator-for,
[AS_HELP_STRING([--enable-as-accelerator-for=ARG],
[build as offload target compiler.
Specify offload host triple by ARG])],
ENABLE_AS_ACCELERATOR_FOR=$enableval,
ENABLE_AS_ACCELERATOR_FOR=no)

AC_ARG_ENABLE(offload-targets,
[AS_HELP_STRING([--enable-offload-targets=LIST],
[enable offloading to devices from comma-separated LIST of
TARGET[=DIR]. Use optional path to find offload target compiler
during the build])],
[
if test x"$enable_offload_targets" = x; then
AC_MSG_ERROR([no offload targets specified])
fi
], [enable_offload_targets=])

# Handle --enable-gold, --enable-ld.
# --disable-gold [--enable-ld]
# Build only ld. Default option.
Expand Down
23 changes: 23 additions & 0 deletions gcc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
2014-11-13 Bernd Schmidt <bernds@codesourcery.com>
Thomas Schwinge <thomas@codesourcery.com>
Ilya Verbin <ilya.verbin@intel.com>
Andrey Turetskiy <andrey.turetskiy@intel.com>

* Makefile.in (real_target_noncanonical, accel_dir_suffix)
(enable_as_accelerator): New variables substituted by configure.
(libsubdir, libexecsubdir, unlibsubdir): Tweak for the possibility of
being configured as an offload compiler.
(DRIVER_DEFINES): Pass new defines DEFAULT_REAL_TARGET_MACHINE and
ACCEL_DIR_SUFFIX.
(install-cpp, install-common, install_driver, install-gcc-ar): Do not
install for the offload compiler.
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac (real_target_noncanonical, accel_dir_suffix)
(enable_as_accelerator): Compute new variables.
(ACCEL_COMPILER): Define if the compiler is built as the accel compiler.
(OFFLOAD_TARGETS): List of target names suitable for offloading.
(ENABLE_OFFLOADING): Define if list of offload targets is not empty.
* doc/install.texi (Options specification): Document
--enable-as-accelerator-for and --enable-offload-targets.

2014-11-13 H.J. Lu <hongjiu.lu@intel.com>

PR tree-optimization/63828
Expand Down
95 changes: 59 additions & 36 deletions gcc/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ host=@host@
target=@target@
target_noncanonical:=@target_noncanonical@

# Normally identical to target_noncanonical, except for compilers built
# as accelerator targets.
real_target_noncanonical:=@real_target_noncanonical@
accel_dir_suffix = @accel_dir_suffix@

# Sed command to transform gcc to installed name.
program_transform_name := @program_transform_name@

Expand Down Expand Up @@ -363,6 +368,8 @@ enable_plugin = @enable_plugin@

enable_host_shared = @enable_host_shared@

enable_as_accelerator = @enable_as_accelerator@

CPPLIB = ../libcpp/libcpp.a
CPPINC = -I$(srcdir)/../libcpp/include

Expand Down Expand Up @@ -574,17 +581,21 @@ libexecdir = @libexecdir@
# --------

# Directory in which the compiler finds libraries etc.
libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(version)
libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
# Directory in which the compiler finds executables
libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(version)
libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
# Directory in which all plugin resources are installed
plugin_resourcesdir = $(libsubdir)/plugin
# Directory in which plugin headers are installed
plugin_includedir = $(plugin_resourcesdir)/include
# Directory in which plugin specific executables are installed
plugin_bindir = $(libexecsubdir)/plugin
# Used to produce a relative $(gcc_tooldir) in gcc.o
ifeq ($(enable_as_accelerator),yes)
unlibsubdir = ../../../../..
else
unlibsubdir = ../../..
endif
# $(prefix), expressed as a path relative to $(libsubdir).
#
# An explanation of the sed strings:
Expand Down Expand Up @@ -1957,9 +1968,11 @@ DRIVER_DEFINES = \
-DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
-DSTANDARD_LIBEXEC_PREFIX=\"$(libexecdir)/gcc/\" \
-DDEFAULT_TARGET_VERSION=\"$(version)\" \
-DDEFAULT_REAL_TARGET_MACHINE=\"$(real_target_noncanonical)\" \
-DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\" \
-DSTANDARD_BINDIR_PREFIX=\"$(bindir)/\" \
-DTOOLDIR_BASE_PREFIX=\"$(libsubdir_to_prefix)$(prefix_to_exec_prefix)\" \
-DACCEL_DIR_SUFFIX=\"$(accel_dir_suffix)\" \
@TARGET_SYSTEM_ROOT_DEFINE@ \
$(VALGRIND_DRIVER_DEFINES) \
$(if $(SHLIB),$(if $(filter yes,@enable_shared@),-DENABLE_SHARED_LIBGCC)) \
Expand Down Expand Up @@ -3164,12 +3177,14 @@ install-strip: install

# Handle cpp installation.
install-cpp: installdirs cpp$(exeext)
-rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext)
-$(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext)
-if [ x$(cpp_install_dir) != x ]; then \
rm -f $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
$(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
else true; fi
-if test "$(enable_as_accelerator)" != "yes" ; then \
rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext); \
$(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext); \
if [ x$(cpp_install_dir) != x ]; then \
rm -f $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
$(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
else true; fi; \
fi

# Create the installation directories.
# $(libdir)/gcc/include isn't currently searched by cpp.
Expand Down Expand Up @@ -3277,35 +3292,41 @@ install-common: native lang.install-common installdirs
# otherwise override the specs built into the driver.
rm -f $(DESTDIR)$(libsubdir)/specs
# Install gcov if it was compiled.
-if [ -f gcov$(exeext) ]; \
then \
-if test "$(enable_as_accelerator)" != "yes" ; then \
if [ -f gcov$(exeext) ]; \
then \
rm -f $(DESTDIR)$(bindir)/$(GCOV_INSTALL_NAME)$(exeext); \
$(INSTALL_PROGRAM) gcov$(exeext) $(DESTDIR)$(bindir)/$(GCOV_INSTALL_NAME)$(exeext); \
fi; \
fi
# Install gcov-tool if it was compiled.
-if [ -f gcov-tool$(exeext) ]; \
then \
-if test "$(enable_as_accelerator)" != "yes" ; then \
if [ -f gcov-tool$(exeext) ]; \
then \
rm -f $(DESTDIR)$(bindir)/$(GCOV_TOOL_INSTALL_NAME)$(exeext); \
$(INSTALL_PROGRAM) \
gcov-tool$(exeext) $(DESTDIR)$(bindir)/$(GCOV_TOOL_INSTALL_NAME)$(exeext); \
fi; \
fi

# Install the driver program as $(target_noncanonical)-gcc,
# $(target_noncanonical)-gcc-$(version), and also as gcc if native.
install-driver: installdirs xgcc$(exeext)
-rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
-$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
-if [ "$(GCC_INSTALL_NAME)" != "$(target_noncanonical)-gcc-$(version)" ]; then \
rm -f $(DESTDIR)$(bindir)/$(FULL_DRIVER_NAME); \
( cd $(DESTDIR)$(bindir) && \
$(LN) $(GCC_INSTALL_NAME)$(exeext) $(FULL_DRIVER_NAME) ); \
fi
-if [ ! -f gcc-cross$(exeext) ] \
&& [ "$(GCC_INSTALL_NAME)" != "$(GCC_TARGET_INSTALL_NAME)" ]; then \
rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(exeext); \
( cd $(DESTDIR)$(bindir) && \
$(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-tmp$(exeext) && \
mv -f $(target_noncanonical)-gcc-tmp$(exeext) $(GCC_TARGET_INSTALL_NAME)$(exeext) ); \
-if test "$(enable_as_accelerator)" != "yes" ; then \
if [ "$(GCC_INSTALL_NAME)" != "$(target_noncanonical)-gcc-$(version)" ]; then \
rm -f $(DESTDIR)$(bindir)/$(FULL_DRIVER_NAME); \
( cd $(DESTDIR)$(bindir) && \
$(LN) $(GCC_INSTALL_NAME)$(exeext) $(FULL_DRIVER_NAME) ); \
fi; \
if [ ! -f gcc-cross$(exeext) ] \
&& [ "$(GCC_INSTALL_NAME)" != "$(GCC_TARGET_INSTALL_NAME)" ]; then \
rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(exeext); \
( cd $(DESTDIR)$(bindir) && \
$(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-tmp$(exeext) && \
mv -f $(target_noncanonical)-gcc-tmp$(exeext) $(GCC_TARGET_INSTALL_NAME)$(exeext) ); \
fi; \
fi

# Install the info files.
Expand Down Expand Up @@ -3502,19 +3523,21 @@ install-lto-wrapper: lto-wrapper$(exeext)
$(INSTALL_PROGRAM) lto-wrapper$(exeext) $(DESTDIR)$(libexecsubdir)/lto-wrapper$(exeext)

install-gcc-ar: installdirs gcc-ar$(exeext) gcc-nm$(exeext) gcc-ranlib$(exeext)
for i in gcc-ar gcc-nm gcc-ranlib; do \
install_name=`echo $$i|sed '$(program_transform_name)'` ;\
target_install_name=$(target_noncanonical)-`echo $$i|sed '$(program_transform_name)'` ; \
rm -f $(DESTDIR)$(bindir)/$$install_name$(exeext) ; \
$(INSTALL_PROGRAM) $$i$(exeext) $(DESTDIR)$(bindir)/$$install_name$(exeext) ;\
if test -f gcc-cross$(exeext); then \
:; \
else \
rm -f $(DESTDIR)$(bindir)/$$target_install_name$(exeext); \
( cd $(DESTDIR)$(bindir) && \
$(LN) $$install_name$(exeext) $$target_install_name$(exeext) ) ; \
fi ; \
done
if test "$(enable_as_accelerator)" != "yes" ; then \
for i in gcc-ar gcc-nm gcc-ranlib; do \
install_name=`echo $$i|sed '$(program_transform_name)'` ;\
target_install_name=$(target_noncanonical)-`echo $$i|sed '$(program_transform_name)'` ; \
rm -f $(DESTDIR)$(bindir)/$$install_name$(exeext) ; \
$(INSTALL_PROGRAM) $$i$(exeext) $(DESTDIR)$(bindir)/$$install_name$(exeext) ;\
if test -f gcc-cross$(exeext); then \
:; \
else \
rm -f $(DESTDIR)$(bindir)/$$target_install_name$(exeext); \
( cd $(DESTDIR)$(bindir) && \
$(LN) $$install_name$(exeext) $$target_install_name$(exeext) ) ; \
fi ; \
done; \
fi

# Cancel installation by deleting the installed files.
uninstall: lang.uninstall
Expand Down
18 changes: 18 additions & 0 deletions gcc/config.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
/* config.in. Generated from configure.ac by autoheader. */

/* Define if this compiler should be built as the offload target compiler. */
#ifndef USED_FOR_TARGET
#undef ACCEL_COMPILER
#endif


/* Define if building universal (internal helper macro) */
#ifndef USED_FOR_TARGET
#undef AC_APPLE_UNIVERSAL_BUILD
Expand Down Expand Up @@ -144,6 +150,12 @@
#endif


/* Define this to enable support for offloading. */
#ifndef USED_FOR_TARGET
#undef ENABLE_OFFLOADING
#endif


/* Define to enable plugin support. */
#ifndef USED_FOR_TARGET
#undef ENABLE_PLUGIN
Expand Down Expand Up @@ -1786,6 +1798,12 @@
#endif


/* Define to hold the list of target names suitable for offloading. */
#ifndef USED_FOR_TARGET
#undef OFFLOAD_TARGETS
#endif


/* Define to the address where bug reports for this package should be sent. */
#ifndef USED_FOR_TARGET
#undef PACKAGE_BUGREPORT
Expand Down
Loading

0 comments on commit a3d93be

Please sign in to comment.