diff mbox

[gomp4] Move libgomp plugins into subdirectory

Message ID 20141106153742.5c4c6c09@octopus
State New
Headers show

Commit Message

Julian Brown Nov. 6, 2014, 3:37 p.m. UTC
On Thu, 6 Nov 2014 11:11:42 +0100
Jakub Jelinek <jakub@redhat.com> wrote:

> On Thu, Nov 06, 2014 at 10:06:00AM +0100, Thomas Schwinge wrote:
> > Hi Julian!
> > 
> > On Wed, 5 Nov 2014 17:57:10 +0000, Julian Brown
> > <julian@codesourcery.com> wrote:
> > > This patch moves plugin-nvptx.c and plugin-host.c (from
> > > oacc-host.c) into a new "plugin" subdirectory, as requested by
> > > Jakub, and to match more closely the layout of the Intel MIC
> > > pieces. This also moves the autotools bits to enable the NVPTX
> > > plugin and locate CUDA libraries into the plugin directory's
> > > (new) configury bits.
> > 
> > Hmm.  And then we "cross-include" files in libgomp/ from
> > libgomp/plugin/ as well as the other way round (libgomp/oacc-host.c
> > including libgomp/plugin/plugin-host.c, for example) -- whilst
> > these two "regimes" are configured by two separate Autoconf
> > instances?  Is this really the intended scheme, or should we maybe
> > rather have a top-level libgomp Autoconf/Automake system (as
> > before), which is amended by libgomp/plugin/configfrag.ac and
> > libgomp/plugin/Makefrag.am files that are included from
> > libgomp/configure.ac and libgomp/Makefile.am?

I'll apply the attached fixes for now in case anyone's blocked on the
broken libgomp build, and then...

> I agree a plugin fragment into libgomp/configure.ac and/or
> libgomp/Makefile* is better.

work on refactoring those configury bits (which will revert some of the
attached, including moving libgomp-test-support.exp.in back to its
previous location, but never mind).

Thanks,

Julian

ChangeLog

    * contrib/gcc_update (libgomp/plugin/aclocal.m4)
    (libgomp/plugin/Makefile.in, libgomp/plugin/configure)
    (libgomp/plugin/config.h.in): Add.

    libgomp/
    * oacc-init.c (resolve_device, _acc_init): Fix init_device_func
    hook naming.
    * plugin/plugin-host.c (GOMP_OFFLOAD_openacc_avail): Remove.
    (host_dispatch): Don't set avail_func hook.
    * plugin/configure.ac (libgomp-test-support.exp): Add to
    AC_CONFIG_FILES.
    * plugin/configure: Regenerate.
    * testsuite/libgomp-test-support.exp.in: Move from here...
    * plugin/libgomp-test-support.exp.in: ...to here.
    * plugin/Makefile.in: Regenerate.
    * testsuite/lib/libgomp.exp (libgomp-test-support.exp): Find in
    plugin dir, for now.
    * testsuite/Makefile.in: Regenerate.
    * configure.ac (testsuite/libgomp-test-support.exp): Remove from
    AC_CONFIG_FILES.
    * config.h.in: Regenerate.
    * configure: Regenerate.
diff mbox

Patch

Index: libgomp/oacc-init.c
===================================================================
--- libgomp/oacc-init.c	(revision 217192)
+++ libgomp/oacc-init.c	(working copy)
@@ -97,7 +97,7 @@  resolve_device (acc_device_t d)
 	    while (++d != _ACC_device_hwm)
 	      if (dispatchers[d]
 		  && !strcasecmp (goacc_device_type, dispatchers[d]->name)
-		  && dispatchers[d]->device_init_func () > 0)
+		  && dispatchers[d]->init_device_func () > 0)
 		goto found;
 
 	    gomp_fatal ("device type %s not supported", goacc_device_type);
@@ -112,7 +112,7 @@  resolve_device (acc_device_t d)
     case acc_device_not_host:
       /* Find the first available device after acc_device_not_host.  */
       while (++d != _ACC_device_hwm)
-	if (dispatchers[d] && dispatchers[d]->device_init_func () > 0)
+	if (dispatchers[d] && dispatchers[d]->init_device_func () > 0)
 	  goto found;
       if (d_arg == acc_device_default)
 	{	  
@@ -140,7 +140,7 @@  resolve_device (acc_device_t d)
 }
 
 /* This is called when plugins have been initialized, and serves to call
-   (indirectly) the target's device_init hook.  Calling multiple times without
+   (indirectly) the target's init_device hook.  Calling multiple times without
    an intervening _acc_shutdown call is an error.  */
 
 static struct gomp_device_descr const *
@@ -150,7 +150,7 @@  _acc_init (acc_device_t d)
 
   acc_dev = resolve_device (d);
 
-  if (!acc_dev || acc_dev->device_init_func () <= 0)
+  if (!acc_dev || acc_dev->init_device_func () <= 0)
     gomp_fatal ("device %u not supported", (unsigned)d);
 
   if (acc_dev->is_initialized)
Index: libgomp/plugin/plugin-host.c
===================================================================
--- libgomp/plugin/plugin-host.c	(revision 217192)
+++ libgomp/plugin/plugin-host.c	(working copy)
@@ -153,16 +153,6 @@  GOMP_OFFLOAD_get_table (struct mapping_t
   return 0;
 }
 
-STATIC bool
-GOMP_OFFLOAD_openacc_avail (void)
-{
-#ifdef DEBUG
-  fprintf (stderr, SELF "%s:%s\n", __FILE__, __FUNCTION__);
-#endif
-
-  return 1;
-}
-
 STATIC void *
 GOMP_OFFLOAD_openacc_open_device (int n)
 {
@@ -415,9 +405,6 @@  static struct gomp_device_descr host_dis
       .get_device_num_func = GOMP_OFFLOAD_openacc_get_device_num,
       .set_device_num_func = GOMP_OFFLOAD_openacc_set_device_num,
 
-      /* Device available.  */
-      .avail_func = GOMP_OFFLOAD_openacc_avail,
-
       .exec_func = GOMP_OFFLOAD_openacc_parallel,
 
       .register_async_cleanup_func
Index: libgomp/plugin/configure.ac
===================================================================
--- libgomp/plugin/configure.ac	(revision 217192)
+++ libgomp/plugin/configure.ac	(working copy)
@@ -175,4 +175,5 @@  AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLU
 AC_SUBST(config_path)
 
 AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([libgomp-test-support.exp])
 AC_OUTPUT
Index: libgomp/plugin/libgomp-test-support.exp.in
===================================================================
--- libgomp/plugin/libgomp-test-support.exp.in	(revision 0)
+++ libgomp/plugin/libgomp-test-support.exp.in	(working copy)
@@ -0,0 +1,2 @@ 
+set cuda_driver_include "@CUDA_DRIVER_INCLUDE@"
+set cuda_driver_lib "@CUDA_DRIVER_LIB@"
Index: libgomp/plugin/configure
===================================================================
--- libgomp/plugin/configure	(revision 217192)
+++ libgomp/plugin/configure	(working copy)
@@ -14221,6 +14221,8 @@  _ACEOF
 
 ac_config_files="$ac_config_files Makefile"
 
+ac_config_files="$ac_config_files libgomp-test-support.exp"
+
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -15303,6 +15305,7 @@  do
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
     "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "libgomp-test-support.exp") CONFIG_FILES="$CONFIG_FILES libgomp-test-support.exp" ;;
 
   *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
Index: libgomp/plugin/Makefile.in
===================================================================
--- libgomp/plugin/Makefile.in	(revision 217192)
+++ libgomp/plugin/Makefile.in	(working copy)
@@ -67,7 +67,7 @@  subdir = .
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
 	$(top_srcdir)/configure $(am__configure_deps) \
 	$(srcdir)/config.h.in $(srcdir)/../../mkinstalldirs \
-	$(srcdir)/../../depcomp
+	$(srcdir)/libgomp-test-support.exp.in $(srcdir)/../../depcomp
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
 	$(top_srcdir)/../../config/lead-dot.m4 \
@@ -83,7 +83,7 @@  am__CONFIG_DISTCLEAN_FILES = config.stat
  configure.lineno config.status.lineno
 mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
 CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = libgomp-test-support.exp
 CONFIG_CLEAN_VPATH_FILES =
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
@@ -360,6 +360,8 @@  $(srcdir)/config.h.in: @MAINTAINER_MODE_
 
 distclean-hdr:
 	-rm -f config.h stamp-h1
+libgomp-test-support.exp: $(top_builddir)/config.status $(srcdir)/libgomp-test-support.exp.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
 install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
 	test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)"
Index: libgomp/testsuite/lib/libgomp.exp
===================================================================
--- libgomp/testsuite/lib/libgomp.exp	(revision 217192)
+++ libgomp/testsuite/lib/libgomp.exp	(working copy)
@@ -32,7 +32,7 @@  load_gcc_lib torture-options.exp
 load_gcc_lib fortran-modules.exp
 
 # Try to load a test support file, built during libgomp configuration.
-load_file libgomp-test-support.exp
+load_file ../plugin/libgomp-test-support.exp
 
 set dg-do-what-default run
 
Index: libgomp/testsuite/libgomp-test-support.exp.in
===================================================================
--- libgomp/testsuite/libgomp-test-support.exp.in	(revision 217192)
+++ libgomp/testsuite/libgomp-test-support.exp.in	(working copy)
@@ -1,2 +0,0 @@ 
-set cuda_driver_include "@CUDA_DRIVER_INCLUDE@"
-set cuda_driver_lib "@CUDA_DRIVER_LIB@"
Index: libgomp/testsuite/Makefile.in
===================================================================
--- libgomp/testsuite/Makefile.in	(revision 217192)
+++ libgomp/testsuite/Makefile.in	(working copy)
@@ -35,8 +35,7 @@  build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 subdir = testsuite
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(srcdir)/libgomp-test-support.exp.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/depstand.m4 \
@@ -55,7 +54,7 @@  am__configure_deps = $(am__aclocal_m4_de
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES = libgomp-test-support.exp
+CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 SOURCES =
 DEJATOOL = $(PACKAGE)
@@ -249,8 +248,6 @@  $(top_srcdir)/configure: @MAINTAINER_MOD
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-libgomp-test-support.exp: $(top_builddir)/config.status $(srcdir)/libgomp-test-support.exp.in
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 
 mostlyclean-libtool:
 	-rm -f *.lo
Index: libgomp/config.h.in
===================================================================
--- libgomp/config.h.in	(revision 217192)
+++ libgomp/config.h.in	(working copy)
@@ -110,9 +110,6 @@ 
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
-/* Define to 1 if the NVIDIA plugin is built, 0 if not. */
-#undef PLUGIN_NVPTX
-
 /* Define if all infrastructure, needed for plugins, is supported. */
 #undef PLUGIN_SUPPORT
 
Index: libgomp/configure
===================================================================
--- libgomp/configure	(revision 217192)
+++ libgomp/configure	(working copy)
@@ -16341,8 +16341,6 @@  ac_config_files="$ac_config_files omp.h
 
 ac_config_files="$ac_config_files Makefile testsuite/Makefile"
 
-ac_config_files="$ac_config_files testsuite/libgomp-test-support.exp"
-
 ac_config_files="$ac_config_files libgomp.spec"
 
 cat >confcache <<\_ACEOF
@@ -17484,7 +17482,6 @@  do
     "libgomp_f.h") CONFIG_FILES="$CONFIG_FILES libgomp_f.h" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
-    "testsuite/libgomp-test-support.exp") CONFIG_FILES="$CONFIG_FILES testsuite/libgomp-test-support.exp" ;;
     "libgomp.spec") CONFIG_FILES="$CONFIG_FILES libgomp.spec" ;;
 
   *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
Index: libgomp/configure.ac
===================================================================
--- libgomp/configure.ac	(revision 217192)
+++ libgomp/configure.ac	(working copy)
@@ -361,6 +361,5 @@  CFLAGS="$save_CFLAGS"
 
 AC_CONFIG_FILES(omp.h omp_lib.h omp_lib.f90 libgomp_f.h)
 AC_CONFIG_FILES(Makefile testsuite/Makefile)
-AC_CONFIG_FILES(testsuite/libgomp-test-support.exp)
 AC_CONFIG_FILES(libgomp.spec)
 AC_OUTPUT
Index: contrib/gcc_update
===================================================================
--- contrib/gcc_update	(revision 217192)
+++ contrib/gcc_update	(working copy)
@@ -143,6 +143,10 @@  libgomp/Makefile.in: libgomp/Makefile.am
 libgomp/testsuite/Makefile.in: libgomp/testsuite/Makefile.am libgomp/aclocal.m4
 libgomp/configure: libgomp/configure.ac libgomp/aclocal.m4
 libgomp/config.h.in: libgomp/configure.ac libgomp/aclocal.m4
+libgomp/plugin/aclocal.m4: libgomp/plugin/configure.ac
+libgomp/plugin/Makefile.in: libgomp/plugin/Makefile.am libgomp/plugin/aclocal.m4
+libgomp/plugin/configure: libgomp/plugin/configure.ac libgomp/plugin/aclocal.m4
+libgomp/plugin/config.h.in: libgomp/plugin/configure.ac libgomp/plugin/aclocal.m4
 libitm/aclocal.m4: libitm/configure.ac libitm/acinclude.m4
 libitm/Makefile.in: libitm/Makefile.am libitm/aclocal.m4
 libitm/testsuite/Makefile.in: libitm/testsuite/Makefile.am libitm/aclocal.m4