diff mbox

Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation

Message ID 53CFC3D5.9090504@codesourcery.com
State New
Headers show

Commit Message

Bernd Schmidt July 23, 2014, 2:16 p.m. UTC
On 07/07/2014 04:50 PM, Ilya Verbin wrote:
> On 27 Jun 09:32, Bernd Schmidt wrote:
>> Sorry for the delayed reply, I was travelling. There seem to be some
>> thinkos in the configure script and Makefile; can you try the
>> following (don't forget to regenerate configure)? It seems to work
>> for ptx (with some additional changes to allow ptx builds without
>> --enable-accelerator).
>
> Thank you for you patch.

Here's the latest version, which fixes some more issues and removes 
things that are now unnecessary. Configure scripts and toplevel 
autogenned stuff is left out and must be regenerated.

Are you OK with me installing this on gomp-4_0-branch? If there's any 
other changes related to the build system that you require, could you 
send me a patch on top of this so that we can converge on the final shape?


Bernd

Comments

Ilya Verbin July 23, 2014, 2:37 p.m. UTC | #1
On 23 Jul 16:16, Bernd Schmidt wrote:
> Here's the latest version, which fixes some more issues and removes
> things that are now unnecessary. Configure scripts and toplevel
> autogenned stuff is left out and must be regenerated.
> 
> Are you OK with me installing this on gomp-4_0-branch? If there's
> any other changes related to the build system that you require,
> could you send me a patch on top of this so that we can converge on
> the final shape?

OK.
Looks like we do not need anything more for the build system.

  -- Ilya
Ilya Verbin July 24, 2014, 3:56 p.m. UTC | #2
In gcc/configure.ac:

AC_SUBST(enable_accelerator)
offload_targets=`echo $offload_targets | sed -e 's#,#:#'`
AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",

Looks like, it should be: sed -e 's#,#:#g'

  -- Ilya
diff mbox

Patch

Index: Makefile.def
===================================================================
--- Makefile.def.orig
+++ Makefile.def
@@ -45,9 +45,6 @@  host_modules= { module= flex; no_check_c
 host_modules= { module= gas; bootstrap=true; };
 host_modules= { module= gcc; bootstrap=true; 
 		extra_make_flags="$(EXTRA_GCC_FLAGS)"; };
-host_modules= { module= accel-gcc;
-	        actual_module=gcc;
-		extra_configure_flags='--enable-as-accelerator-for=$(target_alias)'; };
 host_modules= { module= gmp; lib_path=.libs; bootstrap=true;
 		extra_configure_flags='--disable-shared';
 		no_install= true;
Index: configure.ac
===================================================================
--- configure.ac.orig
+++ configure.ac
@@ -141,7 +141,7 @@  host_libs="intl libiberty opcodes bfd re
 # binutils, gas and ld appear in that order because it makes sense to run
 # "make check" in that particular order.
 # If --enable-gold is used, "gold" may replace "ld".
-host_tools="texinfo flex bison binutils gas ld fixincludes accel-gcc gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools"
+host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools"
 
 # libgcj represents the runtime libraries only used by gcj.
 libgcj="target-libffi \
@@ -286,36 +286,16 @@  case ${with_newlib} in
   yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
 esac
 
-# Handle --enable-accelerator.  This is in top-level because both libgomp and
-# GCC proper need this information.
-# --disable-accelerator
-#   Default.  Do not build accelerator pieces, only support host execution.
-# --enable-accelerator=auto-device-triplet
-#   If possible, build accelerator pieces for 'device-triplet'.
-# --enable-accelerator=device-triplet
-#   Build accelerator pieces for 'device-triplet'.
-AC_ARG_ENABLE(accelerator,
-[AS_HELP_STRING([[--enable-accelerator[=ARG]]],
-		[build accelerator @<:@ARG={no,auto-device-triplet,device-triplet}@:>@])],
-ENABLE_ACCELERATOR=$enableval,
-ENABLE_ACCELERATOR=no)
-accel_target_noncanonical=NONE
-case "${ENABLE_ACCELERATOR}" in
-  yes)
-    AC_MSG_ERROR([--enable-accelerators must name accelerator])
-    skipdirs="${skipdirs} accel-gcc"
-    ;;
-  no)
-    skipdirs="${skipdirs} accel-gcc"
-    ;;
-  auto-nvptx*|nvptx*)
-    accel_target_noncanonical=`echo "$ENABLE_ACCELERATOR" | sed -e s/auto-//g`
-    ;;
-  *)
-    AC_MSG_ERROR([unrecognized accelerator])
-    skipdirs="${skipdirs} accel-gcc"
-    ;;
-esac
+offload_targets=
+
+AC_ARG_ENABLE(offload-targets,
+[AS_HELP_STRING([--enable-offload-targets=LIST],
+ [enable offloading to devices from LIST])],
+[
+  if test x$enable_offload_targets = x; then
+    AC_MSG_ERROR([no offload targets specified])
+  fi
+], [enable_offload_targets=])
 
 ACX_CANONICAL_ACCEL_TARGET
 
@@ -2152,15 +2132,7 @@  done
 configdirs_all="$configdirs"
 configdirs=
 for i in ${configdirs_all} ; do
-  case $i in
-    accel-gcc)
-      confsrcdir=gcc
-      ;;
-    *)
-      confsrcdir=$i
-      ;;
-  esac
-  if test -f ${srcdir}/${confsrcdir}/configure ; then
+  if test -f ${srcdir}/$i/configure ; then
     configdirs="${configdirs} $i"
   fi
 done
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in.orig
+++ gcc/Makefile.in
@@ -69,7 +69,6 @@  program_transform_name := @program_trans
 
 # Normally identical to target_noncanonical, except for compilers built
 # as accelerator targets.
-tool_prefix = @tool_prefix@
 accel_dir_suffix = @accel_dir_suffix@
 
 # Directory where sources are, from where we are.
@@ -607,7 +606,11 @@  plugin_includedir = $(plugin_resourcesdi
 # 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:
@@ -777,7 +780,7 @@  BUILD_CPPFLAGS= -I. -I$(@D) -I$(srcdir)
 
 # Actual name to use when installing a native compiler.
 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
-GCC_TARGET_INSTALL_NAME := $(tool_prefix)-$(shell echo gcc|sed '$(program_transform_name)')
+GCC_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcc|sed '$(program_transform_name)')
 CPP_INSTALL_NAME := $(shell echo cpp|sed '$(program_transform_name)')
 GCOV_INSTALL_NAME := $(shell echo gcov|sed '$(program_transform_name)')
 
@@ -2537,23 +2540,6 @@  gengtype-lex.c : gengtype-lex.l
 	}
 
 #
-# If building as accel-gcc, install necessary bits for testing into ../gcc.
-in_gcc_progs1 = $(foreach prog, lto1 mkoffload xgcc, $(gcc_build_dir)/accel/$(target_noncanonical)/$(prog))
-in_gcc_driver = $(gcc_build_dir)/$(real_target_noncanonical)-accel-$(target_noncanonical)-gcc
-all-accel: $(in_gcc_progs1) $(in_gcc_driver)
-
-$(in_gcc_progs1) : $(gcc_build_dir)/accel/$(target_noncanonical)/%: %
-	$(mkinstalldirs) $(gcc_build_dir)/accel/$(target_noncanonical)
-	rm -f $(objdir)/$@
-	$(LN) $* $(objdir)/$@
-
-$(in_gcc_driver) : $(gcc_build_dir)/%: xgcc
-	$(mkinstalldirs) $(gcc_build_dir)
-	printf > $@ \
-	   '#! /bin/sh\nset -e\nd=$$(dirname "$$0")\n"$$d"/accel/$(target_noncanonical)/xgcc -B"$$d"/accel/$(target_noncanonical)/ "$$@"\n'
-	chmod a+x $@
-
-#
 # Remake internationalization support.
 CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
 
@@ -3245,25 +3231,21 @@  install-common: native lang.install-comm
 # Install the driver program as $(target_noncanonical)-gcc,
 # $(target_noncanonical)-gcc-$(version), and also as gcc if native.
 install-driver: installdirs xgcc$(exeext)
-	-install_name=$(GCC_INSTALL_NAME); \
-	if test "@enable_as_accelerator@" = "yes" ; then \
-	  install_name=$(GCC_TARGET_INSTALL_NAME); \
-	fi; \
-	rm -f $(DESTDIR)$(bindir)/$${install_name}$(exeext); \
-	$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$${install_name}$(exeext)
+	-rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
+	-$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
 	-if test "@enable_as_accelerator@" != "yes" ; then \
-	  if [ "$(GCC_INSTALL_NAME)" != "$(tool_prefix)-gcc-$(version)" ]; then \
-	    rm -f $(DESTDIR)$(bindir)/$(tool_prefix)-gcc-$(version)$(exeext); \
-	    ( cd $(DESTDIR)$(bindir) && \
-	      $(LN) $(GCC_INSTALL_NAME)$(exeext) $(tool_prefix)-gcc-$(version)$(exeext) ); \
-	  fi; \
-	  if [ ! -f gcc-cross$(exeext) ] \
-	     && [ "$(GCC_INSTALL_NAME)" != "$(GCC_TARGET_INSTALL_NAME)" ]; then \
-	    rm -f $(DESTDIR)$(bindir)/$(tool_prefix)-gcc-tmp$(exeext); \
-	    ( cd $(DESTDIR)$(bindir) && \
-	      $(LN) $(GCC_INSTALL_NAME)$(exeext) $(tool_prefix)-gcc-tmp$(exeext) && \
-	      mv -f $(tool_prefix)-gcc-tmp$(exeext) $(GCC_TARGET_INSTALL_NAME)$(exeext) ); \
-	  fi; \
+	if [ "$(GCC_INSTALL_NAME)" != "$(target_noncanonical)-gcc-$(version)" ]; then \
+	  rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-$(version)$(exeext); \
+	  ( cd $(DESTDIR)$(bindir) && \
+	    $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-$(version)$(exeext) ); \
+	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.
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac.orig
+++ gcc/configure.ac
@@ -874,18 +874,14 @@  AC_SUBST(enable_accelerator)
 AC_ARG_ENABLE(as-accelerator-for,
 [AS_HELP_STRING([--enable-as-accelerator-for], [build compiler as accelerator target for given host])],
 [
-  if test $enable_accelerator = no; then
-    echo "--enable-as-accelerator-for requires --enable-accelerator"
-    exit 1;
-  fi
   AC_DEFINE(ACCEL_COMPILER, 1,
    [Define if this compiler should be built and used as the target
     device compiler for OpenACC.])
   enable_as_accelerator=yes
-  tool_prefix=${enable_as_accelerator_for}-accel-${enable_accelerator}
+  sedscript="s#${target_noncanonical}#${enable_as_accelerator_for}-accel-${target_noncanonical}#"
+  program_transform_name=`echo $program_transform_name | sed $sedscript`
   accel_dir_suffix=/accel/${target_noncanonical}
   real_target_noncanonical=${enable_as_accelerator_for}
-  ALL_ACCEL=all-accel
 ], [enable_as_accelerator=no])
 AC_SUBST(enable_as_accelerator)