public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFC][gomp4] Offloading patches (2/3): Add tables generation
@ 2013-12-17 11:40 Michael V. Zolotukhin
  2014-01-16 11:37 ` Michael Zolotukhin
                   ` (2 more replies)
  0 siblings, 3 replies; 62+ messages in thread
From: Michael V. Zolotukhin @ 2013-12-17 11:40 UTC (permalink / raw)
  To: Jakub Jelinek, Thomas Schwinge, Bernd Schmidt, Richard Biener,
	Kirill Yukhin, Ilya Verbin, Andrey Turetskiy, Ilya Tocar, gcc

Hi everybody,

Here is a patch 2/3: Add tables generation.

This patch is just a slightly modified patch sent a couple of weeks ago.  When
compiling with '-fopenmp' compiler generates a special symbol, containing
addresses and sizes of globals/omp_fn-functions, and places it into a special
section.  Later, at linking, these sections are merged together and we get a
single table with all addresses/sizes for entire binary.  Also, in this patch we
start to pass '__OPENMP_TARGET__' symbol to GOMP_target calls.

Thanks,
Michael


---
 gcc/omp-low.c |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
 gcc/omp-low.h |    1 +
 gcc/toplev.c  |    3 +
 3 files changed, 115 insertions(+), 8 deletions(-)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index e0f7d1d..f860204 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -58,6 +58,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "optabs.h"
 #include "cfgloop.h"
 #include "target.h"
+#include "common/common-target.h"
 #include "omp-low.h"
 #include "gimple-low.h"
 #include "tree-cfgcleanup.h"
@@ -8371,19 +8372,22 @@ expand_omp_target (struct omp_region *region)
     }
 
   gimple g;
-  /* FIXME: This will be address of
-     extern char __OPENMP_TARGET__[] __attribute__((visibility ("hidden")))
-     symbol, as soon as the linker plugin is able to create it for us.  */
-  tree openmp_target = build_zero_cst (ptr_type_node);
+  tree openmp_target
+    = build_decl (UNKNOWN_LOCATION, VAR_DECL,
+		  get_identifier ("__OPENMP_TARGET__"), ptr_type_node);
+  TREE_PUBLIC (openmp_target) = 1;
+  DECL_EXTERNAL (openmp_target) = 1;
   if (kind == GF_OMP_TARGET_KIND_REGION)
     {
       tree fnaddr = build_fold_addr_expr (child_fn);
-      g = gimple_build_call (builtin_decl_explicit (start_ix), 7,
-			     device, fnaddr, openmp_target, t1, t2, t3, t4);
+      g = gimple_build_call (builtin_decl_explicit (start_ix), 7, device,
+			     fnaddr, build_fold_addr_expr (openmp_target),
+			     t1, t2, t3, t4);
     }
   else
-    g = gimple_build_call (builtin_decl_explicit (start_ix), 6,
-			   device, openmp_target, t1, t2, t3, t4);
+    g = gimple_build_call (builtin_decl_explicit (start_ix), 6, device,
+			   build_fold_addr_expr (openmp_target),
+			   t1, t2, t3, t4);
   gimple_set_location (g, gimple_location (entry_stmt));
   gsi_insert_before (&gsi, g, GSI_SAME_STMT);
   if (kind != GF_OMP_TARGET_KIND_REGION)
@@ -12379,4 +12383,103 @@ make_pass_omp_simd_clone (gcc::context *ctxt)
   return new pass_omp_simd_clone (ctxt);
 }
 
+/* Helper function for omp_finish_file routine.
+   Takes decls from V_DECLS and adds their addresses and sizes to
+   constructor-vector V_CTOR.  It will be later used as DECL_INIT for decl
+   representing a global symbol for OpenMP descriptor.
+   If IS_FUNCTION is true, we use 1 for size.  */
+static void
+add_decls_addresses_to_decl_constructor (vec<tree, va_gc> *v_decls,
+					 vec<constructor_elt, va_gc> *v_ctor,
+					 bool is_function)
+{
+  unsigned int len = 0, i;
+  tree size, it;
+  len = vec_safe_length (v_decls);
+  for (i = 0; i < len; i++)
+    {
+      /* Decls are placed in reversed order in fat-objects, so we need to
+	 revert them back if we compile target.  */
+      if (!flag_openmp_target)
+	it = (*v_decls)[i];
+      else
+	it = (*v_decls)[len - i - 1];
+      size = is_function ? integer_one_node : DECL_SIZE (it);
+      CONSTRUCTOR_APPEND_ELT (v_ctor, NULL_TREE, build_fold_addr_expr (it));
+      CONSTRUCTOR_APPEND_ELT (v_ctor, NULL_TREE,
+			      fold_convert (const_ptr_type_node,
+					    size));
+    }
+}
+
+/* Create new symbol containing (address, size) pairs for omp-marked
+   functions and global variables.  */
+void
+omp_finish_file (void)
+{
+  struct cgraph_node *node;
+  struct varpool_node *vnode;
+  const char *section_name = ".offload_func_table_section";
+  tree new_decl, new_decl_type;
+  vec<constructor_elt, va_gc> *v;
+  vec<tree, va_gc> *v_func, *v_var;
+  tree ctor;
+  int num = 0;
+
+  if (!targetm_common.have_named_sections)
+    return;
+
+  vec_alloc (v_func, 0);
+  vec_alloc (v_var, 0);
+
+  /* Collect all omp-target functions.  */
+  FOR_EACH_DEFINED_FUNCTION (node)
+    {
+      /* TODO: This check could fail on functions, created by omp
+	 parallel/task pragmas.  It's better to name outlined for offloading
+	 functions in some different way and to check here the function name.
+	 It could be something like "*_omp_tgtfn" in contrast with "*_omp_fn"
+	 for functions from omp parallel/task pragmas.  */
+      if (!lookup_attribute ("omp declare target",
+			     DECL_ATTRIBUTES (node->decl))
+	  || !DECL_ARTIFICIAL (node->decl))
+	continue;
+      vec_safe_push (v_func, node->decl);
+      num ++;
+    }
+  /* Collect all omp-target global variables.  */
+  FOR_EACH_DEFINED_VARIABLE (vnode)
+    {
+      if (!lookup_attribute ("omp declare target",
+			     DECL_ATTRIBUTES (vnode->decl))
+	  || TREE_CODE (vnode->decl) != VAR_DECL
+	  || DECL_SIZE (vnode->decl) == 0)
+	continue;
+
+      vec_safe_push (v_var, vnode->decl);
+      num ++;
+    }
+
+  if (num == 0)
+    return;
+
+  vec_alloc (v, num * 2);
+
+  add_decls_addresses_to_decl_constructor (v_func, v, true);
+  add_decls_addresses_to_decl_constructor (v_var, v, false);
+
+  new_decl_type = build_array_type_nelts (pointer_sized_int_node, num * 2);
+  ctor = build_constructor (new_decl_type, v);
+  TREE_CONSTANT (ctor) = 1;
+  TREE_STATIC (ctor) = 1;
+  new_decl = build_decl (UNKNOWN_LOCATION, VAR_DECL,
+			 get_identifier (".omp_table"), new_decl_type);
+  TREE_STATIC (new_decl) = 1;
+  DECL_INITIAL (new_decl) = ctor;
+  DECL_SECTION_NAME (new_decl) = build_string (strlen (section_name),
+					       section_name);
+
+  varpool_assemble_decl (varpool_node_for_decl (new_decl));
+}
+
 #include "gt-omp-low.h"
diff --git a/gcc/omp-low.h b/gcc/omp-low.h
index 6b5a2ff..813189d 100644
--- a/gcc/omp-low.h
+++ b/gcc/omp-low.h
@@ -27,5 +27,6 @@ extern void omp_expand_local (basic_block);
 extern void free_omp_regions (void);
 extern tree omp_reduction_init (tree, tree);
 extern bool make_gimple_omp_edges (basic_block, struct omp_region **);
+extern void omp_finish_file (void);
 
 #endif /* GCC_OMP_LOW_H */
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 5fedcea..af010ff 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -78,6 +78,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "diagnostic-color.h"
 #include "context.h"
 #include "pass_manager.h"
+#include "omp-low.h"
 
 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
 #include "dbxout.h"
@@ -576,6 +577,8 @@ compile_file (void)
       if (flag_sanitize & SANITIZE_THREAD)
 	tsan_finish_file ();
 
+      omp_finish_file ();
+
       output_shared_constant_pool ();
       output_object_blocks ();
       finish_tm_clone_pairs ();
-- 
1.7.1

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [RFC][gomp4] Offloading: Add device initialization and host->target function mapping
@ 2013-12-20 17:18 Ilya Verbin
  2013-12-26 13:37 ` Ilya Verbin
  0 siblings, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2013-12-20 17:18 UTC (permalink / raw)
  To: Jakub Jelinek, Richard Biener, Thomas Schwinge, Bernd Schmidt,
	Kirill Yukhin, Michael V. Zolotukhin, Andrey Turetskiy,
	Ilya Tocar, gcc-patches

Hi Jakub,

Could you please take a look at this patch for libgomp?

It adds new function GOMP_register_lib, that should be called from every
exec/lib with target regions (that was done in patch [1]).  This function
maintains the array of pointers to the target shared library descriptors.

Also this patch adds target device initialization into GOMP_target and
GOMP_target_data.  At first, it calls "device_init" function from the plugin.
This function takes array of target-images as input, and returns the array of
target-side addresses.  Currently, it always uses the first target-image from
the descriptor, this should be generalized later.  Then libgomp reads the tables
from host-side exec/libs.  After that, it inserts host->target address mapping
into the splay tree.

[1] http://gcc.gnu.org/ml/gcc-patches/2013-12/msg01486.html

Thanks,
    -- Ilya

---
 libgomp/libgomp.map |    1 +
 libgomp/target.c    |  154 ++++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 146 insertions(+), 9 deletions(-)

diff --git a/libgomp/libgomp.map b/libgomp/libgomp.map
index 2b64d05..792047f 100644
--- a/libgomp/libgomp.map
+++ b/libgomp/libgomp.map
@@ -208,6 +208,7 @@ GOMP_3.0 {
 
 GOMP_4.0 {
   global:
+	GOMP_register_lib;
 	GOMP_barrier_cancel;
 	GOMP_cancel;
 	GOMP_cancellation_point;
diff --git a/libgomp/target.c b/libgomp/target.c
index d84a1fa..a37819a 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -84,6 +84,19 @@ struct splay_tree_key_s {
   bool copy_from;
 };
 
+enum library_descr {
+  DESCR_TABLE_START,
+  DESCR_TABLE_END,
+  DESCR_IMAGE_START,
+  DESCR_IMAGE_END
+};
+
+/* Array of pointers to target shared library descriptors.  */
+static void **libraries;
+
+/* Total number of target shared libraries.  */
+static int num_libraries;
+
 /* Array of descriptors of all available devices.  */
 static struct gomp_device_descr *devices;
 
@@ -117,11 +130,16 @@ struct gomp_device_descr
      TARGET construct.  */
   int id;
 
+  /* Set to true when device is initialized.  */
+  bool is_initialized;
+
   /* Plugin file handler.  */
   void *plugin_handle;
 
   /* Function handlers.  */
-  bool (*device_available_func) (void);
+  bool (*device_available_func) (int);
+  void (*device_init_func) (void **, int *, int, void ***, int *);
+  void (*device_run_func) (void *, uintptr_t);
 
   /* Splay tree containing information about mapped memory regions.  */
   struct splay_tree_s dev_splay_tree;
@@ -466,6 +484,89 @@ gomp_update (struct gomp_device_descr *devicep, size_t mapnum,
   gomp_mutex_unlock (&devicep->dev_env_lock);
 }
 
+void
+GOMP_register_lib (const void *openmp_target)
+{
+  libraries = realloc (libraries, (num_libraries + 1) * sizeof (void *));
+
+  if (libraries == NULL)
+    return;
+
+  libraries[num_libraries] = (void *) openmp_target;
+
+  num_libraries++;
+}
+
+static void
+gomp_init_device (struct gomp_device_descr *devicep)
+{
+  void **target_images = malloc (num_libraries * sizeof (void *));
+  int *target_img_sizes = malloc (num_libraries * sizeof (int));
+  if (target_images == NULL || target_img_sizes == NULL)
+    gomp_fatal ("Can not allocate memory");
+
+  /* Collect target images from the library descriptors and calculate the total
+     size of host address table.  */
+  int i, host_table_size = 0;
+  for (i = 0; i < num_libraries; i++)
+    {
+      void **lib = libraries[i];
+      void **host_table_start = lib[DESCR_TABLE_START];
+      void **host_table_end = lib[DESCR_TABLE_END];
+      /* FIXME: Select the proper target image.  */
+      target_images[i] = lib[DESCR_IMAGE_START];
+      target_img_sizes[i] = lib[DESCR_IMAGE_END] - lib[DESCR_IMAGE_START];
+      host_table_size += host_table_end - host_table_start;
+    }
+
+  /* Initialize the target device and receive the address table from target.  */
+  void **target_table = NULL;
+  int target_table_size = 0;
+  devicep->device_init_func (target_images, target_img_sizes, num_libraries,
+			     &target_table, &target_table_size);
+  free (target_images);
+  free (target_img_sizes);
+
+  if (host_table_size != target_table_size)
+    gomp_fatal ("Can't map target objects");
+
+  /* Initialize the mapping data structure.  */
+  void **target_entry = target_table;
+  for (i = 0; i < num_libraries; i++)
+    {
+      void **lib = libraries[i];
+      void **host_table_start = lib[DESCR_TABLE_START];
+      void **host_table_end = lib[DESCR_TABLE_END];
+      void **host_entry;
+      for (host_entry = host_table_start; host_entry < host_table_end;
+	   host_entry += 2, target_entry += 2)
+	{
+	  struct target_mem_desc *tgt = gomp_malloc (sizeof (*tgt));
+	  tgt->refcount = 1;
+	  tgt->array = gomp_malloc (sizeof (*tgt->array));
+	  tgt->tgt_start = (uintptr_t) *target_entry;
+	  tgt->tgt_end = tgt->tgt_start + (uint64_t) *(target_entry+1);
+	  tgt->to_free = NULL;
+	  tgt->list_count = 0;
+	  tgt->device_descr = devicep;
+	  splay_tree_node node = tgt->array;
+	  splay_tree_key k = &node->key;
+	  k->host_start = (uintptr_t) *host_entry;
+	  k->host_end = k->host_start + (uint64_t) *(host_entry+1);
+	  k->tgt = tgt;
+	  node->left = NULL;
+	  node->right = NULL;
+	  splay_tree_insert (&devicep->dev_splay_tree, node);
+	}
+    }
+
+  free (libraries);
+  num_libraries = 0;
+  free (target_table);
+  target_table_size = 0;
+  devicep->is_initialized = true;
+}
+
 /* Called when encountering a target directive.  If DEVICE
    is -1, it means use device-var ICV.  If it is -2 (or any other value
    larger than last available hw device, use host fallback.
@@ -482,7 +583,8 @@ GOMP_target (int device, void (*fn) (void *), const void *openmp_target,
 	     unsigned char *kinds)
 {
   struct gomp_device_descr *devicep = resolve_device (device);
-  if (devicep == NULL)
+  if (openmp_target == NULL || devicep == NULL
+      || !devicep->device_available_func (devicep->id))
     {
       /* Host fallback.  */
       struct gomp_thread old_thr, *thr = gomp_thread ();
@@ -499,7 +601,18 @@ GOMP_target (int device, void (*fn) (void *), const void *openmp_target,
       return;
     }
 
-  struct target_mem_desc *tgt
+  if (!devicep->is_initialized)
+    gomp_init_device (devicep);
+
+  splay_tree_node node = gomp_malloc (sizeof (*node));
+  splay_tree_key k = &node->key;
+  k->host_start = (uintptr_t) fn;
+  k->host_end = k->host_start + 1;
+  splay_tree_key tgt_fn = splay_tree_lookup (&devicep->dev_splay_tree, k);
+  if (tgt_fn == NULL)
+    gomp_fatal ("Target function wasn't mapped");
+
+  struct target_mem_desc *tgt_vars
     = gomp_map_vars (devicep, mapnum, hostaddrs, sizes, kinds, true);
   struct gomp_thread old_thr, *thr = gomp_thread ();
   old_thr = *thr;
@@ -509,10 +622,11 @@ GOMP_target (int device, void (*fn) (void *), const void *openmp_target,
       thr->place = old_thr.place;
       thr->ts.place_partition_len = gomp_places_list_len;
     }
-  fn ((void *) tgt->tgt_start);
+  devicep->device_run_func ((void *) tgt_fn->tgt->tgt_start,
+			    tgt_vars->tgt_start);
   gomp_free_thread (thr);
   *thr = old_thr;
-  gomp_unmap_vars (tgt);
+  gomp_unmap_vars (tgt_vars);
 }
 
 void
@@ -520,7 +634,8 @@ GOMP_target_data (int device, const void *openmp_target, size_t mapnum,
 		  void **hostaddrs, size_t *sizes, unsigned char *kinds)
 {
   struct gomp_device_descr *devicep = resolve_device (device);
-  if (devicep == NULL)
+  if (openmp_target == NULL || devicep == NULL
+      || !devicep->device_available_func (devicep->id))
     {
       /* Host fallback.  */
       struct gomp_task_icv *icv = gomp_icv (false);
@@ -538,6 +653,9 @@ GOMP_target_data (int device, const void *openmp_target, size_t mapnum,
       return;
     }
 
+  if (!devicep->is_initialized)
+    gomp_init_device (devicep);
+
   struct target_mem_desc *tgt
     = gomp_map_vars (devicep, mapnum, hostaddrs, sizes, kinds, false);
   struct gomp_task_icv *icv = gomp_icv (true);
@@ -562,9 +680,13 @@ GOMP_target_update (int device, const void *openmp_target, size_t mapnum,
 		    void **hostaddrs, size_t *sizes, unsigned char *kinds)
 {
   struct gomp_device_descr *devicep = resolve_device (device);
-  if (devicep == NULL)
+  if (openmp_target == NULL || devicep == NULL
+      || !devicep->device_available_func (devicep->id))
     return;
 
+  if (!devicep->is_initialized)
+    gomp_fatal ("Target device wasn't initialized");
+
   gomp_update (devicep, mapnum, hostaddrs, sizes, kinds);
 }
 
@@ -619,8 +741,7 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device,
   dlerror ();
 
   /* Check if all required functions are available in the plugin and store
-     their handlers.
-     TODO: check for other routines as well.  */
+     their handlers.  */
   device->device_available_func = dlsym (device->plugin_handle,
 					 "device_available");
   if (dlerror () != NULL)
@@ -629,6 +750,20 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device,
       return false;
     }
 
+  device->device_init_func = dlsym (device->plugin_handle, "device_init");
+  if (dlerror () != NULL)
+    {
+      dlclose (device->plugin_handle);
+      return false;
+    }
+
+  device->device_run_func = dlsym (device->plugin_handle, "device_run");
+  if (dlerror () != NULL)
+    {
+      dlclose (device->plugin_handle);
+      return false;
+    }
+
   return true;
 }
 
@@ -680,6 +815,7 @@ gomp_find_available_plugins (void)
 
       devices[num_devices] = current_device;
       devices[num_devices].id = num_devices + 1;
+      devices[num_devices].is_initialized = false;
       devices[num_devices].dev_splay_tree.root = NULL;
       gomp_mutex_init (&devices[num_devices].dev_env_lock);
       num_devices++;
-- 
1.7.1

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: [RFC][gomp4] Offloading: Add device initialization and host->target function mapping
  2013-12-20 17:18 [RFC][gomp4] Offloading: Add device initialization and host->target function mapping Ilya Verbin
@ 2013-12-26 13:37 ` Ilya Verbin
  2014-01-15 15:09   ` Ilya Verbin
  0 siblings, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2013-12-26 13:37 UTC (permalink / raw)
  To: Jakub Jelinek, Richard Biener, Thomas Schwinge, Bernd Schmidt,
	Kirill Yukhin, Michael V. Zolotukhin, Andrey Turetskiy,
	Ilya Tocar, gcc-patches

Ping.
(Patch is slightly updated)

On 20 Dec 21:18, Ilya Verbin wrote:
> Hi Jakub,
> 
> Could you please take a look at this patch for libgomp?
> 
> It adds new function GOMP_register_lib, that should be called from every
> exec/lib with target regions (that was done in patch [1]).  This function
> maintains the array of pointers to the target shared library descriptors.
> 
> Also this patch adds target device initialization into GOMP_target and
> GOMP_target_data.  At first, it calls "device_init" function from the plugin.
> This function takes array of target-images as input, and returns the array of
> target-side addresses.  Currently, it always uses the first target-image from
> the descriptor, this should be generalized later.  Then libgomp reads the tables
> from host-side exec/libs.  After that, it inserts host->target address mapping
> into the splay tree.
> 
> [1] http://gcc.gnu.org/ml/gcc-patches/2013-12/msg01486.html
> 
> Thanks,
>     -- Ilya

    -- Ilya

---
 libgomp/libgomp.map |    1 +
 libgomp/target.c    |  154 ++++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 146 insertions(+), 9 deletions(-)

diff --git a/libgomp/libgomp.map b/libgomp/libgomp.map
index 2b64d05..792047f 100644
--- a/libgomp/libgomp.map
+++ b/libgomp/libgomp.map
@@ -208,6 +208,7 @@ GOMP_3.0 {
 
 GOMP_4.0 {
   global:
+	GOMP_register_lib;
 	GOMP_barrier_cancel;
 	GOMP_cancel;
 	GOMP_cancellation_point;
diff --git a/libgomp/target.c b/libgomp/target.c
index d84a1fa..7677c28 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -84,6 +84,19 @@ struct splay_tree_key_s {
   bool copy_from;
 };
 
+enum library_descr {
+  DESCR_TABLE_START,
+  DESCR_TABLE_END,
+  DESCR_IMAGE_START,
+  DESCR_IMAGE_END
+};
+
+/* Array of pointers to target shared library descriptors.  */
+static void **libraries;
+
+/* Total number of target shared libraries.  */
+static int num_libraries;
+
 /* Array of descriptors of all available devices.  */
 static struct gomp_device_descr *devices;
 
@@ -117,11 +130,16 @@ struct gomp_device_descr
      TARGET construct.  */
   int id;
 
+  /* Set to true when device is initialized.  */
+  bool is_initialized;
+
   /* Plugin file handler.  */
   void *plugin_handle;
 
   /* Function handlers.  */
-  bool (*device_available_func) (void);
+  bool (*device_available_func) (int);
+  void (*device_init_func) (void **, int *, int, void ***, int *);
+  void (*device_run_func) (void *, uintptr_t);
 
   /* Splay tree containing information about mapped memory regions.  */
   struct splay_tree_s dev_splay_tree;
@@ -466,6 +484,89 @@ gomp_update (struct gomp_device_descr *devicep, size_t mapnum,
   gomp_mutex_unlock (&devicep->dev_env_lock);
 }
 
+void
+GOMP_register_lib (const void *openmp_target)
+{
+  libraries = realloc (libraries, (num_libraries + 1) * sizeof (void *));
+
+  if (libraries == NULL)
+    return;
+
+  libraries[num_libraries] = (void *) openmp_target;
+
+  num_libraries++;
+}
+
+static void
+gomp_init_device (struct gomp_device_descr *devicep)
+{
+  void **target_images = malloc (num_libraries * sizeof (void *));
+  int *target_img_sizes = malloc (num_libraries * sizeof (int));
+  if (target_images == NULL || target_img_sizes == NULL)
+    gomp_fatal ("Can not allocate memory");
+
+  /* Collect target images from the library descriptors and calculate the total
+     size of host address table.  */
+  int i, host_table_size = 0;
+  for (i = 0; i < num_libraries; i++)
+    {
+      void **lib = libraries[i];
+      void **host_table_start = lib[DESCR_TABLE_START];
+      void **host_table_end = lib[DESCR_TABLE_END];
+      /* FIXME: Select the proper target image.  */
+      target_images[i] = lib[DESCR_IMAGE_START];
+      target_img_sizes[i] = lib[DESCR_IMAGE_END] - lib[DESCR_IMAGE_START];
+      host_table_size += host_table_end - host_table_start;
+    }
+
+  /* Initialize the target device and receive the address table from target.  */
+  void **target_table = NULL;
+  int target_table_size = 0;
+  devicep->device_init_func (target_images, target_img_sizes, num_libraries,
+			     &target_table, &target_table_size);
+  free (target_images);
+  free (target_img_sizes);
+
+  if (host_table_size != target_table_size)
+    gomp_fatal ("Can't map target objects");
+
+  /* Initialize the mapping data structure.  */
+  void **target_entry = target_table;
+  for (i = 0; i < num_libraries; i++)
+    {
+      void **lib = libraries[i];
+      void **host_table_start = lib[DESCR_TABLE_START];
+      void **host_table_end = lib[DESCR_TABLE_END];
+      void **host_entry;
+      for (host_entry = host_table_start; host_entry < host_table_end;
+	   host_entry += 2, target_entry += 2)
+	{
+	  struct target_mem_desc *tgt = gomp_malloc (sizeof (*tgt));
+	  tgt->refcount = 1;
+	  tgt->array = gomp_malloc (sizeof (*tgt->array));
+	  tgt->tgt_start = (uintptr_t) *target_entry;
+	  tgt->tgt_end = tgt->tgt_start + *((uint64_t *) target_entry + 1);
+	  tgt->to_free = NULL;
+	  tgt->list_count = 0;
+	  tgt->device_descr = devicep;
+	  splay_tree_node node = tgt->array;
+	  splay_tree_key k = &node->key;
+	  k->host_start = (uintptr_t) *host_entry;
+	  k->host_end = k->host_start + *((uint64_t *) host_entry + 1);
+	  k->tgt = tgt;
+	  node->left = NULL;
+	  node->right = NULL;
+	  splay_tree_insert (&devicep->dev_splay_tree, node);
+	}
+    }
+
+  free (libraries);
+  num_libraries = 0;
+  free (target_table);
+  target_table_size = 0;
+  devicep->is_initialized = true;
+}
+
 /* Called when encountering a target directive.  If DEVICE
    is -1, it means use device-var ICV.  If it is -2 (or any other value
    larger than last available hw device, use host fallback.
@@ -482,7 +583,8 @@ GOMP_target (int device, void (*fn) (void *), const void *openmp_target,
 	     unsigned char *kinds)
 {
   struct gomp_device_descr *devicep = resolve_device (device);
-  if (devicep == NULL)
+  if (openmp_target == NULL || devicep == NULL
+      || !devicep->device_available_func (devicep->id))
     {
       /* Host fallback.  */
       struct gomp_thread old_thr, *thr = gomp_thread ();
@@ -499,7 +601,18 @@ GOMP_target (int device, void (*fn) (void *), const void *openmp_target,
       return;
     }
 
-  struct target_mem_desc *tgt
+  if (!devicep->is_initialized)
+    gomp_init_device (devicep);
+
+  splay_tree_node node = gomp_malloc (sizeof (*node));
+  splay_tree_key k = &node->key;
+  k->host_start = (uintptr_t) fn;
+  k->host_end = k->host_start + 1;
+  splay_tree_key tgt_fn = splay_tree_lookup (&devicep->dev_splay_tree, k);
+  if (tgt_fn == NULL)
+    gomp_fatal ("Target function wasn't mapped");
+
+  struct target_mem_desc *tgt_vars
     = gomp_map_vars (devicep, mapnum, hostaddrs, sizes, kinds, true);
   struct gomp_thread old_thr, *thr = gomp_thread ();
   old_thr = *thr;
@@ -509,10 +622,11 @@ GOMP_target (int device, void (*fn) (void *), const void *openmp_target,
       thr->place = old_thr.place;
       thr->ts.place_partition_len = gomp_places_list_len;
     }
-  fn ((void *) tgt->tgt_start);
+  devicep->device_run_func ((void *) tgt_fn->tgt->tgt_start,
+			    tgt_vars->tgt_start);
   gomp_free_thread (thr);
   *thr = old_thr;
-  gomp_unmap_vars (tgt);
+  gomp_unmap_vars (tgt_vars);
 }
 
 void
@@ -520,7 +634,8 @@ GOMP_target_data (int device, const void *openmp_target, size_t mapnum,
 		  void **hostaddrs, size_t *sizes, unsigned char *kinds)
 {
   struct gomp_device_descr *devicep = resolve_device (device);
-  if (devicep == NULL)
+  if (openmp_target == NULL || devicep == NULL
+      || !devicep->device_available_func (devicep->id))
     {
       /* Host fallback.  */
       struct gomp_task_icv *icv = gomp_icv (false);
@@ -538,6 +653,9 @@ GOMP_target_data (int device, const void *openmp_target, size_t mapnum,
       return;
     }
 
+  if (!devicep->is_initialized)
+    gomp_init_device (devicep);
+
   struct target_mem_desc *tgt
     = gomp_map_vars (devicep, mapnum, hostaddrs, sizes, kinds, false);
   struct gomp_task_icv *icv = gomp_icv (true);
@@ -562,9 +680,13 @@ GOMP_target_update (int device, const void *openmp_target, size_t mapnum,
 		    void **hostaddrs, size_t *sizes, unsigned char *kinds)
 {
   struct gomp_device_descr *devicep = resolve_device (device);
-  if (devicep == NULL)
+  if (openmp_target == NULL || devicep == NULL
+      || !devicep->device_available_func (devicep->id))
     return;
 
+  if (!devicep->is_initialized)
+    gomp_fatal ("Target device wasn't initialized");
+
   gomp_update (devicep, mapnum, hostaddrs, sizes, kinds);
 }
 
@@ -619,8 +741,7 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device,
   dlerror ();
 
   /* Check if all required functions are available in the plugin and store
-     their handlers.
-     TODO: check for other routines as well.  */
+     their handlers.  */
   device->device_available_func = dlsym (device->plugin_handle,
 					 "device_available");
   if (dlerror () != NULL)
@@ -629,6 +750,20 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device,
       return false;
     }
 
+  device->device_init_func = dlsym (device->plugin_handle, "device_init");
+  if (dlerror () != NULL)
+    {
+      dlclose (device->plugin_handle);
+      return false;
+    }
+
+  device->device_run_func = dlsym (device->plugin_handle, "device_run");
+  if (dlerror () != NULL)
+    {
+      dlclose (device->plugin_handle);
+      return false;
+    }
+
   return true;
 }
 
@@ -680,6 +815,7 @@ gomp_find_available_plugins (void)
 
       devices[num_devices] = current_device;
       devices[num_devices].id = num_devices + 1;
+      devices[num_devices].is_initialized = false;
       devices[num_devices].dev_splay_tree.root = NULL;
       gomp_mutex_init (&devices[num_devices].dev_env_lock);
       num_devices++;
-- 
1.7.1

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: [RFC][gomp4] Offloading: Add device initialization and host->target function mapping
  2013-12-26 13:37 ` Ilya Verbin
@ 2014-01-15 15:09   ` Ilya Verbin
  2014-03-12 18:21     ` Ilya Verbin
  0 siblings, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-01-15 15:09 UTC (permalink / raw)
  To: Jakub Jelinek, Richard Biener, Thomas Schwinge, Bernd Schmidt,
	Kirill Yukhin, Michael V. Zolotukhin, Andrey Turetskiy,
	Ilya Tocar, gcc-patches

Ping.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2013-12-17 11:40 Michael V. Zolotukhin
@ 2014-01-16 11:37 ` Michael Zolotukhin
  2014-01-28 11:20 ` Bernd Schmidt
  2014-05-08  9:44 ` [gomp4] Mark __OPENMP_TARGET__ as addressable (was: Offloading patches (2/3): Add tables generation) Thomas Schwinge
  2 siblings, 0 replies; 62+ messages in thread
From: Michael Zolotukhin @ 2014-01-16 11:37 UTC (permalink / raw)
  To: Jakub Jelinek, Thomas Schwinge, Bernd Schmidt, Richard Biener,
	Kirill Yukhin, Ilya Verbin, Andrey Turetskiy, Ilya Tocar, gcc

Ping.

On 17 December 2013 15:39, Michael V. Zolotukhin
<michael.v.zolotukhin@gmail.com> wrote:
> Hi everybody,
>
> Here is a patch 2/3: Add tables generation.
>
> This patch is just a slightly modified patch sent a couple of weeks ago.  When
> compiling with '-fopenmp' compiler generates a special symbol, containing
> addresses and sizes of globals/omp_fn-functions, and places it into a special
> section.  Later, at linking, these sections are merged together and we get a
> single table with all addresses/sizes for entire binary.  Also, in this patch we
> start to pass '__OPENMP_TARGET__' symbol to GOMP_target calls.
>
> Thanks,
> Michael
>
>
> ---
>  gcc/omp-low.c |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
>  gcc/omp-low.h |    1 +
>  gcc/toplev.c  |    3 +
>  3 files changed, 115 insertions(+), 8 deletions(-)
>
> diff --git a/gcc/omp-low.c b/gcc/omp-low.c
> index e0f7d1d..f860204 100644
> --- a/gcc/omp-low.c
> +++ b/gcc/omp-low.c
> @@ -58,6 +58,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "optabs.h"
>  #include "cfgloop.h"
>  #include "target.h"
> +#include "common/common-target.h"
>  #include "omp-low.h"
>  #include "gimple-low.h"
>  #include "tree-cfgcleanup.h"
> @@ -8371,19 +8372,22 @@ expand_omp_target (struct omp_region *region)
>      }
>
>    gimple g;
> -  /* FIXME: This will be address of
> -     extern char __OPENMP_TARGET__[] __attribute__((visibility ("hidden")))
> -     symbol, as soon as the linker plugin is able to create it for us.  */
> -  tree openmp_target = build_zero_cst (ptr_type_node);
> +  tree openmp_target
> +    = build_decl (UNKNOWN_LOCATION, VAR_DECL,
> +                 get_identifier ("__OPENMP_TARGET__"), ptr_type_node);
> +  TREE_PUBLIC (openmp_target) = 1;
> +  DECL_EXTERNAL (openmp_target) = 1;
>    if (kind == GF_OMP_TARGET_KIND_REGION)
>      {
>        tree fnaddr = build_fold_addr_expr (child_fn);
> -      g = gimple_build_call (builtin_decl_explicit (start_ix), 7,
> -                            device, fnaddr, openmp_target, t1, t2, t3, t4);
> +      g = gimple_build_call (builtin_decl_explicit (start_ix), 7, device,
> +                            fnaddr, build_fold_addr_expr (openmp_target),
> +                            t1, t2, t3, t4);
>      }
>    else
> -    g = gimple_build_call (builtin_decl_explicit (start_ix), 6,
> -                          device, openmp_target, t1, t2, t3, t4);
> +    g = gimple_build_call (builtin_decl_explicit (start_ix), 6, device,
> +                          build_fold_addr_expr (openmp_target),
> +                          t1, t2, t3, t4);
>    gimple_set_location (g, gimple_location (entry_stmt));
>    gsi_insert_before (&gsi, g, GSI_SAME_STMT);
>    if (kind != GF_OMP_TARGET_KIND_REGION)
> @@ -12379,4 +12383,103 @@ make_pass_omp_simd_clone (gcc::context *ctxt)
>    return new pass_omp_simd_clone (ctxt);
>  }
>
> +/* Helper function for omp_finish_file routine.
> +   Takes decls from V_DECLS and adds their addresses and sizes to
> +   constructor-vector V_CTOR.  It will be later used as DECL_INIT for decl
> +   representing a global symbol for OpenMP descriptor.
> +   If IS_FUNCTION is true, we use 1 for size.  */
> +static void
> +add_decls_addresses_to_decl_constructor (vec<tree, va_gc> *v_decls,
> +                                        vec<constructor_elt, va_gc> *v_ctor,
> +                                        bool is_function)
> +{
> +  unsigned int len = 0, i;
> +  tree size, it;
> +  len = vec_safe_length (v_decls);
> +  for (i = 0; i < len; i++)
> +    {
> +      /* Decls are placed in reversed order in fat-objects, so we need to
> +        revert them back if we compile target.  */
> +      if (!flag_openmp_target)
> +       it = (*v_decls)[i];
> +      else
> +       it = (*v_decls)[len - i - 1];
> +      size = is_function ? integer_one_node : DECL_SIZE (it);
> +      CONSTRUCTOR_APPEND_ELT (v_ctor, NULL_TREE, build_fold_addr_expr (it));
> +      CONSTRUCTOR_APPEND_ELT (v_ctor, NULL_TREE,
> +                             fold_convert (const_ptr_type_node,
> +                                           size));
> +    }
> +}
> +
> +/* Create new symbol containing (address, size) pairs for omp-marked
> +   functions and global variables.  */
> +void
> +omp_finish_file (void)
> +{
> +  struct cgraph_node *node;
> +  struct varpool_node *vnode;
> +  const char *section_name = ".offload_func_table_section";
> +  tree new_decl, new_decl_type;
> +  vec<constructor_elt, va_gc> *v;
> +  vec<tree, va_gc> *v_func, *v_var;
> +  tree ctor;
> +  int num = 0;
> +
> +  if (!targetm_common.have_named_sections)
> +    return;
> +
> +  vec_alloc (v_func, 0);
> +  vec_alloc (v_var, 0);
> +
> +  /* Collect all omp-target functions.  */
> +  FOR_EACH_DEFINED_FUNCTION (node)
> +    {
> +      /* TODO: This check could fail on functions, created by omp
> +        parallel/task pragmas.  It's better to name outlined for offloading
> +        functions in some different way and to check here the function name.
> +        It could be something like "*_omp_tgtfn" in contrast with "*_omp_fn"
> +        for functions from omp parallel/task pragmas.  */
> +      if (!lookup_attribute ("omp declare target",
> +                            DECL_ATTRIBUTES (node->decl))
> +         || !DECL_ARTIFICIAL (node->decl))
> +       continue;
> +      vec_safe_push (v_func, node->decl);
> +      num ++;
> +    }
> +  /* Collect all omp-target global variables.  */
> +  FOR_EACH_DEFINED_VARIABLE (vnode)
> +    {
> +      if (!lookup_attribute ("omp declare target",
> +                            DECL_ATTRIBUTES (vnode->decl))
> +         || TREE_CODE (vnode->decl) != VAR_DECL
> +         || DECL_SIZE (vnode->decl) == 0)
> +       continue;
> +
> +      vec_safe_push (v_var, vnode->decl);
> +      num ++;
> +    }
> +
> +  if (num == 0)
> +    return;
> +
> +  vec_alloc (v, num * 2);
> +
> +  add_decls_addresses_to_decl_constructor (v_func, v, true);
> +  add_decls_addresses_to_decl_constructor (v_var, v, false);
> +
> +  new_decl_type = build_array_type_nelts (pointer_sized_int_node, num * 2);
> +  ctor = build_constructor (new_decl_type, v);
> +  TREE_CONSTANT (ctor) = 1;
> +  TREE_STATIC (ctor) = 1;
> +  new_decl = build_decl (UNKNOWN_LOCATION, VAR_DECL,
> +                        get_identifier (".omp_table"), new_decl_type);
> +  TREE_STATIC (new_decl) = 1;
> +  DECL_INITIAL (new_decl) = ctor;
> +  DECL_SECTION_NAME (new_decl) = build_string (strlen (section_name),
> +                                              section_name);
> +
> +  varpool_assemble_decl (varpool_node_for_decl (new_decl));
> +}
> +
>  #include "gt-omp-low.h"
> diff --git a/gcc/omp-low.h b/gcc/omp-low.h
> index 6b5a2ff..813189d 100644
> --- a/gcc/omp-low.h
> +++ b/gcc/omp-low.h
> @@ -27,5 +27,6 @@ extern void omp_expand_local (basic_block);
>  extern void free_omp_regions (void);
>  extern tree omp_reduction_init (tree, tree);
>  extern bool make_gimple_omp_edges (basic_block, struct omp_region **);
> +extern void omp_finish_file (void);
>
>  #endif /* GCC_OMP_LOW_H */
> diff --git a/gcc/toplev.c b/gcc/toplev.c
> index 5fedcea..af010ff 100644
> --- a/gcc/toplev.c
> +++ b/gcc/toplev.c
> @@ -78,6 +78,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "diagnostic-color.h"
>  #include "context.h"
>  #include "pass_manager.h"
> +#include "omp-low.h"
>
>  #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
>  #include "dbxout.h"
> @@ -576,6 +577,8 @@ compile_file (void)
>        if (flag_sanitize & SANITIZE_THREAD)
>         tsan_finish_file ();
>
> +      omp_finish_file ();
> +
>        output_shared_constant_pool ();
>        output_object_blocks ();
>        finish_tm_clone_pairs ();
> --
> 1.7.1
>

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2013-12-17 11:40 Michael V. Zolotukhin
  2014-01-16 11:37 ` Michael Zolotukhin
@ 2014-01-28 11:20 ` Bernd Schmidt
       [not found]   ` <CADG=Z0GQ8ORLe1XRUU7VMYeLhwuWisMyCcGLQj-nY_bhkbD_1Q@mail.gmail.com>
  2014-05-08  9:44 ` [gomp4] Mark __OPENMP_TARGET__ as addressable (was: Offloading patches (2/3): Add tables generation) Thomas Schwinge
  2 siblings, 1 reply; 62+ messages in thread
From: Bernd Schmidt @ 2014-01-28 11:20 UTC (permalink / raw)
  To: Michael V. Zolotukhin, Jakub Jelinek, Thomas Schwinge,
	Richard Biener, Kirill Yukhin, Ilya Verbin, Andrey Turetskiy,
	Ilya Tocar, gcc

On 12/17/2013 12:39 PM, Michael V. Zolotukhin wrote:
> Here is a patch 2/3: Add tables generation.
>
> This patch is just a slightly modified patch sent a couple of weeks ago.  When
> compiling with '-fopenmp' compiler generates a special symbol, containing
> addresses and sizes of globals/omp_fn-functions, and places it into a special
> section.  Later, at linking, these sections are merged together and we get a
> single table with all addresses/sizes for entire binary.  Also, in this patch we
> start to pass '__OPENMP_TARGET__' symbol to GOMP_target calls.

I also have a question about the code in this patch. I can see how the 
table is constructed - what's not clear to me is how it is going to be 
used? How do you map from a function or variable you want to look up to 
an index in this table?


Bernd

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
       [not found]   ` <CADG=Z0GQ8ORLe1XRUU7VMYeLhwuWisMyCcGLQj-nY_bhkbD_1Q@mail.gmail.com>
@ 2014-01-28 12:53     ` Ilya Verbin
  2014-01-29 14:43       ` Bernd Schmidt
  0 siblings, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-01-28 12:53 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Michael V. Zolotukhin, Jakub Jelinek, Thomas Schwinge,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar, gcc

Adding gcc-patches.


Hi Bernd,

The table is used in libgomp (see my patch [1]), as proposed by Jakub
(see [2]).  The idea is that the order of entries in the host and
target tables must be identical.  This allows to set up one-to-one
correspondence between host and target addresses.
In my patch libgomp calls device_init_func from the plugin, that loads
all libraries to the target, and returns the joint table with
addresses for all libraries.  But probably it's better to have a
function like device_load, that will load only one library image, an
return a table for this library.

[1] http://gcc.gnu.org/ml/gcc-patches/2013-12/msg01896.html
[2] http://gcc.gnu.org/ml/gcc-patches/2013-09/msg01392.html

  -- Ilya


2014/1/28 Bernd Schmidt <bernds@codesourcery.com>
>
> On 12/17/2013 12:39 PM, Michael V. Zolotukhin wrote:
>>
>> Here is a patch 2/3: Add tables generation.
>>
>> This patch is just a slightly modified patch sent a couple of weeks ago.  When
>> compiling with '-fopenmp' compiler generates a special symbol, containing
>> addresses and sizes of globals/omp_fn-functions, and places it into a special
>> section.  Later, at linking, these sections are merged together and we get a
>> single table with all addresses/sizes for entire binary.  Also, in this patch we
>> start to pass '__OPENMP_TARGET__' symbol to GOMP_target calls.
>
>
> I also have a question about the code in this patch. I can see how the table is constructed - what's not clear to me is how it is going to be used? How do you map from a function or variable you want to look up to an index in this table?
>
>
> Bernd
>

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-01-28 12:53     ` Fwd: " Ilya Verbin
@ 2014-01-29 14:43       ` Bernd Schmidt
  2014-01-29 16:06         ` Ilya Verbin
  0 siblings, 1 reply; 62+ messages in thread
From: Bernd Schmidt @ 2014-01-29 14:43 UTC (permalink / raw)
  To: Ilya Verbin
  Cc: Michael V. Zolotukhin, Jakub Jelinek, Thomas Schwinge,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar, gcc

On 01/28/2014 01:52 PM, Ilya Verbin wrote:
> The table is used in libgomp (see my patch [1]), as proposed by Jakub
> (see [2]).  The idea is that the order of entries in the host and
> target tables must be identical.  This allows to set up one-to-one
> correspondence between host and target addresses.

I was worried the answer was going to be something like this. These are 
produced by two different compilers/linkers, aren't they? This seems 
really fragile to me and a recipe for hard-to-debug silent failures.

For ptx, I think we can create both tables at the same time in the 
image-generating tool, so I'm hoping that it won't be a problem. I'll 
let you know what I find, but it would still be nice to come up with 
something more robust.

> Could you please describe how functions would be invoked on
> PTX?

First we let the driver compile and load all the ptx code, then we'd 
call a cuda library function with the name of the function passed as a 
string. So I guess the host table would contain pointers to the host 
version of the functions, and the target table would contain a pointer 
to the name.


Bernd

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-01-29 14:43       ` Bernd Schmidt
@ 2014-01-29 16:06         ` Ilya Verbin
  2014-02-14 14:49           ` Ilya Verbin
  0 siblings, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-01-29 16:06 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Michael V. Zolotukhin, Jakub Jelinek, Thomas Schwinge,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar, gcc

2014/1/29 Bernd Schmidt <bernds@codesourcery.com>:
> I was worried the answer was going to be something like this. These are
> produced by two different compilers/linkers, aren't they? This seems really
> fragile to me and a recipe for hard-to-debug silent failures.

Yes.

> First we let the driver compile and load all the ptx code, then we'd call a
> cuda library function with the name of the function passed as a string. So I
> guess the host table would contain pointers to the host version of the
> functions, and the target table would contain a pointer to the name.

We also wanted to use function names at the beginning of our work [1].
Then Jakub noticed that the names aren't necessarily unique: [2], [3], [4], etc.
This led to the current approach of host/target address tables.

>
> Bernd
>

[1] http://gcc.gnu.org/ml/gcc/2013-08/msg00251.html
[2] http://gcc.gnu.org/ml/gcc-patches/2013-09/msg00250.html
[3] http://gcc.gnu.org/ml/gcc/2013-09/msg00146.html
[4] http://gcc.gnu.org/ml/gcc/2013-10/msg00184.html

  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-01-29 16:06         ` Ilya Verbin
@ 2014-02-14 14:49           ` Ilya Verbin
  2014-02-14 15:02             ` Bernd Schmidt
  2014-02-20 18:27             ` Bernd Schmidt
  0 siblings, 2 replies; 62+ messages in thread
From: Ilya Verbin @ 2014-02-14 14:49 UTC (permalink / raw)
  To: Bernd Schmidt, Thomas Schwinge
  Cc: Michael V. Zolotukhin, Jakub Jelinek, Richard Biener,
	Kirill Yukhin, Andrey Turetskiy, Ilya Tocar, gcc

Hi Bernd and Thomas,

Are you planning to support offloading from DSO in PTX/CUDA
environment?  If yes, how are you going to solve the problem of the
collision of function names from different DSOs?

However, if we decide to use element-wise host-target address mapping,
there are opportunities to make this approach more robust.  E.g. we
can store some hash(name) in the compiler-generated tables along with
the address and size.  When libgomp will perform device
initialization, it will compare hashes from the host and target DSOs.
This should reveal possible errors during the initialization, and will
avoid hard-to-debug silent failures.

  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-02-14 14:49           ` Ilya Verbin
@ 2014-02-14 15:02             ` Bernd Schmidt
  2014-02-14 15:12               ` Jakub Jelinek
  2014-02-20 18:27             ` Bernd Schmidt
  1 sibling, 1 reply; 62+ messages in thread
From: Bernd Schmidt @ 2014-02-14 15:02 UTC (permalink / raw)
  To: Ilya Verbin, Thomas Schwinge
  Cc: Michael V. Zolotukhin, Jakub Jelinek, Richard Biener,
	Kirill Yukhin, Andrey Turetskiy, Ilya Tocar, gcc, Nathan Sidwell

[-- Attachment #1: Type: text/plain, Size: 1003 bytes --]

On 02/14/2014 03:49 PM, Ilya Verbin wrote:
> Hi Bernd and Thomas,
>
> Are you planning to support offloading from DSO in PTX/CUDA
> environment?  If yes, how are you going to solve the problem of the
> collision of function names from different DSOs?

What I'm currently trying to do is to use get_file_function_name, which 
should provide a unique string that can be used to look up an offloaded 
function. That was suggested by Nathan Sidwell, I'd forgotten that such 
a function existed. I haven't actually given thought to whether that'll 
be unique across multiple DSOs, but as long as we also pass a value to 
the libgomp registration function that is unique per DSO, that shouldn't 
really matter - we should be able to reliably look up a function given 
these two keys.

I'm attaching a work-in-progress patch, which is based on patch #2 of 
Michael Zolotukhin's series. Does this look like something you could 
also work with? I should have something a little more complete next week.


Bernd


[-- Attachment #2: omp-unique.diff --]
[-- Type: text/x-patch, Size: 10812 bytes --]

Index: gomp-4_0-branch/gcc/cgraphunit.c
===================================================================
--- gomp-4_0-branch.orig/gcc/cgraphunit.c
+++ gomp-4_0-branch/gcc/cgraphunit.c
@@ -206,6 +206,7 @@ along with GCC; see the file COPYING3.
 #include "pass_manager.h"
 #include "tree-nested.h"
 #include "gimplify.h"
+#include "omp-low.h"
 #include "lto-section-names.h"
 
 /* Queue of cgraph nodes scheduled to be added into cgraph.  This is a
@@ -2019,6 +2020,8 @@ ipa_passes (void)
 
       execute_ipa_summary_passes
 	((struct ipa_opt_pass_d *) passes->all_regular_ipa_passes);
+
+      omp_finish_file ();
     }
 
   /* Some targets need to handle LTO assembler output specially.  */
Index: gomp-4_0-branch/gcc/lto-streamer-out.c
===================================================================
--- gomp-4_0-branch.orig/gcc/lto-streamer-out.c
+++ gomp-4_0-branch/gcc/lto-streamer-out.c
@@ -498,6 +498,7 @@ DFS_write_tree_body (struct output_block
 	 special handling in LTO, it must be handled by streamer hooks.  */
 
       DFS_follow_tree_edge (DECL_ATTRIBUTES (expr));
+      DFS_follow_tree_edge (DECL_UNIQUE_ID (expr));
 
       /* Do not follow DECL_ABSTRACT_ORIGIN.  We cannot handle debug information
 	 for early inlining so drop it on the floor instead of ICEing in
Index: gomp-4_0-branch/gcc/omp-low.c
===================================================================
--- gomp-4_0-branch.orig/gcc/omp-low.c
+++ gomp-4_0-branch/gcc/omp-low.c
@@ -58,6 +58,7 @@ along with GCC; see the file COPYING3.
 #include "optabs.h"
 #include "cfgloop.h"
 #include "target.h"
+#include "common/common-target.h"
 #include "omp-low.h"
 #include "gimple-low.h"
 #include "tree-cfgcleanup.h"
@@ -191,7 +192,6 @@ struct omp_for_data
   struct omp_for_data_loop *loops;
 };
 
-
 static splay_tree all_contexts;
 static int taskreg_nesting_level;
 static int target_nesting_level;
@@ -1889,6 +1889,7 @@ create_omp_child_function (omp_context *
   DECL_EXTERNAL (decl) = 0;
   DECL_CONTEXT (decl) = NULL_TREE;
   DECL_INITIAL (decl) = make_node (BLOCK);
+
   bool target_p = false;
   if (lookup_attribute ("omp declare target",
 			DECL_ATTRIBUTES (current_function_decl)))
@@ -12379,4 +12380,158 @@ make_pass_omp_simd_clone (gcc::context *
   return new pass_omp_simd_clone (ctxt);
 }
 
+struct ctor_elt_data
+{
+  vec<constructor_elt, va_gc> *v;
+  char *buffer;
+  HOST_WIDE_INT offset;
+  tree string_decl;
+};
+
+static void
+make_constructor_elts (tree decl, struct ctor_elt_data *d)
+{
+  const char *str = IDENTIFIER_POINTER (DECL_UNIQUE_ID (decl));
+  size_t len = strlen (str) + 1;
+  memcpy (d->buffer + d->offset, str, len);
+  tree str_addr = build_fold_addr_expr (d->string_decl);
+  tree off = build_int_cst (size_type_node, d->offset);
+  d->offset += len;
+
+  CONSTRUCTOR_APPEND_ELT (d->v, NULL_TREE, build_fold_addr_expr (decl));
+  CONSTRUCTOR_APPEND_ELT (d->v, NULL_TREE,
+			  fold_build_pointer_plus (str_addr, off));
+}
+
+static void
+make_unique_name (tree decl)
+{
+  tree name = DECL_NAME (decl);
+  char *p = (char *)alloca (strlen (IDENTIFIER_POINTER (name)) + 3);
+  p[0] = 'O';
+  p[1] = '_';
+  strcpy (p + 2, IDENTIFIER_POINTER (name));
+  tree id = get_file_function_name (p);
+  DECL_UNIQUE_ID (decl) = id;
+}
+
+static size_t
+build_unique_names (size_t *plen)
+{
+  int n = 0;
+  size_t len = 0;
+  /* Collect all omp-target functions.  */
+  struct cgraph_node *node;
+  FOR_EACH_DEFINED_FUNCTION (node)
+    {
+      if (!lookup_attribute ("omp declare target",
+			     DECL_ATTRIBUTES (node->decl))
+	  || !DECL_ARTIFICIAL (node->decl))
+	continue;
+      n++;
+      if (!in_lto_p)
+	make_unique_name (node->decl);
+      else
+	len += strlen (IDENTIFIER_POINTER (DECL_UNIQUE_ID (node->decl))) + 1;
+    }
+  /* Collect all omp-target global variables.  */
+  struct varpool_node *vnode;
+  FOR_EACH_DEFINED_VARIABLE (vnode)
+    {
+      if (!lookup_attribute ("omp declare target",
+			     DECL_ATTRIBUTES (vnode->decl))
+	  || TREE_CODE (vnode->decl) != VAR_DECL
+	  || DECL_SIZE (vnode->decl) == 0)
+	continue;
+
+      n++;
+      if (!in_lto_p)
+	make_unique_name (vnode->decl);
+      else
+	len += strlen (IDENTIFIER_POINTER (DECL_UNIQUE_ID (vnode->decl))) + 1;
+    }
+  *plen = len;
+  return n;
+}
+
+/* Create new symbol containing (address, size) pairs for omp-marked
+   functions and global variables.  */
+void
+omp_finish_file ()
+{
+  const char *section_name = ".offload_func_table_section";
+  tree new_decl, new_decl_type;
+  vec<constructor_elt, va_gc> *v;
+  tree ctor;
+
+  size_t len;
+  int num = build_unique_names (&len);
+
+  if (num == 0 || !in_lto_p || !targetm_common.have_named_sections)
+    return;
+
+  vec_alloc (v, num);
+
+  struct ctor_elt_data data;
+  tree array_type = build_array_type_nelts (char_type_node, len);
+  data.offset = 0;
+  data.buffer = (char *) xmalloc (len);
+  data.string_decl = build_decl (UNKNOWN_LOCATION, VAR_DECL,
+				 get_file_function_name ("O"),
+				 array_type);
+  DECL_ARTIFICIAL (data.string_decl) = 1;
+  TREE_STATIC (data.string_decl) = 1;
+  data.v = v;
+
+  /* Collect all omp-target functions.  */
+  struct cgraph_node *node;
+  FOR_EACH_DEFINED_FUNCTION (node)
+    {
+      if (!lookup_attribute ("omp declare target",
+			     DECL_ATTRIBUTES (node->decl))
+	  || !DECL_ARTIFICIAL (node->decl))
+	continue;
+      make_constructor_elts (node->decl, &data);
+    }
+  /* Collect all omp-target global variables.  */
+  struct varpool_node *vnode;
+  FOR_EACH_DEFINED_VARIABLE (vnode)
+    {
+      if (!lookup_attribute ("omp declare target",
+			     DECL_ATTRIBUTES (vnode->decl))
+	  || TREE_CODE (vnode->decl) != VAR_DECL
+	  || DECL_SIZE (vnode->decl) == 0)
+	continue;
+
+      make_constructor_elts (vnode->decl, &data);
+    }
+
+  if (data.offset == 0)
+    {
+      free (data.buffer);
+      return;
+    }
+
+  tree cst = build_string (data.offset, data.buffer);
+  TREE_TYPE (cst) = build_array_type (char_type_node,
+				      build_index_type (size_int (data.offset)));
+  DECL_INITIAL (data.string_decl) = cst;
+  free (data.buffer);
+
+  varpool_assemble_decl (varpool_node_for_decl (data.string_decl));
+
+  new_decl_type = build_array_type_nelts (pointer_sized_int_node, num * 2);
+  ctor = build_constructor (new_decl_type, v);
+  TREE_CONSTANT (ctor) = 1;
+  TREE_STATIC (ctor) = 1;
+  new_decl = build_decl (UNKNOWN_LOCATION, VAR_DECL,
+			 get_identifier (".omp_table"), new_decl_type);
+  TREE_STATIC (new_decl) = 1;
+  DECL_INITIAL (new_decl) = ctor;
+  DECL_SECTION_NAME (new_decl) = build_string (strlen (section_name),
+					       section_name);
+
+  varpool_assemble_decl (varpool_node_for_decl (new_decl));
+}
+
 #include "gt-omp-low.h"
Index: gomp-4_0-branch/gcc/omp-low.h
===================================================================
--- gomp-4_0-branch.orig/gcc/omp-low.h
+++ gomp-4_0-branch/gcc/omp-low.h
@@ -27,5 +27,6 @@ extern void omp_expand_local (basic_bloc
 extern void free_omp_regions (void);
 extern tree omp_reduction_init (tree, tree);
 extern bool make_gimple_omp_edges (basic_block, struct omp_region **);
+extern void omp_finish_file (void);
 
 #endif /* GCC_OMP_LOW_H */
Index: gomp-4_0-branch/gcc/toplev.c
===================================================================
--- gomp-4_0-branch.orig/gcc/toplev.c
+++ gomp-4_0-branch/gcc/toplev.c
@@ -78,6 +78,7 @@ along with GCC; see the file COPYING3.
 #include "diagnostic-color.h"
 #include "context.h"
 #include "pass_manager.h"
+#include "omp-low.h"
 
 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
 #include "dbxout.h"
@@ -576,6 +577,8 @@ compile_file (void)
       if (flag_sanitize & SANITIZE_THREAD)
 	tsan_finish_file ();
 
+      omp_finish_file ();
+
       output_shared_constant_pool ();
       output_object_blocks ();
       finish_tm_clone_pairs ();
Index: gomp-4_0-branch/gcc/tree.c
===================================================================
--- gomp-4_0-branch.orig/gcc/tree.c
+++ gomp-4_0-branch/gcc/tree.c
@@ -9078,7 +9078,8 @@ clean_symbol_name (char *p)
    I - for constructors
    D - for destructors
    N - for C++ anonymous namespaces
-   F - for DWARF unwind frame information.  */
+   F - for DWARF unwind frame information
+   O - for OpenMP/OpenACC target functions.  */
 
 tree
 get_file_function_name (const char *type)
Index: gomp-4_0-branch/gcc/tree-core.h
===================================================================
--- gomp-4_0-branch.orig/gcc/tree-core.h
+++ gomp-4_0-branch/gcc/tree-core.h
@@ -1366,6 +1366,10 @@ struct GTY(()) tree_decl_common {
   tree attributes;
   tree abstract_origin;
 
+  /* An IDENTIFIER_NODE used in omp-lower when offloading to
+     accelerator targets.  */
+  tree unique_id;
+
   /* Points to a structure whose details depend on the language in use.  */
   struct lang_decl *lang_specific;
 };
Index: gomp-4_0-branch/gcc/tree.h
===================================================================
--- gomp-4_0-branch.orig/gcc/tree.h
+++ gomp-4_0-branch/gcc/tree.h
@@ -2003,6 +2003,11 @@ extern void protected_set_expr_location
 #define DECL_ATTRIBUTES(NODE) \
   (DECL_COMMON_CHECK (NODE)->decl_common.attributes)
 
+/* In a DECL, an optional IDENTIFIER_NODE that holds a unique name for this
+   decl that is used when offloading to accelerator targets.  */
+#define DECL_UNIQUE_ID(NODE) \
+  (DECL_COMMON_CHECK (NODE)->decl_common.unique_id)
+
 /* For a FUNCTION_DECL, holds the tree of BINDINGs.
    For a TRANSLATION_UNIT_DECL, holds the namespace's BLOCK.
    For a VAR_DECL, holds the initial value.
Index: gomp-4_0-branch/gcc/tree-streamer-in.c
===================================================================
--- gomp-4_0-branch.orig/gcc/tree-streamer-in.c
+++ gomp-4_0-branch/gcc/tree-streamer-in.c
@@ -658,6 +658,7 @@ lto_input_ts_decl_common_tree_pointers (
   DECL_SIZE (expr) = stream_read_tree (ib, data_in);
   DECL_SIZE_UNIT (expr) = stream_read_tree (ib, data_in);
   DECL_ATTRIBUTES (expr) = stream_read_tree (ib, data_in);
+  DECL_UNIQUE_ID (expr) = stream_read_tree (ib, data_in);
 
   /* Do not stream DECL_ABSTRACT_ORIGIN.  We cannot handle debug information
      for early inlining so drop it on the floor instead of ICEing in
Index: gomp-4_0-branch/gcc/tree-streamer-out.c
===================================================================
--- gomp-4_0-branch.orig/gcc/tree-streamer-out.c
+++ gomp-4_0-branch/gcc/tree-streamer-out.c
@@ -593,6 +593,7 @@ write_ts_decl_common_tree_pointers (stru
      special handling in LTO, it must be handled by streamer hooks.  */
 
   stream_write_tree (ob, DECL_ATTRIBUTES (expr), ref_p);
+  stream_write_tree (ob, DECL_UNIQUE_ID (expr), ref_p);
 
   /* Do not stream DECL_ABSTRACT_ORIGIN.  We cannot handle debug information
      for early inlining so drop it on the floor instead of ICEing in

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-02-14 15:02             ` Bernd Schmidt
@ 2014-02-14 15:12               ` Jakub Jelinek
  2014-02-14 15:50                 ` Bernd Schmidt
  0 siblings, 1 reply; 62+ messages in thread
From: Jakub Jelinek @ 2014-02-14 15:12 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Ilya Verbin, Thomas Schwinge, Michael V. Zolotukhin,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar, gcc,
	Nathan Sidwell

On Fri, Feb 14, 2014 at 04:01:46PM +0100, Bernd Schmidt wrote:
> What I'm currently trying to do is to use get_file_function_name,
> which should provide a unique string that can be used to look up an
> offloaded function. That was suggested by Nathan Sidwell, I'd
> forgotten that such a function existed. I haven't actually given
> thought to whether that'll be unique across multiple DSOs, but as
> long as we also pass a value to the libgomp registration function
> that is unique per DSO, that shouldn't really matter - we should be
> able to reliably look up a function given these two keys.

get_file_function_name is very problematic, it is not unique across DSOs,
and relies on -frandom-seed which user can tweak and even without tweaking
can have collisions in, if we can avoid it at all, we should.
Not to mention that strings, especially get_file_function_name based ones,
aren't really short and will occupy much more space than the tables.

I still don't see what you find wrong on the approach with host/target
address arrays, if you are afraid something will reorder the arrays
(but, what would do that), one can insert indexes into both arrays as well,
which the linker can fill in and you can then verify.

	Jakub

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-02-14 15:12               ` Jakub Jelinek
@ 2014-02-14 15:50                 ` Bernd Schmidt
  2014-02-14 16:06                   ` Jakub Jelinek
  0 siblings, 1 reply; 62+ messages in thread
From: Bernd Schmidt @ 2014-02-14 15:50 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Ilya Verbin, Thomas Schwinge, Michael V. Zolotukhin,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar, gcc,
	Nathan Sidwell

On 02/14/2014 04:12 PM, Jakub Jelinek wrote:
> On Fri, Feb 14, 2014 at 04:01:46PM +0100, Bernd Schmidt wrote:
>> What I'm currently trying to do is to use get_file_function_name,
>> which should provide a unique string that can be used to look up an
>> offloaded function. That was suggested by Nathan Sidwell, I'd
>> forgotten that such a function existed. I haven't actually given
>> thought to whether that'll be unique across multiple DSOs, but as
>> long as we also pass a value to the libgomp registration function
>> that is unique per DSO, that shouldn't really matter - we should be
>> able to reliably look up a function given these two keys.
>
> get_file_function_name is very problematic, it is not unique across DSOs,
> and relies on -frandom-seed which user can tweak and even without tweaking
> can have collisions in, if we can avoid it at all, we should.
> Not to mention that strings, especially get_file_function_name based ones,
> aren't really short and will occupy much more space than the tables.

How many offloaded functions do we really expect to have in an 
executable? I don't think that's likely to be a bottleneck.

The use of a random-seed is really just a fallback, preferrably it uses 
the name of first symbol defined in the current translation unit which I 
think ought to be reliable enough.

> I still don't see what you find wrong on the approach with host/target
> address arrays, if you are afraid something will reorder the arrays
> (but, what would do that), one can insert indexes into both arrays as well,
> which the linker can fill in and you can then verify.

It strikes me as really unnecessarily brittle. On the host side we'd 
have multiple objects linked together in some order to produce such a 
table, on the ptx side we'd have to produce the table all in one go. 
Factor in possibilities like function cloning and I just think there are 
too many ways in which this can utterly fail. I'd rather have something 
that is more robust from the start even if it's slightly less efficient.


Bernd

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-02-14 15:50                 ` Bernd Schmidt
@ 2014-02-14 16:06                   ` Jakub Jelinek
  0 siblings, 0 replies; 62+ messages in thread
From: Jakub Jelinek @ 2014-02-14 16:06 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Ilya Verbin, Thomas Schwinge, Michael V. Zolotukhin,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar, gcc,
	Nathan Sidwell

On Fri, Feb 14, 2014 at 04:50:34PM +0100, Bernd Schmidt wrote:
> How many offloaded functions do we really expect to have in an
> executable? I don't think that's likely to be a bottleneck.

First of all, this isn't just about offloaded functions, but also any
global variables that need to be mapped (for OpenMP #pragma omp declare
target surrounded vars).  Like functions, also the vars can be global
(but, with multiple DSOs, even global can be interposed and thus not unique
name), or static, at which point you can have the same name in between
different TUs.

> The use of a random-seed is really just a fallback, preferrably it
> uses the name of first symbol defined in the current translation
> unit which I think ought to be reliable enough.

Many TUs don't have any non-weak global symbols at all, if the symbols
they provide are all comdat etc., then you hit the random seed all the time.
Encoding the random seed into data sections of the binary is a problem for
build reproduceability, unless you always supply -frandom-seed=XXXX, but
then it isn't really that much random (e.g. the often used
-frandom-seed=$(@) or similar).  If the weirdo names are only used to name
symbols in .symtab, that randomness at least can be stripped off, but not
if it is in data sections.  So, to me this is far less reliable and against
the spirit of static symbols.

> >I still don't see what you find wrong on the approach with host/target
> >address arrays, if you are afraid something will reorder the arrays
> >(but, what would do that), one can insert indexes into both arrays as well,
> >which the linker can fill in and you can then verify.
> 
> It strikes me as really unnecessarily brittle. On the host side we'd
> have multiple objects linked together in some order to produce such
> a table, on the ptx side we'd have to produce the table all in one

Sure.  So, the linker/linker plugin orders the objects in some order
and thus by concatenation of the smaller per-TU tables creates the
host table, then the same linker/linker plugin just creates the to be target
table with the same order, and feeds that to the offloading target
compiler.

> go. Factor in possibilities like function cloning and I just think
> there are too many ways in which this can utterly fail. I'd rather
> have something that is more robust from the start even if it's
> slightly less efficient.

I don't see how function cloning or anything similar can make a difference
here, you have a function which is address taken and it's address is tracked
in some array, such function can't be cloned (well, can be cloned for
unrelated callers, but the table still keeps the original function, with the
same public ABI etc.).

	Jakub

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-02-14 14:49           ` Ilya Verbin
  2014-02-14 15:02             ` Bernd Schmidt
@ 2014-02-20 18:27             ` Bernd Schmidt
  2014-02-21 15:17               ` Ilya Verbin
  2014-02-28 16:09               ` Ilya Verbin
  1 sibling, 2 replies; 62+ messages in thread
From: Bernd Schmidt @ 2014-02-20 18:27 UTC (permalink / raw)
  To: Ilya Verbin, Thomas Schwinge
  Cc: Michael V. Zolotukhin, Jakub Jelinek, Richard Biener,
	Kirill Yukhin, Andrey Turetskiy, Ilya Tocar, gcc-patches,
	Nathan Sidwell

[-- Attachment #1: Type: text/plain, Size: 2333 bytes --]

Okay, so given the resistance to a unique-string scheme I went back and 
adapted the mechanism from your patches for ptx. I guess we can use that 
for now; if and when it breaks I have something ready to replace it.

There were still a number of things in these patches that did not make 
sense to me and which I've changed. Let me know if there was a good 
reason for the way some of these things were originally done.
  * Functions and variables now go into different tables, otherwise
    intermixing between them could be a problem that causes tables to
    go out of sync between host and target (imagine one big table being
    generated by ptx lto1/mkoffload, and multiple small table fragments
    being linked together on the host side).
  * I've put the begin/end fragments for the host tables into crtstuff,
    which seems like the standard way of doing things.
  * Changed the generation of tables to lower the alignment so that
    there are no gaps when linking together multiple files.
  * All the target-specific image-generating code is moved out of
    lto-wrapper into a mkoffload tool.
  * Is there a reason to call a register function for the host tables?
    The way I've set it up, we register a target function/variable table
    while also passing a pointer to the __OPENMP_TARGET__ symbol which
    holds information about the host side tables.
  * There aren't any named sections in ptx, so I've added another target
    hook to write out the map.
  * An offload compiler is built with --enable-as-accelerator-for=, which
    eliminates the need for -fopenmp-target, and changes install paths so
    that the host compiler knows where to find it. No need for
    OFFLOAD_TARGET_COMPILERS anymore.

I'll still need to add gcc driver support to automatically set the 
OFFLOAD_TARGET_NAMES variable from the accelerator targets that were 
configured in. Currently that still needs to be set manually for testing.

I'm appending those parts of my current patch kit that seem relevant. 
This includes the ptx mkoffload tool and a patch to make a dummy 
GOMP_offload_register function. Most of the others are updated versions 
of patches I've posted before, and two adapted from Michael Zolotukhin's 
set (automatically generated files not included in the diffs for size 
reasons). How does this look?


Bernd


[-- Attachment #2: 001-config-options.diff --]
[-- Type: text/x-patch, Size: 1253 bytes --]

2013-09-05  Nathan Sidwell  <nathan@codesourcery.com>

	* configure.ac: Add --enable-accelerator.
	* configure: Rebuilt.

Index: gomp-4_0-branch/configure.ac
===================================================================
--- gomp-4_0-branch.orig/configure.ac
+++ gomp-4_0-branch/configure.ac
@@ -286,6 +286,26 @@ case ${with_newlib} in
   yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
 esac
 
+# Handle --enable-accelerator.  This is in top-level because both libgoacc and
+# GCC proper need this information.
+# --disable-accelerator
+#   Default.  Do not build accelerator pieces, only support host execution.
+# --enable-accelerator=device-triplet
+#   Build accelerator pieces for 'device-triplet'
+AC_ARG_ENABLE(accelerator,
+[AS_HELP_STRING([[--enable-accelerator[=ARG]]],
+		[build accelerator @<:@ARG={no,device-triplet}@:>@])],
+ENABLE_ACCELERATOR=$enableval,
+ENABLE_ACCELERATOR=no)
+case "${ENABLE_ACCELERATOR}" in
+  yes) AC_MSG_ERROR([--enable-accelerators must name accelerator]) ;;
+  no) ;;
+  nvptx)
+   # validate target ok here?
+   ;;
+  *) AC_MSG_ERROR([unrecognized accelerator]) ;;
+esac
+
 # Handle --enable-gold, --enable-ld.
 # --disable-gold [--enable-ld]
 #     Build only ld.  Default option.

[-- Attachment #3: 002-as-accel.diff --]
[-- Type: text/x-patch, Size: 12029 bytes --]

Index: gcc/config.in
===================================================================
--- gcc/config.in.orig
+++ gcc/config.in
@@ -1,5 +1,18 @@
 /* config.in.  Generated from configure.ac by autoheader.  */
 
+/* Define if this compiler should be built and used as the target device
+   compiler for OpenACC. */
+#ifndef USED_FOR_TARGET
+#undef ACCEL_COMPILER
+#endif
+
+
+/* Define to the name of the OpenACC accelerator target. */
+#ifndef USED_FOR_TARGET
+#undef ACCEL_TARGET
+#endif
+
+
 /* Define if building universal (internal helper macro) */
 #ifndef USED_FOR_TARGET
 #undef AC_APPLE_UNIVERSAL_BUILD
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac.orig
+++ gcc/configure.ac
@@ -38,6 +38,11 @@ AC_CANONICAL_TARGET
 # Determine the noncanonical target name, for directory use.
 ACX_NONCANONICAL_TARGET
 
+# Used for constructing correct paths for offload compilers.
+real_target_noncanonical=${target_noncanonical}
+tool_prefix=$target_noncanonical
+accel_dir_suffix=
+
 # Determine the target- and build-specific subdirectories
 GCC_TOPLEV_SUBDIRS
 
@@ -834,6 +839,36 @@ AC_ARG_ENABLE(languages,
 esac],
 [enable_languages=c])
 
+AC_ARG_ENABLE(accelerator,
+[AS_HELP_STRING([--enable-accelerator], [build accelerator @<:@ARG={no,device-triplet}@:>@])],
+[
+  case $enable_accelerator in
+  no) ;;
+  *)
+    AC_DEFINE_UNQUOTED(ACCEL_TARGET,"${enable_accelerator}",
+     [Define to the name of the OpenACC accelerator target.])
+    ;;
+  esac
+], [enable_accelerator=no])
+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}
+  accel_dir_suffix=/accel/${target_noncanonical}
+  real_target_noncanonical=${enable_as_accelerator_for}
+], [enable_as_accelerator=no])
+AC_SUBST(enable_as_accelerator)
+
 AC_ARG_WITH(multilib-list,
 [AS_HELP_STRING([--with-multilib-list], [select multilibs (AArch64, SH and x86-64 only)])],
 :,
@@ -5375,6 +5410,10 @@ AC_SUBST(c_target_objs)
 AC_SUBST(cxx_target_objs)
 AC_SUBST(fortran_target_objs)
 AC_SUBST(target_cpu_default)
+AC_SUBST(tool_prefix)
+AC_SUBST(real_target_noncanonical)
+AC_SUBST(accel_dir_suffix)
+AC_SUBST(accel_host)
 
 AC_SUBST_FILE(language_hooks)
 
@@ -5578,5 +5617,6 @@ do
 done
 ], 
 [subdirs='$subdirs'])
+
 AC_OUTPUT
 
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in.orig
+++ gcc/Makefile.in
@@ -58,6 +58,7 @@ build=@build@
 host=@host@
 target=@target@
 target_noncanonical:=@target_noncanonical@
+real_target_noncanonical:=@real_target_noncanonical@
 
 # Sed command to transform gcc to installed name.
 program_transform_name := @program_transform_name@
@@ -66,6 +67,11 @@ program_transform_name := @program_trans
 # Directories used during build
 # -----------------------------
 
+# 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.
 srcdir = @srcdir@
 gcc_docdir = @srcdir@/doc
@@ -351,6 +357,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
 
@@ -586,9 +594,9 @@ 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
@@ -766,7 +774,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 := $(target_noncanonical)-$(shell echo gcc|sed '$(program_transform_name)')
+GCC_TARGET_INSTALL_NAME := $(tool_prefix)-$(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)')
 
@@ -1935,9 +1943,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)) \
@@ -3203,16 +3213,22 @@ 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)
-	-rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
-	-$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
-	-rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-$(version)$(exeext)
-	-( cd $(DESTDIR)$(bindir) && \
-	   $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-$(version)$(exeext) )
-	-if [ ! -f gcc-cross$(exeext) ] ; then \
-	  rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(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)
+	-if test "@enable_as_accelerator@" != "yes" ; then \
+	  rm -f $(DESTDIR)$(bindir)/$(tool_prefix)-gcc-$(version)$(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) ); \
+	    $(LN) $(GCC_INSTALL_NAME)$(exeext) $(tool_prefix)-gcc-$(version)$(exeext) ); \
+	  if [ ! -f gcc-cross$(exeext) ] ; 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; \
 	fi
 
 # Install the info files.
Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c.orig
+++ gcc/gcc.c
@@ -157,6 +157,7 @@ static const char *const spec_version =
 /* The target machine.  */
 
 static const char *spec_machine = DEFAULT_TARGET_MACHINE;
+static const char *spec_host_machine = DEFAULT_REAL_TARGET_MACHINE;
 
 /* Nonzero if cross-compiling.
    When -b is used, the value comes from the `specs' file.  */
@@ -1230,6 +1231,9 @@ static const char *const standard_startf
    relative to the driver.  */
 static const char *const tooldir_base_prefix = TOOLDIR_BASE_PREFIX;
 
+/* A prefix to be used when this is an accelerator compiler.  */
+static const char *const accel_dir_suffix = ACCEL_DIR_SUFFIX;
+
 /* Subdirectory to use for locating libraries.  Set by
    set_multilib_dir based on the compilation options.  */
 
@@ -2184,7 +2188,7 @@ for_each_path (const struct path_prefix
 
   multi_suffix = machine_suffix;
   just_multi_suffix = just_machine_suffix;
-  if (do_multi && multilib_dir && strcmp (multilib_dir, ".") != 0)
+  if (just_multi_suffix && do_multi && multilib_dir && strcmp (multilib_dir, ".") != 0)
     {
       multi_dir = concat (multilib_dir, dir_separator_str, NULL);
       multi_suffix = concat (multi_suffix, multi_dir, NULL);
@@ -2211,7 +2215,7 @@ for_each_path (const struct path_prefix
       if (multiarch_suffix)
 	multiarch_len = strlen (multiarch_suffix);
       suffix_len = strlen (multi_suffix);
-      just_suffix_len = strlen (just_multi_suffix);
+      just_suffix_len = just_multi_suffix ?  strlen (just_multi_suffix) : 0;
 
       if (path == NULL)
 	{
@@ -2237,6 +2241,7 @@ for_each_path (const struct path_prefix
 	  /* Some paths are tried with just the machine (ie. target)
 	     subdir.  This is used for finding as, ld, etc.  */
 	  if (!skip_multi_dir
+	      && just_multi_suffix
 	      && pl->require_machine_suffix == 2)
 	    {
 	      memcpy (path + len, just_multi_suffix, just_suffix_len + 1);
@@ -4044,15 +4049,15 @@ process_command (unsigned int decoded_op
     }
 
   gcc_assert (!IS_ABSOLUTE_PATH (tooldir_base_prefix));
-  tooldir_prefix2 = concat (tooldir_base_prefix, spec_machine,
+  tooldir_prefix2 = concat (tooldir_base_prefix, spec_host_machine,
 			    dir_separator_str, NULL);
 
   /* Look for tools relative to the location from which the driver is
      running, or, if that is not available, the configured prefix.  */
   tooldir_prefix
     = concat (gcc_exec_prefix ? gcc_exec_prefix : standard_exec_prefix,
-	      spec_machine, dir_separator_str,
-	      spec_version, dir_separator_str, tooldir_prefix2, NULL);
+	      spec_host_machine, dir_separator_str, spec_version,
+	      accel_dir_suffix, dir_separator_str, tooldir_prefix2, NULL);
   free (tooldir_prefix2);
 
   add_prefix (&exec_prefixes,
@@ -6458,9 +6463,12 @@ main (int argc, char **argv)
 
   /* Read specs from a file if there is one.  */
 
-  machine_suffix = concat (spec_machine, dir_separator_str,
-			   spec_version, dir_separator_str, NULL);
-  just_machine_suffix = concat (spec_machine, dir_separator_str, NULL);
+  machine_suffix = concat (spec_host_machine, dir_separator_str, spec_version,
+			   accel_dir_suffix, dir_separator_str, NULL);
+#ifndef ACCEL_COMPILER
+  just_machine_suffix = concat (spec_host_machine,
+				dir_separator_str, NULL);
+#endif
 
   specs_file = find_a_file (&startfile_prefixes, "specs", R_OK, true);
   /* Read the specs file unless it is a default one.  */
@@ -6469,16 +6477,17 @@ main (int argc, char **argv)
   else
     init_spec ();
 
+#ifndef ACCEL_COMPILER
   /* We need to check standard_exec_prefix/just_machine_suffix/specs
      for any override of as, ld and libraries.  */
   specs_file = (char *) alloca (strlen (standard_exec_prefix)
 		       + strlen (just_machine_suffix) + sizeof ("specs"));
-
   strcpy (specs_file, standard_exec_prefix);
   strcat (specs_file, just_machine_suffix);
   strcat (specs_file, "specs");
   if (access (specs_file, R_OK) == 0)
     read_specs (specs_file, true, false);
+#endif
 
   /* Process any configure-time defaults specified for the command line
      options, via OPTION_DEFAULT_SPECS.  */
@@ -6657,8 +6666,9 @@ main (int argc, char **argv)
 
   /* If we have a GCC_EXEC_PREFIX envvar, modify it for cpp's sake.  */
   if (gcc_exec_prefix)
-    gcc_exec_prefix = concat (gcc_exec_prefix, spec_machine, dir_separator_str,
-			      spec_version, dir_separator_str, NULL);
+    gcc_exec_prefix = concat (gcc_exec_prefix, spec_host_machine,
+			      dir_separator_str, spec_version,
+			      accel_dir_suffix, dir_separator_str, NULL);
 
   /* Now we have the specs.
      Set the `valid' bits for switches that match anything in any spec.  */

[-- Attachment #4: 003-accel-gcc.diff --]
[-- Type: text/x-patch, Size: 9078 bytes --]


	* Makefile.def (host_modules, dependencies): Add accel-gcc entries.
	(flags_to_pass): Add accel_target_alias).
	* Makefile.tpl (accel_target_alias, accel_target_vendor,
	accel_target_os, accel_target): New variables.
	(configure-[+prefix+][+module+]): Special case accel-gcc module.
	* configure.ac (host_tools): Add accel-gcc.
	(ENABLE_ACCELERATOR handling): Set skipdirs and
	accel_target_noncanonical, then use ACX_CANONICAL_ACCEL_TARGET.
	* configure: Regenerate.
	* Makefile.in: Regenerate.

	config/
	* acx.m4 (ACX_CANONICAL_ACCEL_TARGET): New macro.

------------------------------------------------------------------------
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 gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools"
+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"
 
 # libgcj represents the runtime libraries only used by gcj.
 libgcj="target-libffi \
@@ -297,15 +297,26 @@ AC_ARG_ENABLE(accelerator,
 		[build accelerator @<:@ARG={no,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]) ;;
-  no) ;;
-  nvptx)
-   # validate target ok here?
-   ;;
-  *) AC_MSG_ERROR([unrecognized accelerator]) ;;
+  yes)
+    AC_MSG_ERROR([--enable-accelerators must name accelerator])
+    skipdirs="${skipdirs} accel-gcc"
+    ;;
+  no)
+    skipdirs="${skipdirs} accel-gcc"
+    ;;
+  nvptx*)
+    accel_target_noncanonical="${ENABLE_ACCELERATOR}"
+    ;;
+  *)
+    AC_MSG_ERROR([unrecognized accelerator])
+    skipdirs="${skipdirs} accel-gcc"
+    ;;
 esac
 
+ACX_CANONICAL_ACCEL_TARGET
+
 # Handle --enable-gold, --enable-ld.
 # --disable-gold [--enable-ld]
 #     Build only ld.  Default option.
@@ -2139,7 +2150,15 @@ done
 configdirs_all="$configdirs"
 configdirs=
 for i in ${configdirs_all} ; do
-  if test -f ${srcdir}/$i/configure ; then
+  case $i in
+    accel-gcc)
+      confsrcdir=gcc
+      ;;
+    *)
+      confsrcdir=$i
+      ;;
+  esac
+  if test -f ${srcdir}/${confsrcdir}/configure ; then
     configdirs="${configdirs} $i"
   fi
 done
@@ -3148,7 +3167,6 @@ case " $configdirs " in
     ;;
 esac
 
-
 # Host tools.
 NCN_STRICT_CHECK_TOOLS(AR, ar)
 NCN_STRICT_CHECK_TOOLS(AS, as)
Index: config/acx.m4
===================================================================
--- config/acx.m4.orig
+++ config/acx.m4
@@ -61,6 +61,36 @@ AC_DEFUN([ACX_NONCANONICAL_TARGET],
 AC_SUBST(target_noncanonical)
 ]) []dnl # ACX_NONCANONICAL_TARGET
 
+AC_DEFUN(ACX_CANONICAL_ACCEL_TARGET,
+[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_MSG_CHECKING(accelerator target system type)
+
+dnl Set accel_target_alias.
+accel_target_alias=$accel_target_noncanonical
+case "$accel_target_alias" in
+NONE)
+  accel_target=NONE
+  ;;
+*)
+  accel_target=`$ac_config_sub $accel_target_alias`
+  ;;
+esac
+
+dnl Set the other accel_target vars.
+changequote(<<, >>)dnl
+accel_target_cpu=`echo $accel_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+accel_target_vendor=`echo $accel_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+accel_target_os=`echo $accel_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+changequote([, ])dnl
+AC_MSG_RESULT($accel_target)
+AC_SUBST(accel_target_noncanonical)dnl
+AC_SUBST(accel_target)dnl
+AC_SUBST(accel_target_alias)dnl
+AC_SUBST(accel_target_cpu)dnl
+AC_SUBST(accel_target_vendor)dnl
+AC_SUBST(accel_target_os)dnl
+])
+
 dnl ####
 dnl # GCC_TOPLEV_SUBDIRS
 dnl # GCC & friends build 'build', 'host', and 'target' tools.  These must
Index: Makefile.def
===================================================================
--- Makefile.def.orig
+++ Makefile.def
@@ -45,6 +45,9 @@ 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;
@@ -211,6 +212,7 @@ flags_to_pass = { flag= sysconfdir ; };
 flags_to_pass = { flag= tooldir ; };
 flags_to_pass = { flag= build_tooldir ; };
 flags_to_pass = { flag= target_alias ; };
+flags_to_pass = { flag= accel_target_alias ; };
 
 // Build tools
 flags_to_pass = { flag= AWK ; };
@@ -307,6 +309,7 @@ dependencies = { module=all-gcc; on=all-
 dependencies = { module=all-gcc; on=all-mpfr; };
 dependencies = { module=all-gcc; on=all-mpc; };
 dependencies = { module=all-gcc; on=all-cloog; };
+dependencies = { module=all-gcc; on=all-accel-gcc; };
 dependencies = { module=all-gcc; on=all-build-texinfo; };
 dependencies = { module=all-gcc; on=all-build-bison; };
 dependencies = { module=all-gcc; on=all-build-flex; };
@@ -319,6 +322,24 @@ dependencies = { module=all-gcc; on=all-
 dependencies = { module=all-gcc; on=all-libiberty; };
 dependencies = { module=all-gcc; on=all-fixincludes; };
 dependencies = { module=all-gcc; on=all-lto-plugin; };
+dependencies = { module=all-accel-gcc; on=all-libiberty; hard=true; };
+dependencies = { module=all-accel-gcc; on=all-intl; };
+dependencies = { module=all-accel-gcc; on=all-mpfr; };
+dependencies = { module=all-accel-gcc; on=all-mpc; };
+dependencies = { module=all-accel-gcc; on=all-cloog; };
+dependencies = { module=all-accel-gcc; on=all-accel-gcc; };
+dependencies = { module=all-accel-gcc; on=all-build-texinfo; };
+dependencies = { module=all-accel-gcc; on=all-build-bison; };
+dependencies = { module=all-accel-gcc; on=all-build-flex; };
+dependencies = { module=all-accel-gcc; on=all-build-libiberty; };
+dependencies = { module=all-accel-gcc; on=all-build-fixincludes; };
+dependencies = { module=all-accel-gcc; on=all-zlib; };
+dependencies = { module=all-accel-gcc; on=all-libbacktrace; hard=true; };
+dependencies = { module=all-accel-gcc; on=all-libcpp; hard=true; };
+dependencies = { module=all-accel-gcc; on=all-libdecnumber; hard=true; };
+dependencies = { module=all-accel-gcc; on=all-libiberty; };
+dependencies = { module=all-accel-gcc; on=all-fixincludes; };
+dependencies = { module=all-accel-gcc; on=all-lto-plugin; };
 dependencies = { module=info-gcc; on=all-build-libiberty; };
 dependencies = { module=dvi-gcc; on=all-build-libiberty; };
 dependencies = { module=pdf-gcc; on=all-build-libiberty; };
Index: Makefile.tpl
===================================================================
--- Makefile.tpl.orig
+++ Makefile.tpl
@@ -49,6 +49,10 @@ target_alias=@target_noncanonical@
 target_vendor=@target_vendor@
 target_os=@target_os@
 target=@target@
+accel_target_alias=@accel_target_noncanonical@
+accel_target_vendor=@accel_target_vendor@
+accel_target_os=@accel_target_os@
+accel_target=@accel_target@
 
 program_transform_name = @program_transform_name@
 
@@ -996,18 +1000,23 @@ configure-[+prefix+][+module+]: [+ IF bo
 	$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
 	[+exports+] [+extra_exports+] \
 	echo Configuring in [+subdir+]/[+module+]; \
+	[+ IF (= (get "module") "accel-gcc") +] \
+	this_target="$(accel_target_alias)"; \
+	[+ ELSE +] \
+	this_target="[+target_alias+]"; \
+	[+ ENDIF +] \
 	cd "[+subdir+]/[+module+]" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-	  *) topdir=`echo [+subdir+]/[+module+]/ | \
+	  *) topdir=`echo [+subdir+]/[+? actual_module (get "actual_module") (get "module")+]/ | \
 		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
 	esac; \
-	srcdiroption="--srcdir=$${topdir}/[+module+]"; \
-	libsrcdir="$$s/[+module+]"; \
+	srcdiroption="--srcdir=$${topdir}/[+? actual_module (get "actual_module") (get "module")+]"; \
+	libsrcdir="$$s/[+? actual_module (get "actual_module") (get "module")+]"; \
 	[+ IF no-config-site +]rm -f no-such-file || : ; \
 	CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
 	  [+args+] --build=${build_alias} --host=[+host_alias+] \
-	  --target=[+target_alias+] $${srcdiroption} [+extra_configure_flags+] \
+	  --target=$${this_target} $${srcdiroption} [+extra_configure_flags+] \
 	  || exit 1
 @endif [+prefix+][+module+]
 
@@ -1085,7 +1094,7 @@ all-[+prefix+][+module+]: configure-[+pr
 	[+exports+] [+extra_exports+] \
 	(cd [+subdir+]/[+module+] && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+stage1_args+] [+extra_make_flags+] \
-		$(TARGET-[+prefix+][+module+]))
+		$(TARGET-[+prefix+][+? actual_module (get "actual_module") (get "module")+]))
 @endif [+prefix+][+module+]
 
 [+ IF bootstrap +]

[-- Attachment #5: 004-secnames.diff --]
[-- Type: text/x-patch, Size: 6077 bytes --]

Index: gcc/config/darwin.c
===================================================================
--- gcc/config/darwin.c.orig
+++ gcc/config/darwin.c
@@ -61,6 +61,7 @@ along with GCC; see the file COPYING3.
 #include "gimple.h"
 #include "gimplify.h"
 #include "lto-streamer.h"
+#include "lto-section-names.h"
 
 /* Darwin supports a feature called fix-and-continue, which is used
    for rapid turn around debugging.  When code is compiled with the
@@ -1900,9 +1901,6 @@ typedef struct GTY (()) darwin_lto_secti
 
 static GTY (()) vec<darwin_lto_section_e, va_gc> *lto_section_names;
 
-/* Segment for LTO data.  */
-#define LTO_SEGMENT_NAME "__GNU_LTO"
-
 /* Section wrapper scheme (used here to wrap the unlimited number of LTO
    sections into three Mach-O ones).
    NOTE: These names MUST be kept in sync with those in
Index: gcc/config/i386/winnt.c
===================================================================
--- gcc/config/i386/winnt.c.orig
+++ gcc/config/i386/winnt.c
@@ -49,6 +49,7 @@ along with GCC; see the file COPYING3.
 #include "is-a.h"
 #include "gimple.h"
 #include "lto-streamer.h"
+#include "lto-section-names.h"
 
 /* i386/PE specific attribute support.
 
Index: gcc/lto/lto-object.c
===================================================================
--- gcc/lto/lto-object.c.orig
+++ gcc/lto/lto-object.c
@@ -32,13 +32,9 @@ along with GCC; see the file COPYING3.
 #include "lto.h"
 #include "tm.h"
 #include "lto-streamer.h"
+#include "lto-section-names.h"
 #include "simple-object.h"
 
-/* Segment name for LTO sections.  This is only used for Mach-O.
-   FIXME: This needs to be kept in sync with darwin.c.  */
-
-#define LTO_SEGMENT_NAME "__GNU_LTO"
-
 /* An LTO file wrapped around an simple_object.  */
 
 struct lto_simple_object
Index: gcc/lto/lto.c
===================================================================
--- gcc/lto/lto.c.orig
+++ gcc/lto/lto.c
@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3.
 #include "lto.h"
 #include "lto-tree.h"
 #include "lto-streamer.h"
+#include "lto-section-names.h"
 #include "tree-streamer.h"
 #include "splay-tree.h"
 #include "lto-partition.h"
Index: gcc/lto-streamer.c
===================================================================
--- gcc/lto-streamer.c.orig
+++ gcc/lto-streamer.c
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3.
 #include "diagnostic-core.h"
 #include "tree-streamer.h"
 #include "lto-streamer.h"
+#include "lto-section-names.h"
 #include "streamer-hooks.h"
 
 /* Statistics gathered during LTO, WPA and LTRANS.  */
Index: gcc/lto-streamer.h
===================================================================
--- gcc/lto-streamer.h.orig
+++ gcc/lto-streamer.h
@@ -134,17 +134,6 @@ along with GCC; see the file COPYING3.
      String are represented in the table as pairs, a length in ULEB128
      form followed by the data for the string.  */
 
-/* The string that is the prefix on the section names we make for lto.
-   For decls the DECL_ASSEMBLER_NAME is appended to make the section
-   name for the functions and static_initializers.  For other types of
-   sections a '.' and the section type are appended.  */
-#define LTO_SECTION_NAME_PREFIX         ".gnu.lto_"
-#define OMP_SECTION_NAME_PREFIX         ".gnu.target_lto_"
-
-/* Can be either OMP_SECTION_NAME_PREFIX when we stream pragma omp target
-   stuff, or LTO_SECTION_NAME_PREFIX for lto case.  */
-extern const char  *section_name_prefix;
-
 #define LTO_major_version 3
 #define LTO_minor_version 0
 
Index: gcc/lto-wrapper.c
===================================================================
--- gcc/lto-wrapper.c.orig
+++ gcc/lto-wrapper.c
@@ -46,11 +46,7 @@ along with GCC; see the file COPYING3.
 #include "opts.h"
 #include "options.h"
 #include "simple-object.h"
-
-/* From lto-streamer.h which we cannot include with -fkeep-inline-functions.
-   ???  Split out a lto-streamer-core.h.  */
-
-#define LTO_SECTION_NAME_PREFIX         ".gnu.lto_"
+#include "lto-section-names.h"
 
 /* End of lto-streamer.h copy.  */
 
Index: gcc/lto-section-names.h
===================================================================
--- /dev/null
+++ gcc/lto-section-names.h
@@ -0,0 +1,34 @@
+/* Definitions for LTO section names.
+   Copyright (C) 2013 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+/* The string that is the prefix on the section names we make for lto.
+   For decls the DECL_ASSEMBLER_NAME is appended to make the section
+   name for the functions and static_initializers.  For other types of
+   sections a '.' and the section type are appended.  */
+#define LTO_SECTION_NAME_PREFIX ".gnu.lto_"
+#define LTO_TARGET_SECTION_NAME_PREFIX ".gnu.tlto_"
+
+/* Segment name for LTO sections.  This is only used for Mach-O.  */
+
+#define LTO_SEGMENT_NAME "__GNU_LTO"
+#define OMP_SECTION_NAME_PREFIX         ".gnu.target_lto_"
+
+/* Can be either OMP_SECTION_NAME_PREFIX when we stream pragma omp target
+   stuff, or LTO_SECTION_NAME_PREFIX for lto case.  */
+extern const char  *section_name_prefix;
Index: gcc/cgraphunit.c
===================================================================
--- gcc/cgraphunit.c.orig
+++ gcc/cgraphunit.c
@@ -210,6 +210,7 @@ along with GCC; see the file COPYING3.
 #include "pass_manager.h"
 #include "tree-nested.h"
 #include "gimplify.h"
+#include "lto-section-names.h"
 
 /* Queue of cgraph nodes scheduled to be added into cgraph.  This is a
    secondary queue used during optimization to accommodate passes that

[-- Attachment #6: 005-zolotukhin1.diff --]
[-- Type: text/x-patch, Size: 1397 bytes --]

Index: gomp-4_0-branch/gcc/lto/lto-object.c
===================================================================
--- gomp-4_0-branch.orig/gcc/lto/lto-object.c
+++ gomp-4_0-branch/gcc/lto/lto-object.c
@@ -225,8 +225,7 @@ lto_obj_add_section (void *data, const c
   void **slot;
   struct lto_section_list *list = loasd->list;
 
-  if (strncmp (name, LTO_SECTION_NAME_PREFIX,
-	       strlen (LTO_SECTION_NAME_PREFIX)) != 0)
+  if (strncmp (name, section_name_prefix, strlen (section_name_prefix)))
     return 1;
 
   new_name = xstrdup (name);
Index: gomp-4_0-branch/gcc/lto/lto.c
===================================================================
--- gomp-4_0-branch.orig/gcc/lto/lto.c
+++ gomp-4_0-branch/gcc/lto/lto.c
@@ -2082,7 +2082,7 @@ lto_section_with_id (const char *name, u
 {
   const char *s;
 
-  if (strncmp (name, LTO_SECTION_NAME_PREFIX, strlen (LTO_SECTION_NAME_PREFIX)))
+  if (strncmp (name, section_name_prefix, strlen (section_name_prefix)))
     return 0;
   s = strrchr (name, '.');
   return s && sscanf (s, "." HOST_WIDE_INT_PRINT_HEX_PURE, id) == 1;
@@ -2758,6 +2758,10 @@ read_cgraph_and_symbols (unsigned nfiles
 
   timevar_push (TV_IPA_LTO_DECL_IN);
 
+#ifdef ACCEL_COMPILER
+    section_name_prefix = OMP_SECTION_NAME_PREFIX;
+#endif
+
   real_file_decl_data
     = decl_data = ggc_alloc_cleared_vec_lto_file_decl_data_ptr (nfiles + 1);
   real_file_count = nfiles;

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 006-zolotukhin2.diff --]
[-- Type: text/x-patch; name="006-zolotukhin2.diff", Size: 13397 bytes --]

Index: gomp-4_0-branch/gcc/omp-low.c
===================================================================
--- gomp-4_0-branch.orig/gcc/omp-low.c
+++ gomp-4_0-branch/gcc/omp-low.c
@@ -64,6 +64,7 @@ along with GCC; see the file COPYING3.
 #include "optabs.h"
 #include "cfgloop.h"
 #include "target.h"
+#include "common/common-target.h"
 #include "omp-low.h"
 #include "gimple-low.h"
 #include "tree-cfgcleanup.h"
@@ -8494,19 +8495,22 @@ expand_omp_target (struct omp_region *re
     }
 
   gimple g;
-  /* FIXME: This will be address of
-     extern char __OPENMP_TARGET__[] __attribute__((visibility ("hidden")))
-     symbol, as soon as the linker plugin is able to create it for us.  */
-  tree openmp_target = build_zero_cst (ptr_type_node);
+  tree openmp_target
+    = build_decl (UNKNOWN_LOCATION, VAR_DECL,
+		  get_identifier ("__OPENMP_TARGET__"), ptr_type_node);
+  TREE_PUBLIC (openmp_target) = 1;
+  DECL_EXTERNAL (openmp_target) = 1;
   if (kind == GF_OMP_TARGET_KIND_REGION)
     {
       tree fnaddr = build_fold_addr_expr (child_fn);
-      g = gimple_build_call (builtin_decl_explicit (start_ix), 7,
-			     device, fnaddr, openmp_target, t1, t2, t3, t4);
+      g = gimple_build_call (builtin_decl_explicit (start_ix), 7, device,
+			     fnaddr, build_fold_addr_expr (openmp_target),
+			     t1, t2, t3, t4);
     }
   else
-    g = gimple_build_call (builtin_decl_explicit (start_ix), 6,
-			   device, openmp_target, t1, t2, t3, t4);
+    g = gimple_build_call (builtin_decl_explicit (start_ix), 6, device,
+			   build_fold_addr_expr (openmp_target),
+			   t1, t2, t3, t4);
   gimple_set_location (g, gimple_location (entry_stmt));
   gsi_insert_before (&gsi, g, GSI_SAME_STMT);
   if (kind != GF_OMP_TARGET_KIND_REGION)
@@ -12566,4 +12570,139 @@ make_pass_omp_simd_clone (gcc::context *
   return new pass_omp_simd_clone (ctxt);
 }
 
+/* Helper function for omp_finish_file routine.
+   Takes decls from V_DECLS and adds their addresses and sizes to
+   constructor-vector V_CTOR.  It will be later used as DECL_INIT for decl
+   representing a global symbol for OpenMP descriptor.  */
+static void
+add_decls_addresses_to_decl_constructor (vec<tree, va_gc> *v_decls,
+					 vec<constructor_elt, va_gc> *v_ctor)
+{
+  unsigned len = vec_safe_length (v_decls);
+  for (unsigned i = 0; i < len; i++)
+    {
+      tree it = (*v_decls)[i];
+      bool is_function = TREE_CODE (it) != VAR_DECL;
+
+      CONSTRUCTOR_APPEND_ELT (v_ctor, NULL_TREE, build_fold_addr_expr (it));
+      if (!is_function)
+	CONSTRUCTOR_APPEND_ELT (v_ctor, NULL_TREE,
+				fold_convert (const_ptr_type_node,
+					      DECL_SIZE (it)));
+    }
+}
+
+/* Create new symbol containing (address, size) pairs for omp-marked
+   functions and global variables.  */
+void
+omp_finish_file (void)
+{
+  struct cgraph_node *node;
+  struct varpool_node *vnode;
+  const char *funcs_section_name = ".offload_func_table_section";
+  const char *vars_section_name = ".offload_var_table_section";
+  vec<tree, va_gc> *v_funcs, *v_vars;
+
+  vec_alloc (v_vars, 0);
+  vec_alloc (v_funcs, 0);
+
+  /* Collect all omp-target functions.  */
+  FOR_EACH_DEFINED_FUNCTION (node)
+    {
+      /* TODO: This check could fail on functions, created by omp
+	 parallel/task pragmas.  It's better to name outlined for offloading
+	 functions in some different way and to check here the function name.
+	 It could be something like "*_omp_tgtfn" in contrast with "*_omp_fn"
+	 for functions from omp parallel/task pragmas.  */
+      if (!lookup_attribute ("omp declare target",
+			     DECL_ATTRIBUTES (node->decl))
+	  || !DECL_ARTIFICIAL (node->decl))
+	continue;
+      vec_safe_push (v_funcs, node->decl);
+    }
+  /* Collect all omp-target global variables.  */
+  FOR_EACH_DEFINED_VARIABLE (vnode)
+    {
+      if (!lookup_attribute ("omp declare target",
+			     DECL_ATTRIBUTES (vnode->decl))
+	  || TREE_CODE (vnode->decl) != VAR_DECL
+	  || DECL_SIZE (vnode->decl) == 0)
+	continue;
+
+      vec_safe_push (v_vars, vnode->decl);
+    }
+  unsigned num_vars = vec_safe_length (v_vars);
+  unsigned num_funcs = vec_safe_length (v_funcs);
+
+  if (num_vars == 0 && num_funcs == 0)
+    return;
+
+#ifdef ACCEL_COMPILER
+  /* Decls are placed in reversed order in fat-objects, so we need to
+     revert them back if we compile target.  */
+  for (unsigned i = 0; i < num_funcs / 2; i++)
+    {
+      tree it = (*v_funcs)[i];
+      (*v_funcs)[i] = (*v_funcs)[num_funcs - i - 1];
+      (*v_funcs)[num_funcs - i - 1] = it;
+    }
+  for (unsigned i = 0; i < num_vars / 2; i++)
+    {
+      tree it = (*v_vars)[i];
+      (*v_vars)[i] = (*v_vars)[num_vars - i - 1];
+      (*v_vars)[num_vars - i - 1] = it;
+    }
+#endif
+
+  if (targetm_common.have_named_sections)
+    {
+      vec<constructor_elt, va_gc> *v_f, *v_v;
+      vec_alloc (v_f, num_funcs);
+      vec_alloc (v_v, num_vars * 2);
+
+      add_decls_addresses_to_decl_constructor (v_funcs, v_f);
+      add_decls_addresses_to_decl_constructor (v_vars, v_v);
+
+      tree vars_decl_type = build_array_type_nelts (pointer_sized_int_node,
+						    num_vars * 2);
+      tree funcs_decl_type = build_array_type_nelts (pointer_sized_int_node,
+						     num_funcs);
+      TYPE_ALIGN (vars_decl_type) = TYPE_ALIGN (pointer_sized_int_node);
+      TYPE_ALIGN (funcs_decl_type) = TYPE_ALIGN (pointer_sized_int_node);
+      tree ctor_v = build_constructor (vars_decl_type, v_v);
+      tree ctor_f = build_constructor (funcs_decl_type, v_f);
+      TREE_CONSTANT (ctor_v) = TREE_CONSTANT (ctor_f) = 1;
+      TREE_STATIC (ctor_v) = TREE_STATIC (ctor_f) = 1;
+      tree funcs_decl = build_decl (UNKNOWN_LOCATION, VAR_DECL,
+				    get_identifier (".omp_func_table"),
+				    funcs_decl_type);
+      tree vars_decl = build_decl (UNKNOWN_LOCATION, VAR_DECL,
+				   get_identifier (".omp_var_table"),
+				   vars_decl_type);
+      TREE_STATIC (funcs_decl) = TREE_STATIC (vars_decl) = 1;
+      DECL_INITIAL (funcs_decl) = ctor_f;
+      DECL_INITIAL (vars_decl) = ctor_v;
+      DECL_SECTION_NAME (funcs_decl)
+	= build_string (strlen (funcs_section_name), funcs_section_name);
+      DECL_SECTION_NAME (vars_decl)
+	= build_string (strlen (vars_section_name), vars_section_name);
+ 
+      varpool_assemble_decl (varpool_node_for_decl (vars_decl));
+      varpool_assemble_decl (varpool_node_for_decl (funcs_decl));
+   }
+  else
+    {
+      for (unsigned i = 0; i < num_funcs; i++)
+	{
+	  tree it = (*v_funcs)[i];
+	  targetm.record_offload_symbol (it);
+	}  
+      for (unsigned i = 0; i < num_funcs; i++)
+	{
+	  tree it = (*v_vars)[i];
+	  targetm.record_offload_symbol (it);
+	}  
+    }
+}
+
 #include "gt-omp-low.h"
Index: gomp-4_0-branch/gcc/omp-low.h
===================================================================
--- gomp-4_0-branch.orig/gcc/omp-low.h
+++ gomp-4_0-branch/gcc/omp-low.h
@@ -27,5 +27,6 @@ extern void omp_expand_local (basic_bloc
 extern void free_omp_regions (void);
 extern tree omp_reduction_init (tree, tree);
 extern bool make_gimple_omp_edges (basic_block, struct omp_region **, int *);
+extern void omp_finish_file (void);
 
 #endif /* GCC_OMP_LOW_H */
Index: gomp-4_0-branch/gcc/toplev.c
===================================================================
--- gomp-4_0-branch.orig/gcc/toplev.c
+++ gomp-4_0-branch/gcc/toplev.c
@@ -79,6 +79,7 @@ along with GCC; see the file COPYING3.
 #include "context.h"
 #include "pass_manager.h"
 #include "optabs.h"
+#include "omp-low.h"
 
 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
 #include "dbxout.h"
@@ -577,6 +578,8 @@ compile_file (void)
       if (flag_sanitize & SANITIZE_THREAD)
 	tsan_finish_file ();
 
+      omp_finish_file ();
+
       output_shared_constant_pool ();
       output_object_blocks ();
       finish_tm_clone_pairs ();
Index: gomp-4_0-branch/gcc/config.in
===================================================================
--- gomp-4_0-branch.orig/gcc/config.in
+++ gomp-4_0-branch/gcc/config.in
@@ -145,6 +145,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
Index: gomp-4_0-branch/gcc/configure.ac
===================================================================
--- gomp-4_0-branch.orig/gcc/configure.ac
+++ gomp-4_0-branch/gcc/configure.ac
@@ -845,6 +845,8 @@ AC_ARG_ENABLE(accelerator,
   case $enable_accelerator in
   no) ;;
   *)
+    AC_DEFINE(ENABLE_OFFLOADING, 1,
+     [Define this to enable support for offloading.])
     AC_DEFINE_UNQUOTED(ACCEL_TARGET,"${enable_accelerator}",
      [Define to the name of the OpenACC accelerator target.])
     ;;
Index: gomp-4_0-branch/libgcc/crtstuff.c
===================================================================
--- gomp-4_0-branch.orig/libgcc/crtstuff.c
+++ gomp-4_0-branch/libgcc/crtstuff.c
@@ -311,6 +311,15 @@ register_tm_clones (void)
 }
 #endif /* USE_TM_CLONE_REGISTRY */
 
+#if defined(HAVE_GAS_HIDDEN) && defined(ENABLE_OFFLOADING)
+void *_omp_func_table[0]
+  __attribute__ ((__used__, visibility ("protected"),
+		  section (".offload_func_table_section"))) = { };
+void *_omp_var_table[0]
+  __attribute__ ((__used__, visibility ("protected"),
+		  section (".offload_var_table_section"))) = { };
+#endif
+
 #if defined(INIT_SECTION_ASM_OP) || defined(INIT_ARRAY_SECTION_ASM_OP)
 
 #ifdef OBJECT_FORMAT_ELF
@@ -752,6 +761,23 @@ __do_global_ctors (void)
 #error "What are you doing with crtstuff.c, then?"
 #endif
 
+#if defined(HAVE_GAS_HIDDEN) && defined(ENABLE_OFFLOADING)
+void *_omp_funcs_end[0]
+  __attribute__ ((__used__, visibility ("protected"),
+		  section (".offload_func_table_section"))) = { };
+void *_omp_vars_end[0]
+  __attribute__ ((__used__, visibility ("protected"),
+		  section (".offload_var_table_section"))) = { };
+extern void *_omp_func_table[];
+extern void *_omp_var_table[];
+void *__OPENMP_TARGET__[] __attribute__ ((__visibility__ ("protected"))) =
+{
+  &_omp_func_table, &_omp_funcs_end,
+  &_omp_var_table, &_omp_vars_end
+};
+#endif
+
+
 #else /* ! CRT_BEGIN && ! CRT_END */
 #error "One of CRT_BEGIN or CRT_END must be defined."
 #endif
Index: gomp-4_0-branch/gcc/target.def
===================================================================
--- gomp-4_0-branch.orig/gcc/target.def
+++ gomp-4_0-branch/gcc/target.def
@@ -1772,6 +1772,14 @@ HOOK_VECTOR_END (vectorize)
 #undef HOOK_PREFIX
 #define HOOK_PREFIX "TARGET_"
 
+DEFHOOK
+(record_offload_symbol,
+ "Used when offloaded functions are seen in the compilation unit and no named\n\
+sections are available.  It is called once for each symbol that must be\n\
+recorded in the offload function and variable table.",
+ void, (tree),
+ hook_void_tree)
+
 /* Allow target specific overriding of option settings after options have
   been changed by an attribute or pragma or when it is reset at the
   end of the code affected by an attribute or pragma.  */
Index: gomp-4_0-branch/gcc/doc/tm.texi
===================================================================
--- gomp-4_0-branch.orig/gcc/doc/tm.texi
+++ gomp-4_0-branch/gcc/doc/tm.texi
@@ -11413,3 +11413,9 @@ If defined, this function returns an app
 @deftypefn {Target Hook} void TARGET_ATOMIC_ASSIGN_EXPAND_FENV (tree *@var{hold}, tree *@var{clear}, tree *@var{update})
 ISO C11 requires atomic compound assignments that may raise floating-point exceptions to raise exceptions corresponding to the arithmetic operation whose result was successfully stored in a compare-and-exchange sequence.  This requires code equivalent to calls to @code{feholdexcept}, @code{feclearexcept} and @code{feupdateenv} to be generated at appropriate points in the compare-and-exchange sequence.  This hook should set @code{*@var{hold}} to an expression equivalent to the call to @code{feholdexcept}, @code{*@var{clear}} to an expression equivalent to the call to @code{feclearexcept} and @code{*@var{update}} to an expression equivalent to the call to @code{feupdateenv}.  The three expressions are @code{NULL_TREE} on entry to the hook and may be left as @code{NULL_TREE} if no code is required in a particular place.  The default implementation leaves all three expressions as @code{NULL_TREE}.  The @code{__atomic_feraiseexcept} function from @code{libatomic} may be of use as part of the code generated in @code{*@var{update}}.
 @end deftypefn
+
+@deftypefn {Target Hook} void TARGET_RECORD_OFFLOAD_SYMBOL (tree)
+Used when offloaded functions are seen in the compilation unit and no named
+sections are available.  It is called once for each symbol that must be
+recorded in the offload function and variable table.
+@end deftypefn
Index: gomp-4_0-branch/gcc/doc/tm.texi.in
===================================================================
--- gomp-4_0-branch.orig/gcc/doc/tm.texi.in
+++ gomp-4_0-branch/gcc/doc/tm.texi.in
@@ -8409,3 +8409,5 @@ and the associated definitions of those
 @hook TARGET_ATOMIC_ALIGN_FOR_MODE
 
 @hook TARGET_ATOMIC_ASSIGN_EXPAND_FENV
+
+@hook TARGET_RECORD_OFFLOAD_SYMBOL

[-- Attachment #8: 007-gomp-register.diff --]
[-- Type: text/x-patch, Size: 1501 bytes --]

Index: libgomp/libgomp.map
===================================================================
--- libgomp/libgomp.map	(revision 207857)
+++ libgomp/libgomp.map	(working copy)
@@ -226,6 +226,7 @@ GOMP_4.0 {
 	GOMP_target_end_data;
 	GOMP_target_update;
 	GOMP_teams;
+	GOMP_offload_register;
 } GOMP_3.0;
 
 OACC_2.0 {
Index: libgomp/libgomp_g.h
===================================================================
--- libgomp/libgomp_g.h	(revision 207857)
+++ libgomp/libgomp_g.h	(working copy)
@@ -213,7 +213,8 @@ extern void GOMP_target_end_data (void);
 extern void GOMP_target_update (int, const void *,
 				size_t, void **, size_t *, unsigned char *);
 extern void GOMP_teams (unsigned int, unsigned int);
-
+extern void GOMP_offload_register (const void *, const char *,
+				   const void *, const void *, void *);
 /* oacc-parallel.c */
 
 extern void GOACC_parallel (int, void (*) (void *), const void *,
Index: libgomp/target.c
===================================================================
--- libgomp/target.c	(revision 207857)
+++ libgomp/target.c	(working copy)
@@ -714,6 +714,13 @@ gomp_target_init (void)
   gomp_find_available_plugins ();
 }
 
+void
+GOMP_offload_register (const void *target_id, const char *target_name,
+		       const void *func_mappings, const void *var_mappings,
+		       void *target_data)
+{
+}
+
 #else /* PLUGIN_SUPPORT */
 /* If dlfcn.h is unavailable we always fallback to host execution.
    GOMP_target* routines are just stubs for this case.  */

[-- Attachment #9: mkoffload.c --]
[-- Type: text/plain, Size: 21766 bytes --]

/* Offload image generation tool for ptx

   Nathan Sidwell <nathan@codesourcery.com>
   Bernd Schmidt <bernds@codesourcery.com>

   Munges PTX assembly into a C source file defining the PTX code as a
   string.

   This is not a complete assembler.  We presume the source is well
   formed from the compiler and can die horribly if it is not.  */

#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "intl.h"
#include <libgen.h>
#include "obstack.h"

#define COMMENT_PREFIX "#"

typedef enum Kind
{
  /* 0-ff used for single char tokens */
  K_symbol = 0x100, /* a symbol */
  K_label,  /* a label defn (i.e. symbol:) */
  K_ident,  /* other ident */
  K_dotted, /* dotted identifier */
  K_number,
  K_string,
  K_comment
} Kind;

typedef struct Token
{
  unsigned short kind : 12;
  unsigned short space : 1; /* preceded by space */
  unsigned short end : 1;   /* succeeded by end of line */
  /* Length of token */
  unsigned short len;

  /* Token itself */
  char const *ptr;
} Token;

/* statement info */
typedef enum Vis
{
  V_dot = 0,  /* random pseudo */
  V_var = 1,  /* var decl/defn */
  V_func = 2, /* func decl/defn */
  V_insn = 3, /* random insn */
  V_label = 4, /* label defn */
  V_comment = 5,
  V_pred = 6,  /* predicate */
  V_mask = 0x7,
  V_global = 0x08, /* globalize */
  V_weak = 0x10,   /* weakly globalize */
  V_no_eol = 0x20, /* no end of line */
  V_prefix_comment = 0x40 /* prefixed comment */
} Vis;

typedef struct Stmt
{
  struct Stmt *next;
  Token *tokens;
  unsigned char vis;
  unsigned len : 12;
  unsigned sym : 12;
} Stmt;

struct id_map
{
  id_map *next;
  char *ptx_name;
};

static const char *read_file (FILE *);
static Token *tokenize (const char *);

static void write_token (FILE *, const Token *);
static void write_tokens (FILE *, const Token *, unsigned, int);

static Stmt *alloc_stmt (unsigned, Token *, Token *, const Token *);
#define alloc_comment(S,E) alloc_stmt (V_comment, S, E, 0)
#define append_stmt(V, S) ((S)->next = *(V), *(V) = (S))
static Stmt *rev_stmts (Stmt *);
static void write_stmt (FILE *, const Stmt *);
static void write_stmts (FILE *, const Stmt *);

static Token *parse_insn (Token *);
static Token *parse_list_nosemi (Token *);
static Token *parse_init (Token *);
static Token *parse_file (Token *);

static Stmt *decls;
static Stmt *vars;
static Stmt *fns;

static id_map *func_ids, **funcs_tail = &func_ids;
static id_map *var_ids, **vars_tail = &var_ids;

int debug = 1;				/* true if -save-temps.  */
int verbose = 1;				/* true if -v.  */

static const char *args_name;

/* Add or change the value of an environment variable, outputting the
   change to standard error if in verbose mode.  */
static void
xputenv (const char *string)
{
  if (verbose)
    fprintf (stderr, "%s\n", string);
  putenv (CONST_CAST (char *, string));
}

static void maybe_unlink_file (const char *);

/* Delete tempfiles.  */

static void
lto_wrapper_cleanup (void)
{
  static bool cleanup_done = false;

  if (cleanup_done)
    return;

  /* Setting cleanup_done prevents an infinite loop if one of the
     calls to maybe_unlink_file fails. */
  cleanup_done = true;

  if (args_name)
    maybe_unlink_file (args_name);
}

/* Die when sys call fails. CMSGID is the error message.  */

static void __attribute__ ((format (printf, 1, 2)))
fatal_perror (const char *cmsgid, ...)
{
  int e = errno;
  va_list ap;

  va_start (ap, cmsgid);
  fprintf (stderr, "mkoffload: ");
  vfprintf (stderr, _(cmsgid), ap);
  fprintf (stderr, ": %s\n", xstrerror (e));
  va_end (ap);

  lto_wrapper_cleanup ();
  exit (FATAL_EXIT_CODE);
}

/* Just die. CMSGID is the error message. */

static void __attribute__ ((format (printf, 1, 2)))
fatal (const char * cmsgid, ...)
{
  va_list ap;

  va_start (ap, cmsgid);
  fprintf (stderr, "mkoffload: ");
  vfprintf (stderr, _(cmsgid), ap);
  fprintf (stderr, "\n");
  va_end (ap);

  exit (FATAL_EXIT_CODE);
}

/* Execute a program, and wait for the reply. ARGV are the arguments. The
   last one must be NULL. */

static struct pex_obj *
collect_execute (char **argv)
{
  struct pex_obj *pex;
  const char *errmsg;
  int err;

  if (verbose)
    {
      char **p_argv;
      const char *str;

      for (p_argv = argv; (str = *p_argv) != (char *) 0; p_argv++)
	fprintf (stderr, " %s", str);

      fprintf (stderr, "\n");
    }

  fflush (stdout);
  fflush (stderr);

  pex = pex_init (0, "mkoffload", NULL);
  if (pex == NULL)
    fatal_perror ("pex_init failed");

  /* Do not use PEX_LAST here, we use our stdout for communicating with
     collect2 or the linker-plugin.  Any output from the sub-process
     will confuse that.  */
  errmsg = pex_run (pex, PEX_SEARCH, argv[0], argv, NULL,
		    NULL, &err);
  if (errmsg != NULL)
    {
      if (err != 0)
	{
	  errno = err;
	  fatal_perror (errmsg);
	}
      else
	fatal (errmsg);
    }

  return pex;
}

/* Wait for a process to finish, and exit if a nonzero status is found.
   PROG is the program name. PEX is the process we should wait for. */

static int
collect_wait (const char *prog, struct pex_obj *pex)
{
  int status;

  if (!pex_get_status (pex, 1, &status))
    fatal_perror ("can't get program status");
  pex_free (pex);

  if (status)
    {
      if (WIFSIGNALED (status))
	{
	  int sig = WTERMSIG (status);
	  if (WCOREDUMP (status))
	    fatal ("%s terminated with signal %d [%s], core dumped",
		   prog, sig, strsignal (sig));
	  else
	    fatal ("%s terminated with signal %d [%s]",
		   prog, sig, strsignal (sig));
	}

      if (WIFEXITED (status))
	fatal ("%s returned %d exit status", prog, WEXITSTATUS (status));
    }

  return 0;
}

/* Unlink a temporary LTRANS file unless requested otherwise.  */

static void
maybe_unlink_file (const char *file)
{
  if (! debug)
    {
      if (unlink_if_ordinary (file)
	  && errno != ENOENT)
	fatal_perror ("deleting file %s", file);
    }
  else
    fprintf (stderr, "[Leaving %s]\n", file);
}

/* Execute program ARGV[0] with arguments ARGV. Wait for it to finish.  */

static void
fork_execute (char **argv)
{
  struct pex_obj *pex;
  char *new_argv[3];
  char *at_args;
  FILE *args;
  int status;

  args_name = make_temp_file (".args");
  at_args = concat ("@", args_name, NULL);
  args = fopen (args_name, "w");
  if (args == NULL)
    fatal ("failed to open %s", args_name);

  status = writeargv (&argv[1], args);

  if (status)
    fatal ("could not write to temporary file %s",  args_name);

  fclose (args);

  new_argv[0] = argv[0];
  new_argv[1] = at_args;
  new_argv[2] = NULL;

  pex = collect_execute (new_argv);
  collect_wait (new_argv[0], pex);

  maybe_unlink_file (args_name);
  args_name = NULL;
  free (at_args);
}

static void
record_id (const char *p1, id_map ***where)
{
  const char *end = strchr (p1, '\n');
  if (!end)
    fatal ("malformed ptx file");

  id_map *v = XNEW (id_map);
  size_t len = end - p1;
  v->ptx_name = XNEWVEC (char, len + 1);
  memcpy (v->ptx_name, p1, len);
  v->ptx_name[len] = '\0';
  v->next = NULL;
  id_map **tail = *where;
  *tail = v;
  *where = &v->next;
}

/* Read the whole input file.  It will be NUL terminated (but
   remember, there could be a NUL in the file itself.  */

static const char *
read_file (FILE *stream)
{
  size_t alloc = 16384;
  size_t base = 0;
  char *buffer;

  if (!fseek (stream, 0, SEEK_END))
    {
      /* Get the file size.  */
      long s = ftell (stream);
      if (s >= 0)
	alloc = s + 100;
      fseek (stream, 0, SEEK_SET);
    }
  buffer = XNEWVEC (char, alloc);

  for (;;)
    {
      size_t n = fread (buffer + base, 1, alloc - base - 1, stream);

      if (!n)
	break;
      base += n;
      if (base + 1 == alloc)
	{
	  alloc *= 2;
	  buffer = XRESIZEVEC (char, buffer, alloc);
	}
    }
  buffer[base] = 0;
  return buffer;
}

/* Read a token, advancing ptr.
   If we read a comment, append it to the comments block. */

static Token *
tokenize (const char *ptr)
{
  unsigned alloc = 1000;
  unsigned num = 0;
  Token *toks = XNEWVEC (Token, alloc);
  int in_comment = 0;
  int not_comment = 0;

  for (;; num++)
    {
      const char *base;
      unsigned kind;
      int ws = 0;
      int eol = 0;

    again:
      base = ptr;
      if (in_comment)
	goto block_comment;
      switch (kind = *ptr++)
	{
	default:
	  break;

	case '\n':
	  eol = 1;
	  /* Fall through */
	case ' ':
	case '\t':
	case '\r':
	case '\v':
	  /* White space */
	  ws = not_comment;
	  goto again;

	case '/':
	  {
	    if (*ptr == '/')
	      {
		/* line comment.  Do not include trailing \n */
		base += 2;
		for (; *ptr; ptr++)
		  if (*ptr == '\n')
		    break;
		kind = K_comment;
	      }
	    else if (*ptr == '*')
	      {
		/* block comment */
		base += 2;
		ptr++;

	      block_comment:
		eol = in_comment;
		in_comment = 1;
		for (; *ptr; ptr++)
		  {
		    if (*ptr == '\n')
		      {
			ptr++;
			break;
		      }
		    if (ptr[0] == '*' && ptr[1] == '/')
		      {
			in_comment = 2;
			ptr += 2;
			break;
		      }
		  }
		kind = K_comment;
	      }
	    else
	      break;
	  }
	  break;

	case '"':
	  /* quoted string */
	  kind = K_string;
	  while (*ptr)
	    if (*ptr == '"')
	      {
		ptr++;
		break;
	      }
	    else if (*ptr++ == '\\')
	      ptr++;
	  break;

	case '.':
	  if (*ptr < '0' || *ptr > '9')
	    {
	      kind = K_dotted;
	      ws = not_comment;
	      goto ident;
	    }
	  /* FALLTHROUGH */
	case '0'...'9':
	  kind = K_number;
	  goto ident;
	  break;

	case '$':  /* local labels.  */
	case '%':  /* register names, pseudoes etc */
	  kind = K_ident;
	  goto ident;

	case 'a'...'z':
	case 'A'...'Z':
	case '_':
	  kind = K_symbol; /* possible symbol name */
	ident:
	  for (; *ptr; ptr++)
	    {
	      if (*ptr >= 'A' && *ptr <= 'Z')
		continue;
	      if (*ptr >= 'a' && *ptr <= 'z')
		continue;
	      if (*ptr >= '0' && *ptr <= '9')
		continue;
	      if (*ptr == '_' || *ptr == '$')
		continue;
	      if (*ptr == '.' && kind != K_dotted)
		/* Idents starting with a dot, cannot have internal dots. */
		continue;
	      if ((*ptr == '+' || *ptr == '-')
		  && kind == K_number
		  && (ptr[-1] == 'e' || ptr[-1] == 'E'
		      || ptr[-1] == 'p' || ptr[-1] == 'P'))
		/* exponent */
		continue;
	      break;
	    }
	  if (*ptr == ':')
	    {
	      ptr++;
	      kind = K_label;
	    }
	  break;
	}

      if (alloc == num)
	{
	  alloc *= 2;
	  toks = XRESIZEVEC (Token, toks, alloc);
	}
      Token *tok = toks + num;

      tok->kind = kind;
      tok->space = ws;
      tok->end = 0;
      tok->ptr = base;
      tok->len = ptr - base - in_comment;
      in_comment &= 1;
      not_comment = kind != K_comment;
      if (eol && num)
	tok[-1].end = 1;
      if (!kind)
	break;
    }

  return toks;
}

/* Write an encoded token. */

static void
write_token (FILE *out, Token const *tok)
{
  if (tok->space)
    fputc (' ', out);

  switch (tok->kind)
    {
    case K_string:
      {
	const char *c = tok->ptr + 1;
	size_t len = tok->len - 2;

	fputs ("\\\"", out);
	while (len)
	  {
	    const char *bs = (const char *)memchr (c, '\\', len);
	    size_t l = bs ? bs - c : len;

	    fprintf (out, "%.*s", (int)l, c);
	    len -= l;
	    c += l;
	    if (bs)
	      {
		fputs ("\\\\", out);
		len--, c++;
	      }
	  }
	fputs ("\\\"", out);
      }
      break;

    default:
      /* All other tokens shouldn't have anything magic in them */
      fprintf (out, "%.*s", tok->len, tok->ptr);
      break;
    }
  if (tok->end)
    fputs ("\\n", out);
}

static void
write_tokens (FILE *out, Token const *toks, unsigned len, int spc)
{
  fputs ("\t\"", out);
  for (; len--; toks++)
    write_token (out, toks);
  if (spc)
    fputs (" ", out);
  fputs ("\"", out);
}

static Stmt *
alloc_stmt (unsigned vis, Token *tokens, Token *end, Token const *sym)
{
  static unsigned alloc = 0;
  static Stmt *heap = 0;

  if (!alloc)
    {
      alloc = 1000;
      heap = XNEWVEC (Stmt, alloc);
    }

  Stmt *stmt = heap++;
  alloc--;

  tokens->space = 0;
  stmt->next = 0;
  stmt->vis = vis;
  stmt->tokens = tokens;
  stmt->len = end - tokens;
  stmt->sym = sym ? sym - tokens : ~0;

  return stmt;
}

static Stmt *
rev_stmts (Stmt *stmt)
{
  Stmt *prev = 0;
  Stmt *next;

  while (stmt)
    {
      next = stmt->next;
      stmt->next = prev;
      prev = stmt;
      stmt = next;
    }

  return prev;
}

static void
write_stmt (FILE *out, const Stmt *stmt)
{
  if ((stmt->vis & V_mask) != V_comment)
    {
      write_tokens (out, stmt->tokens, stmt->len,
		    (stmt->vis & V_mask) == V_pred);
      fputs (stmt->vis & V_no_eol ? "\t" : "\n", out);
    }
}

static void
write_stmts (FILE *out, const Stmt *stmts)
{
  for (; stmts; stmts = stmts->next)
    write_stmt (out, stmts);
}

static Token *
parse_insn (Token *tok)
{
  unsigned depth = 0;

  do
    {
      Stmt *stmt;
      Token *sym = 0;
      unsigned s = V_insn;
      Token *start = tok;

      switch (tok++->kind)
	{
	case K_comment:
	  while (tok->kind == K_comment)
	    tok++;
	  stmt = alloc_comment (start, tok);
	  append_stmt (&fns, stmt);
	  continue;

	case '{':
	  depth++;
	  break;

	case '}':
	  depth--;
	  break;

	case K_label:
	  if (tok[-1].ptr[0] != '$')
	    sym = tok - 1;
	  tok[-1].end = 1;
	  s = V_label;
	  break;

	case '@':
	  tok->space = 0;
	  if (tok->kind == '!')
	    tok++;
	  if (tok->kind == K_symbol)
	    sym = tok;
	  tok++;
	  s = V_pred;
	  break;

	default:
	  for (; tok->kind != ';'; tok++)
	    {
	      if (tok->kind == ',')
		tok[1].space = 0;
	      else if (tok->kind == K_symbol)
		sym = tok;
	    }
	  tok++->end = 1;
	  break;
	}

      stmt = alloc_stmt (s, start, tok, sym);
      append_stmt (&fns, stmt);

      if (!tok[-1].end && tok[0].kind == K_comment)
	{
	  stmt->vis |= V_no_eol;
	  stmt = alloc_comment (tok, tok + 1);
	  append_stmt (&fns, stmt);
	  tok++;
	}
    }
  while (depth);

  return tok;
}

/* comma separated list of tokens */

static Token *
parse_list_nosemi (Token *tok)
{
  Token *start = tok;

  do
    if (!(++tok)->kind)
      break;
  while ((++tok)->kind == ',');

  tok[-1].end = 1;
  Stmt *stmt = alloc_stmt (V_dot, start, tok, 0);
  append_stmt (&decls, stmt);

  return tok;
}

#define is_keyword(T,S) \
  (sizeof (S) == (T)->len && !memcmp ((T)->ptr + 1, (S), (T)->len - 1))

static Token *
parse_init (Token *tok)
{
  for (;;)
    {
      Token *start = tok;
      Token const *sym = 0;
      Stmt *stmt;

      if (tok->kind == K_comment)
	{
	  while (tok->kind == K_comment)
	    tok++;
	  stmt = alloc_comment (start, tok);
	  append_stmt (&vars, stmt);
	  start = tok;
	}

      if (tok->kind == '{')
	tok[1].space = 0;
      for (; tok->kind != ',' && tok->kind != ';'; tok++)
	if (tok->kind == K_symbol)
	  sym = tok;
      tok[1].space = 0;
      int end = tok++->kind == ';';
      stmt = alloc_stmt (V_insn, start, tok, sym);
      append_stmt (&vars, stmt);
      if (!tok[-1].end && tok->kind == K_comment)
	{
	  stmt->vis |= V_no_eol;
	  stmt = alloc_comment (tok, tok + 1);
	  append_stmt (&vars, stmt);
	  tok++;
	}
      if (end)
	break;
    }
  return tok;
}

static Token *
parse_file (Token *tok)
{
  Stmt *comment = 0;

  if (tok->kind == K_comment)
    {
      Token *start = tok;

      while (tok->kind == K_comment)
	{
	  if (strncmp (tok->ptr, ":VAR_MAP ", 9) == 0)
	    record_id (tok->ptr + 9, &vars_tail);
	  if (strncmp (tok->ptr, ":FUNC_MAP ", 10) == 0)
	    record_id (tok->ptr + 10, &funcs_tail);
	  tok++;
	}
      comment = alloc_comment (start, tok);
      comment->vis |= V_prefix_comment;
    }

  if (tok->kind == K_dotted)
    {
      if (is_keyword (tok, "version")
	  || is_keyword (tok, "target")
	  || is_keyword (tok, "address_size"))
	{
	  if (comment)
	    append_stmt (&decls, comment);
	  tok = parse_list_nosemi (tok);
	}
      else
	{
	  unsigned vis = 0;
	  const Token *def = 0;
	  unsigned is_decl = 0;
	  Token *start;

	  for (start = tok;
	       tok->kind && tok->kind != '=' && tok->kind != K_comment
		 && tok->kind != '{' && tok->kind != ';'; tok++)
	    {
	      if (is_keyword (tok, "global"))
		vis |= V_var;
	      else if (is_keyword (tok, "func")
		       || is_keyword (tok, "entry"))
		vis |= V_func;
	      else if (is_keyword (tok, "visible"))
		vis |= V_global;
	      else if (is_keyword (tok, "extern"))
		is_decl = 1;
	      else if (is_keyword (tok, "weak"))
		vis |= V_weak;
	      if (tok->kind == '(')
		{
		  tok[1].space = 0;
		  tok[0].space = 1;
		}
	      else if (tok->kind == ')' && tok[1].kind != ';')
		tok[1].space = 1;

	      if (tok->kind == K_symbol)
		def = tok;
	    }

	  if (!tok->kind)
	    {
	      /* end of file */
	      if (comment)
		append_stmt (&fns, comment);
	    }
	  else if (tok->kind == '{'
		   || tok->kind == K_comment)
	    {
	      /* function defn */
	      Stmt *stmt = alloc_stmt (vis, start, tok, def);
	      if (comment)
		{
		  append_stmt (&fns, comment);
		  stmt->vis |= V_prefix_comment;
		}
	      append_stmt (&fns, stmt);
	      tok = parse_insn (tok);
	    }
	  else
	    {
	      int assign = tok->kind == '=';

	      tok++->end = 1;
	      if ((vis & V_mask) == V_var && !is_decl)
		{
		  /* variable */
		  Stmt *stmt = alloc_stmt (vis, start, tok, def);
		  if (comment)
		    {
		      append_stmt (&vars, comment);
		      stmt->vis |= V_prefix_comment;
		    }
		  append_stmt (&vars, stmt);
		  if (assign)
		    tok = parse_init (tok);
		}
	      else
		{
		  /* declaration */
		  Stmt *stmt = alloc_stmt (vis, start, tok, 0);
		  if (comment)
		    {
		      append_stmt (&decls, comment);
		      stmt->vis |= V_prefix_comment;
		    }
		  append_stmt (&decls, stmt);
		}
	    }
	}
    }
  else
    {
      /* Something strange.  Ignore it.  */
      if (comment)
	append_stmt (&fns, comment);

      while (tok->kind && !tok->end)
	tok++;
    }
  return tok;
}

static void
process (FILE *in, FILE *out)
{
  const char *input = read_file (in);
  Token *tok = tokenize (input);

  do
    tok = parse_file (tok);
  while (tok->kind);

  fprintf (out, "static const char ptx_code[] = \n");
  write_stmts (out, rev_stmts (decls));
  write_stmts (out, rev_stmts (vars));
  write_stmts (out, rev_stmts (fns));
  fprintf (out, ";\n\n");
  fprintf (out, "static const char *var_mappings[] = {\n");
  for (id_map *id = var_ids; id; id = id->next)
    fprintf (out, "\t\"%s\"%s\n", id->ptx_name, id->next ? "," : "");
  fprintf (out, "};\n\n");
  fprintf (out, "static const char *func_mappings[] = {\n");
  for (id_map *id = func_ids; id; id = id->next)
    fprintf (out, "\t\"%s\"%s\n", id->ptx_name, id->next ? "," : "");
  fprintf (out, "};\n\n");

  fprintf (out, "extern void GOMP_offload_register (const void *, const char *,\n");
  fprintf (out, "				    void *, void *, void *);\n");

  fprintf (out, "extern void *__OPENMP_TARGET__[];\n\n");
  fprintf (out, "static __attribute__((constructor)) void init (void)\n{\n");
  fprintf (out, "  GOMP_offload_register (__OPENMP_TARGET__, \"nvptx\",\n");
  fprintf (out, "                         func_mappings, var_mappings, &ptx_code);\n");
  fprintf (out, "};\n");
}

static void
compile_native (const char *infile, const char *outfile, const char *compiler)
{
  struct obstack argv_obstack;
  obstack_init (&argv_obstack);
  obstack_ptr_grow (&argv_obstack, compiler);
  obstack_ptr_grow (&argv_obstack, infile);
  obstack_ptr_grow (&argv_obstack, "-c");
  obstack_ptr_grow (&argv_obstack, "-o");
  obstack_ptr_grow (&argv_obstack, outfile);

  const char **new_argv = XOBFINISH (&argv_obstack, const char **);
  fork_execute (CONST_CAST (char **, new_argv));
  obstack_free (&argv_obstack, NULL);
}

int
main (int argc, char **argv)
{
  FILE *in = stdin;
  FILE *out = stdout;
  const char *outname = 0;

  char *collect_gcc = getenv ("COLLECT_GCC");
  if (collect_gcc == NULL)
    fatal ("COLLECT_GCC must be set.");
  const char *gcc_path = dirname (ASTRDUP (collect_gcc));
  fprintf (stderr, "COLLECT_GCC is %s\n", collect_gcc);

  size_t len = (strlen (DEFAULT_REAL_TARGET_MACHINE)
		+ strlen (DEFAULT_TARGET_MACHINE)
		+ strlen ("-accel--gcc") + 1
		+ strlen (gcc_path) + 1);
  char *driver = XALLOCAVEC (char, len);
  sprintf (driver, "%s/%s-accel-%s-gcc", gcc_path,
	   DEFAULT_REAL_TARGET_MACHINE, DEFAULT_TARGET_MACHINE);

  /* We may be called with all the arguments stored in some file and
     passed with @file.  Expand them into argv before processing.  */
  expandargv (&argc, &argv);

  struct obstack argv_obstack;
  obstack_init (&argv_obstack);
  obstack_ptr_grow (&argv_obstack, driver);
  obstack_ptr_grow (&argv_obstack, "-xlto");
  obstack_ptr_grow (&argv_obstack, "-m64");
  obstack_ptr_grow (&argv_obstack, "-S");

  for (int ix = 1; ix != argc; ix++)
    {
      if (!strcmp (argv[ix], "-o") && ix + 1 != argc)
	outname = argv[++ix];
      else
	obstack_ptr_grow (&argv_obstack, argv[ix]);
    }
  const char *tempfile = make_temp_file (".mkoffload");
  obstack_ptr_grow (&argv_obstack, "-o");
  obstack_ptr_grow (&argv_obstack, tempfile);
  const char **new_argv = XOBFINISH (&argv_obstack, const char **);

  char *execpath = getenv ("GCC_EXEC_PREFIX");
  char *cpath = getenv ("COMPILER_PATH");
  char *lpath = getenv ("LIBRARY_PATH");
  unsetenv ("GCC_EXEC_PREFIX");
  unsetenv ("COMPILER_PATH");
  unsetenv ("LIBRARY_PATH");

  fork_execute (CONST_CAST (char **, new_argv));
  obstack_free (&argv_obstack, NULL);

  xputenv (concat ("GCC_EXEC_PREFIX=", execpath, NULL));
  xputenv (concat ("COMPILER_PATH=", cpath, NULL));
  xputenv (concat ("LIBRARY_PATH=", lpath, NULL));

  in = fopen (tempfile, "r");
  if (!in)
    fatal ("cannot open intermediate ptx file");

  const char *ptx_cfile = make_temp_file (".c");

  out = fopen (ptx_cfile, "w");
  if (!out)
    fatal ("cannot open '%s'", ptx_cfile);

  process (in, out);
  fclose (out);

  compile_native (ptx_cfile, outname, collect_gcc);

  return 0;
}

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-02-20 18:27             ` Bernd Schmidt
@ 2014-02-21 15:17               ` Ilya Verbin
  2014-02-21 15:41                 ` Bernd Schmidt
  2014-02-28 16:09               ` Ilya Verbin
  1 sibling, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-02-21 15:17 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Thomas Schwinge, Michael V. Zolotukhin, Jakub Jelinek,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

2014-02-20 22:27 GMT+04:00 Bernd Schmidt <bernds@codesourcery.com>:
> There were still a number of things in these patches that did not make sense
> to me and which I've changed. Let me know if there was a good reason for the
> way some of these things were originally done.
>  * Functions and variables now go into different tables, otherwise
>    intermixing between them could be a problem that causes tables to
>    go out of sync between host and target (imagine one big table being
>    generated by ptx lto1/mkoffload, and multiple small table fragments
>    being linked together on the host side).

What do you mean by multiple small table fragments?
The tables from every object file should be joined together while
linking DSO in the same order for both host and target.
If you need to join tables from multiple target images into one big
table, the host tables also should be joined in the same order. In our
case we're obtaining each target table while loading the image to
target device, and merging it with a corresponding host table.
How splitting functions and global vars into 2 tables will help to
avoid intermixing?

>  * Is there a reason to call a register function for the host tables?
>    The way I've set it up, we register a target function/variable table
>    while also passing a pointer to the __OPENMP_TARGET__ symbol which
>    holds information about the host side tables.

Suppose there is liba, that depends on libb, that depends on libc.
Also corresponding target image tgtimga depends on tgtimgb, that
depends on tgtimgc. When liba is going to start offloaded function, it
calls GOMP_target with a pointer to its descriptor, which contains a
pointer to tgtimga. But how does GOMP_target know that it should also
load tgtimgb and tgtimgc to target? And where to get their descriptors
from?
That's why we have added host-side DSO registration. In this example
they are loaded on host in the following order: libc, libb, liba. In
the same order they are registered in libgomp, and loaded to target
device while initialization. In the same order the tables received
from target are merged with the host tables from the descriptors.

> I'm appending those parts of my current patch kit that seem relevant. This
> includes the ptx mkoffload tool and a patch to make a dummy
> GOMP_offload_register function. Most of the others are updated versions of
> patches I've posted before, and two adapted from Michael Zolotukhin's set
> (automatically generated files not included in the diffs for size reasons).
> How does this look?

I will take a closer look at you changes, try to run it, and send
feedback next week.

  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-02-21 15:17               ` Ilya Verbin
@ 2014-02-21 15:41                 ` Bernd Schmidt
  2014-02-21 18:00                   ` Ilya Verbin
  0 siblings, 1 reply; 62+ messages in thread
From: Bernd Schmidt @ 2014-02-21 15:41 UTC (permalink / raw)
  To: Ilya Verbin
  Cc: Thomas Schwinge, Michael V. Zolotukhin, Jakub Jelinek,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

On 02/21/2014 04:17 PM, Ilya Verbin wrote:
> 2014-02-20 22:27 GMT+04:00 Bernd Schmidt <bernds@codesourcery.com>:
>> There were still a number of things in these patches that did not make sense
>> to me and which I've changed. Let me know if there was a good reason for the
>> way some of these things were originally done.
>>   * Functions and variables now go into different tables, otherwise
>>     intermixing between them could be a problem that causes tables to
>>     go out of sync between host and target (imagine one big table being
>>     generated by ptx lto1/mkoffload, and multiple small table fragments
>>     being linked together on the host side).
>
> What do you mean by multiple small table fragments?

Well, suppose you have file1.o and file2.o compiled for the host with a 
.offload_func_table_section in each, and they get linked together - each 
provides a fragment of the whole table.

> The tables from every object file should be joined together while
> linking DSO in the same order for both host and target.
> If you need to join tables from multiple target images into one big
> table, the host tables also should be joined in the same order.

The problem is that ptx does not have a linker, so we cannot exactly 
reproduce what happens on the host side. We have to process all host .o 
files in one single invocation of ptx lto1, and produce a single ptx 
assembly file, with a single function/variable table, from there. Having 
functions and variables separated gives us at least a small chance that 
the order will match that found in the host tables if the host table is 
produced by linking multiple fragments.

> Suppose there is liba, that depends on libb, that depends on libc.

What kind of dependencies between liba and libb do you expect to be able 
to support on the target side? References to each other's functions and 
variables?


Bernd

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-02-21 15:41                 ` Bernd Schmidt
@ 2014-02-21 18:00                   ` Ilya Verbin
  0 siblings, 0 replies; 62+ messages in thread
From: Ilya Verbin @ 2014-02-21 18:00 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Thomas Schwinge, Michael V. Zolotukhin, Jakub Jelinek,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

2014-02-21 19:41 GMT+04:00 Bernd Schmidt <bernds@codesourcery.com>:
> The problem is that ptx does not have a linker, so we cannot exactly
> reproduce what happens on the host side. We have to process all host .o
> files in one single invocation of ptx lto1, and produce a single ptx
> assembly file, with a single function/variable table, from there. Having
> functions and variables separated gives us at least a small chance that the
> order will match that found in the host tables if the host table is produced
> by linking multiple fragments.

If ptx lto1 will process all .o files in order as they were passed to
it, the resulting table should be consistent with the table produced
by host's lto1.

> What kind of dependencies between liba and libb do you expect to be able to
> support on the target side? References to each other's functions and
> variables?

Yes, references to global variables and calls to functions, marked
with "omp declare target".

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-02-20 18:27             ` Bernd Schmidt
  2014-02-21 15:17               ` Ilya Verbin
@ 2014-02-28 16:09               ` Ilya Verbin
  2014-02-28 16:23                 ` Bernd Schmidt
  1 sibling, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-02-28 16:09 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Thomas Schwinge, Michael V. Zolotukhin, Jakub Jelinek,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

2014-02-20 22:27 GMT+04:00 Bernd Schmidt <bernds@codesourcery.com>:
>  * Functions and variables now go into different tables, otherwise
>    intermixing between them could be a problem that causes tables to
>    go out of sync between host and target (imagine one big table being
>    generated by ptx lto1/mkoffload, and multiple small table fragments
>    being linked together on the host side).

If you need 2 different tables for funcs and vars, we can also use
them. But I still don't understand how it will help synchronization
between host and target tables.

>  * I've put the begin/end fragments for the host tables into crtstuff,
>    which seems like the standard way of doing things.

Our plan was that the host side descriptor __OPENMP_TARGET__ will
contain (in addition to func/var table) pointers to the images for all
enabled accelerators (e.g. omp_image_nvptx_start and
omp_image_intelmic_start), therefore we generated it in the
lto-wrapper. But if the number of accelerators and their types/names
will be defined during configuration, then it's ok to generate the
descriptor in crtstuff.

>  * Is there a reason to call a register function for the host tables?
>    The way I've set it up, we register a target function/variable table
>    while also passing a pointer to the __OPENMP_TARGET__ symbol which
>    holds information about the host side tables.

In our case we can't register target table with a call to libgomp, it
can be obtained only from the accelerator. Therefore we propose a
target-independent approach: during device initialization libgomp
calls 2 functions from the plugin (or this can be implemented by a
single function):
1. devicep->device_load_image_func, which will load target image (its
pointer will be taken from the host descriptor);
2. devicep->device_get_table_func, which in our case connects to the
device and receives its table. And in your case it will return
func_mappings and var_mappings. Will it work for you?

>  * An offload compiler is built with --enable-as-accelerator-for=, which
>    eliminates the need for -fopenmp-target, and changes install paths so
>    that the host compiler knows where to find it. No need for
>    OFFLOAD_TARGET_COMPILERS anymore.

Unfortunately I don't fully understand this configure magic... When a
user specifies 2 or 3 accelerators during configuration with
--enable-accelerators, will several different accel-gccs be built?

Thanks,
  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-02-28 16:09               ` Ilya Verbin
@ 2014-02-28 16:23                 ` Bernd Schmidt
  2014-02-28 21:41                   ` Bernd Schmidt
                                     ` (3 more replies)
  0 siblings, 4 replies; 62+ messages in thread
From: Bernd Schmidt @ 2014-02-28 16:23 UTC (permalink / raw)
  To: Ilya Verbin
  Cc: Thomas Schwinge, Michael V. Zolotukhin, Jakub Jelinek,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

On 02/28/2014 05:09 PM, Ilya Verbin wrote:
> 2014-02-20 22:27 GMT+04:00 Bernd Schmidt <bernds@codesourcery.com>:
>>   * Functions and variables now go into different tables, otherwise
>>     intermixing between them could be a problem that causes tables to
>>     go out of sync between host and target (imagine one big table being
>>     generated by ptx lto1/mkoffload, and multiple small table fragments
>>     being linked together on the host side).
>
> If you need 2 different tables for funcs and vars, we can also use
> them. But I still don't understand how it will help synchronization
> between host and target tables.

I think it won't help that much - I still think this entire scheme is 
likely to fail on nvptx. I'll try to construct an example at some point.

One other thing about the split tables is that we don't have to write a 
useless size of 1 for functions.

>>   * I've put the begin/end fragments for the host tables into crtstuff,
>>     which seems like the standard way of doing things.
>
> Our plan was that the host side descriptor __OPENMP_TARGET__ will
> contain (in addition to func/var table) pointers to the images for all
> enabled accelerators (e.g. omp_image_nvptx_start and
> omp_image_intelmic_start), therefore we generated it in the
> lto-wrapper.

The concept of "image" is likely to vary somewhat between accelerators. 
For ptx, it's just a string and it can't really be generated the same 
way as for your target where you can manipulate ELF images. So I think 
it is better to have a call to a gomp registration function for every 
offload target. That should also give you the ordering you said you 
wanted between shared libraries.

>>   * Is there a reason to call a register function for the host tables?
>>     The way I've set it up, we register a target function/variable table
>>     while also passing a pointer to the __OPENMP_TARGET__ symbol which
>>     holds information about the host side tables.
>
> In our case we can't register target table with a call to libgomp, it
> can be obtained only from the accelerator. Therefore we propose a
> target-independent approach: during device initialization libgomp
> calls 2 functions from the plugin (or this can be implemented by a
> single function):
> 1. devicep->device_load_image_func, which will load target image (its
> pointer will be taken from the host descriptor);
> 2. devicep->device_get_table_func, which in our case connects to the
> device and receives its table. And in your case it will return
> func_mappings and var_mappings. Will it work for you?

Probably. I think the constructor call to the gomp registration function 
would contain an opaque pointer to whatever data the target wants, so it 
can arrange its image/table data in whatever way it likes.

It would help to see the code you have on the libgomp side, I don't 
believe that's been posted yet?

> Unfortunately I don't fully understand this configure magic... When a
> user specifies 2 or 3 accelerators during configuration with
> --enable-accelerators, will several different accel-gccs be built?

No - the idea is that --enable-accelerator= is likely specific to ptx, 
where we really just want to build a gcc and no target libraries, so 
building it alongside the host in an accel-gcc subdirectory is ideal.

For your use case, I'd imagine the offload compiler would be built 
relatively normally as a full build with 
"--enable-as-accelerator-for=x86_64-linux", which would install it into 
locations where the host will eventually be able to find it. Then the 
host compiler would be built with another new configure option (as yet 
unimplemented in my patch set) "--enable-offload-targets=mic,..." which 
would tell the host compiler about the pre-built offload target 
compilers. On the ptx side, "--enable-accelerator=ptx" would then also 
add ptx to the list of --enable-offload-targets.
Naming of all these configure options can be discussed, I have no real 
preference for any of them.


Bernd

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-02-28 16:23                 ` Bernd Schmidt
@ 2014-02-28 21:41                   ` Bernd Schmidt
  2014-05-27 10:18                     ` Ilya Verbin
  2014-02-28 22:10                   ` Ilya Verbin
                                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 62+ messages in thread
From: Bernd Schmidt @ 2014-02-28 21:41 UTC (permalink / raw)
  To: Ilya Verbin
  Cc: Thomas Schwinge, Michael V. Zolotukhin, Jakub Jelinek,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

[-- Attachment #1: Type: text/plain, Size: 1409 bytes --]

On 02/28/2014 05:21 PM, Bernd Schmidt wrote:
> On 02/28/2014 05:09 PM, Ilya Verbin wrote:
>> Unfortunately I don't fully understand this configure magic... When a
>> user specifies 2 or 3 accelerators during configuration with
>> --enable-accelerators, will several different accel-gccs be built?
>
> No - the idea is that --enable-accelerator= is likely specific to ptx,
> where we really just want to build a gcc and no target libraries, so
> building it alongside the host in an accel-gcc subdirectory is ideal.
>
> For your use case, I'd imagine the offload compiler would be built
> relatively normally as a full build with
> "--enable-as-accelerator-for=x86_64-linux", which would install it into
> locations where the host will eventually be able to find it. Then the
> host compiler would be built with another new configure option (as yet
> unimplemented in my patch set) "--enable-offload-targets=mic,..." which
> would tell the host compiler about the pre-built offload target
> compilers. On the ptx side, "--enable-accelerator=ptx" would then also
> add ptx to the list of --enable-offload-targets.
> Naming of all these configure options can be discussed, I have no real
> preference for any of them.

IOW, something like the following on top of the other patches. Ideally 
we'd also add error checking to make sure the offload compilers exist in 
the places we'll be looking for them.


Bernd


[-- Attachment #2: targnames.diff --]
[-- Type: text/x-patch, Size: 5220 bytes --]

Index: gomp-4_0-branch/gcc/config.in
===================================================================
--- gomp-4_0-branch.orig/gcc/config.in
+++ gomp-4_0-branch/gcc/config.in
@@ -1748,6 +1748,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
Index: gomp-4_0-branch/gcc/configure
===================================================================
--- gomp-4_0-branch.orig/gcc/configure
+++ gomp-4_0-branch/gcc/configure
@@ -908,6 +908,7 @@ with_bugurl
 enable_languages
 enable_accelerator
 enable_as_accelerator_for
+enable_offload_targets
 with_multilib_list
 enable_rpath
 with_libiconv_prefix
@@ -1618,6 +1619,8 @@ Optional Features:
   --enable-accelerator    build accelerator [ARG={no,device-triplet}]
   --enable-as-accelerator-for
                           build compiler as accelerator target for given host
+  --enable-offload-targets=LIST
+                          enable offloading to devices from LIST
   --disable-rpath         do not hardcode runtime library paths
   --enable-sjlj-exceptions
                           arrange to use setjmp/longjmp exception handling
@@ -7299,12 +7302,14 @@ else
 fi
 
 
+offload_targets=
 # Check whether --enable-accelerator was given.
 if test "${enable_accelerator+set}" = set; then :
   enableval=$enable_accelerator;
   case $enable_accelerator in
   no) ;;
   *)
+    offload_targets=$enable_accelerator
 
 $as_echo "#define ENABLE_OFFLOADING 1" >>confdefs.h
 
@@ -7343,6 +7348,31 @@ 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
+  else
+    if test x$offload_targets = x; then
+      offload_targets=$enable_offload_targets
+    else
+      offload_targets=$offload_targets,$enable_offload_targets
+    fi
+  fi
+
+else
+  enable_accelerator=no
+fi
+
+
+offload_targets=`echo $offload_targets | sed -e 's#,#:#'`
+
+cat >>confdefs.h <<_ACEOF
+#define OFFLOAD_TARGETS "$offload_targets"
+_ACEOF
+
+
 
 # Check whether --with-multilib-list was given.
 if test "${with_multilib_list+set}" = set; then :
@@ -17983,7 +18013,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17986 "configure"
+#line 18016 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18089,7 +18119,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18092 "configure"
+#line 18122 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
Index: gomp-4_0-branch/gcc/configure.ac
===================================================================
--- gomp-4_0-branch.orig/gcc/configure.ac
+++ gomp-4_0-branch/gcc/configure.ac
@@ -839,12 +839,14 @@ AC_ARG_ENABLE(languages,
 esac],
 [enable_languages=c])
 
+offload_targets=
 AC_ARG_ENABLE(accelerator,
 [AS_HELP_STRING([--enable-accelerator], [build accelerator @<:@ARG={no,device-triplet}@:>@])],
 [
   case $enable_accelerator in
   no) ;;
   *)
+    offload_targets=$enable_accelerator
     AC_DEFINE(ENABLE_OFFLOADING, 1,
      [Define this to enable support for offloading.])
     AC_DEFINE_UNQUOTED(ACCEL_TARGET,"${enable_accelerator}",
@@ -871,6 +873,25 @@ AC_ARG_ENABLE(as-accelerator-for,
 ], [enable_as_accelerator=no])
 AC_SUBST(enable_as_accelerator)
 
+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])
+  else
+    if test x$offload_targets = x; then
+      offload_targets=$enable_offload_targets
+    else
+      offload_targets=$offload_targets,$enable_offload_targets
+    fi
+  fi
+], [enable_accelerator=no])
+AC_SUBST(enable_accelerator)
+offload_targets=`echo $offload_targets | sed -e 's#,#:#'`
+AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
+ [Define to hold the list of target names suitable for offloading.])
+
 AC_ARG_WITH(multilib-list,
 [AS_HELP_STRING([--with-multilib-list], [select multilibs (AArch64, SH and x86-64 only)])],
 :,
Index: gomp-4_0-branch/gcc/gcc.c
===================================================================
--- gomp-4_0-branch.orig/gcc/gcc.c
+++ gomp-4_0-branch/gcc/gcc.c
@@ -6687,6 +6687,16 @@ main (int argc, char **argv)
   obstack_grow (&collect_obstack, argv[0], strlen (argv[0]) + 1);
   xputenv (XOBFINISH (&collect_obstack, char *));
 
+  if (strlen (OFFLOAD_TARGETS) > 0)
+    {
+      obstack_init (&collect_obstack);
+      obstack_grow (&collect_obstack, "OFFLOAD_TARGET_NAMES=",
+		    sizeof ("OFFLOAD_TARGET_NAMES=") - 1);
+      obstack_grow (&collect_obstack, OFFLOAD_TARGETS,
+		    strlen (OFFLOAD_TARGETS) + 1);
+      xputenv (XOBFINISH (&collect_obstack, char *));
+    }
+
   /* Set up to remember the pathname of the lto wrapper. */
 
   if (have_c)

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-02-28 16:23                 ` Bernd Schmidt
  2014-02-28 21:41                   ` Bernd Schmidt
@ 2014-02-28 22:10                   ` Ilya Verbin
  2014-03-05 17:15                   ` Ilya Verbin
  2014-06-17 18:20                   ` Ilya Verbin
  3 siblings, 0 replies; 62+ messages in thread
From: Ilya Verbin @ 2014-02-28 22:10 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Thomas Schwinge, Michael V. Zolotukhin, Jakub Jelinek,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

On 28 Feb 17:21, Bernd Schmidt wrote:
> It would help to see the code you have on the libgomp side, I don't
> believe that's been posted yet?

It was posted here: http://gcc.gnu.org/ml/gcc-patches/2013-12/msg01777.html
And below is the updated version.

---
 libgomp/libgomp.map |    1 +
 libgomp/target.c    |  138 ++++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 132 insertions(+), 7 deletions(-)

diff --git a/libgomp/libgomp.map b/libgomp/libgomp.map
index cb52e45..d33673d 100644
--- a/libgomp/libgomp.map
+++ b/libgomp/libgomp.map
@@ -208,6 +208,7 @@ GOMP_3.0 {
 
 GOMP_4.0 {
   global:
+	GOMP_register_lib;
 	GOMP_barrier_cancel;
 	GOMP_cancel;
 	GOMP_cancellation_point;
diff --git a/libgomp/target.c b/libgomp/target.c
index a6a5505..7fafa9a 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -84,6 +84,19 @@ struct splay_tree_key_s {
   bool copy_from;
 };
 
+enum library_descr {
+  DESCR_TABLE_START,
+  DESCR_TABLE_END,
+  DESCR_IMAGE_START,
+  DESCR_IMAGE_END
+};
+
+/* Array of pointers to target shared library descriptors.  */
+static void **libraries;
+
+/* Total number of target shared libraries.  */
+static int num_libraries;
+
 /* Array of descriptors of all available devices.  */
 static struct gomp_device_descr *devices;
 
@@ -107,6 +120,12 @@ splay_compare (splay_tree_key x, splay_tree_key y)
 
 #include "splay-tree.h"
 
+struct target_table_s
+{
+  void **entries;
+  int num_entries;
+};
+
 /* This structure describes accelerator device.
    It contains name of the corresponding libgomp plugin, function handlers for
    interaction with the device, ID-number of the device, and information about
@@ -117,15 +136,21 @@ struct gomp_device_descr
      TARGET construct.  */
   int id;
 
+  /* Set to true when device is initialized.  */
+  bool is_initialized;
+
   /* Plugin file handler.  */
   void *plugin_handle;
 
   /* Function handlers.  */
-  bool (*device_available_func) (void);
+  bool (*device_available_func) (int);
+  void (*device_init_func) (int);
+  struct target_table_s (*device_load_image_func) (void *, int);
   void *(*device_alloc_func) (size_t);
   void (*device_free_func) (void *);
   void *(*device_dev2host_func)(void *, const void *, size_t);
   void *(*device_host2dev_func)(void *, const void *, size_t);
+  void (*device_run_func) (void *, void *);
 
   /* Splay tree containing information about mapped memory regions.  */
   struct splay_tree_s dev_splay_tree;
@@ -471,6 +496,80 @@ gomp_update (struct gomp_device_descr *devicep, size_t mapnum,
   gomp_mutex_unlock (&devicep->dev_env_lock);
 }
 
+void
+GOMP_register_lib (const void *openmp_target)
+{
+  libraries = realloc (libraries, (num_libraries + 1) * sizeof (void *));
+
+  if (libraries == NULL)
+    return;
+
+  libraries[num_libraries] = (void *) openmp_target;
+
+  num_libraries++;
+}
+
+static void
+gomp_init_device (struct gomp_device_descr *devicep)
+{
+  /* Initialize the target device.  */
+  devicep->device_init_func (devicep->id);
+
+  /* Load shared libraries into target device and
+     perform host-target address mapping.  */
+  int i;
+  for (i = 0; i < num_libraries; i++)
+    {
+      /* Get the pointer to the target image from the library descriptor.  */
+      void **lib = libraries[i];
+
+      /* FIXME: Select the proper target image, if there are several.  */
+      void *target_image = lib[DESCR_IMAGE_START];
+      int target_img_size = lib[DESCR_IMAGE_END] - lib[DESCR_IMAGE_START];
+
+      /* Calculate the size of host address table.  */
+      void **host_table_start = lib[DESCR_TABLE_START];
+      void **host_table_end = lib[DESCR_TABLE_END];
+      int host_table_size = host_table_end - host_table_start;
+
+      /* Load library into target device and receive its address table.  */
+      struct target_table_s target_table
+	= devicep->device_load_image_func (target_image, target_img_size);
+
+      if (host_table_size != target_table.num_entries)
+	gomp_fatal ("Can't map target objects");
+
+      void **host_entry, **target_entry;
+      for (host_entry = host_table_start, target_entry = target_table.entries;
+	   host_entry < host_table_end; host_entry += 2, target_entry += 2)
+	{
+	  struct target_mem_desc *tgt = gomp_malloc (sizeof (*tgt));
+	  tgt->refcount = 1;
+	  tgt->array = gomp_malloc (sizeof (*tgt->array));
+	  tgt->tgt_start = (uintptr_t) *target_entry;
+	  tgt->tgt_end = tgt->tgt_start + *((uint64_t *) target_entry + 1);
+	  tgt->to_free = NULL;
+	  tgt->list_count = 0;
+	  tgt->device_descr = devicep;
+	  splay_tree_node node = tgt->array;
+	  splay_tree_key k = &node->key;
+	  k->host_start = (uintptr_t) *host_entry;
+	  k->host_end = k->host_start + *((uint64_t *) host_entry + 1);
+	  k->tgt_offset = 0;
+	  k->tgt = tgt;
+	  node->left = NULL;
+	  node->right = NULL;
+	  splay_tree_insert (&devicep->dev_splay_tree, node);
+	}
+
+      free (target_table.entries);
+    }
+
+  free (libraries);
+  num_libraries = 0;
+  devicep->is_initialized = true;
+}
+
 /* Called when encountering a target directive.  If DEVICE
    is -1, it means use device-var ICV.  If it is -2 (or any other value
    larger than last available hw device, use host fallback.
@@ -487,7 +586,8 @@ GOMP_target (int device, void (*fn) (void *), const void *openmp_target,
 	     unsigned char *kinds)
 {
   struct gomp_device_descr *devicep = resolve_device (device);
-  if (devicep == NULL)
+  if (openmp_target == NULL || devicep == NULL
+      || !devicep->device_available_func (devicep->id))
     {
       /* Host fallback.  */
       struct gomp_thread old_thr, *thr = gomp_thread ();
@@ -504,7 +604,18 @@ GOMP_target (int device, void (*fn) (void *), const void *openmp_target,
       return;
     }
 
-  struct target_mem_desc *tgt
+  if (!devicep->is_initialized)
+    gomp_init_device (devicep);
+
+  splay_tree_node node = gomp_malloc (sizeof (*node));
+  splay_tree_key k = &node->key;
+  k->host_start = (uintptr_t) fn;
+  k->host_end = k->host_start + 1;
+  splay_tree_key tgt_fn = splay_tree_lookup (&devicep->dev_splay_tree, k);
+  if (tgt_fn == NULL)
+    gomp_fatal ("Target function wasn't mapped");
+
+  struct target_mem_desc *tgt_vars
     = gomp_map_vars (devicep, mapnum, hostaddrs, sizes, kinds, true);
   struct gomp_thread old_thr, *thr = gomp_thread ();
   old_thr = *thr;
@@ -514,10 +625,11 @@ GOMP_target (int device, void (*fn) (void *), const void *openmp_target,
       thr->place = old_thr.place;
       thr->ts.place_partition_len = gomp_places_list_len;
     }
-  fn ((void *) tgt->tgt_start);
+  devicep->device_run_func ((void *) tgt_fn->tgt->tgt_start,
+			    (void *) tgt_vars->tgt_start);
   gomp_free_thread (thr);
   *thr = old_thr;
-  gomp_unmap_vars (tgt);
+  gomp_unmap_vars (tgt_vars);
 }
 
 void
@@ -525,7 +637,8 @@ GOMP_target_data (int device, const void *openmp_target, size_t mapnum,
 		  void **hostaddrs, size_t *sizes, unsigned char *kinds)
 {
   struct gomp_device_descr *devicep = resolve_device (device);
-  if (devicep == NULL)
+  if (openmp_target == NULL || devicep == NULL
+      || !devicep->device_available_func (devicep->id))
     {
       /* Host fallback.  */
       struct gomp_task_icv *icv = gomp_icv (false);
@@ -543,6 +656,9 @@ GOMP_target_data (int device, const void *openmp_target, size_t mapnum,
       return;
     }
 
+  if (!devicep->is_initialized)
+    gomp_init_device (devicep);
+
   struct target_mem_desc *tgt
     = gomp_map_vars (devicep, mapnum, hostaddrs, sizes, kinds, false);
   struct gomp_task_icv *icv = gomp_icv (true);
@@ -567,9 +683,13 @@ GOMP_target_update (int device, const void *openmp_target, size_t mapnum,
 		    void **hostaddrs, size_t *sizes, unsigned char *kinds)
 {
   struct gomp_device_descr *devicep = resolve_device (device);
-  if (devicep == NULL)
+  if (openmp_target == NULL || devicep == NULL
+      || !devicep->device_available_func (devicep->id))
     return;
 
+  if (!devicep->is_initialized)
+    gomp_init_device (devicep);
+
   gomp_update (devicep, mapnum, hostaddrs, sizes, kinds);
 }
 
@@ -637,10 +757,13 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device,
     }									\
   while (0)
   DLSYM (device_available);
+  DLSYM (device_init);
+  DLSYM (device_load_image);
   DLSYM (device_alloc);
   DLSYM (device_free);
   DLSYM (device_dev2host);
   DLSYM (device_host2dev);
+  DLSYM (device_run);
 #undef DLSYM
 
  out:
@@ -700,6 +823,7 @@ gomp_find_available_plugins (void)
 
       devices[num_devices] = current_device;
       devices[num_devices].id = num_devices + 1;
+      devices[num_devices].is_initialized = false;
       devices[num_devices].dev_splay_tree.root = NULL;
       gomp_mutex_init (&devices[num_devices].dev_env_lock);
       num_devices++;
-- 
1.7.1

  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-02-28 16:23                 ` Bernd Schmidt
  2014-02-28 21:41                   ` Bernd Schmidt
  2014-02-28 22:10                   ` Ilya Verbin
@ 2014-03-05 17:15                   ` Ilya Verbin
  2014-03-06  8:48                     ` Bernd Schmidt
  2014-06-17 18:20                   ` Ilya Verbin
  3 siblings, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-03-05 17:15 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Thomas Schwinge, Michael V. Zolotukhin, Jakub Jelinek,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

On 28 Feb 17:21, Bernd Schmidt wrote:
> I think it won't help that much - I still think this entire scheme
> is likely to fail on nvptx. I'll try to construct an example at some
> point.
> 
> One other thing about the split tables is that we don't have to
> write a useless size of 1 for functions.
> 
> 
> The concept of "image" is likely to vary somewhat between
> accelerators. For ptx, it's just a string and it can't really be
> generated the same way as for your target where you can manipulate
> ELF images. So I think it is better to have a call to a gomp
> registration function for every offload target. That should also
> give you the ordering you said you wanted between shared libraries.
> 
> 
> Probably. I think the constructor call to the gomp registration
> function would contain an opaque pointer to whatever data the target
> wants, so it can arrange its image/table data in whatever way it
> likes.

Assuming that we're using the scheme with tables.
Every DSO with offloading must contain a constructor call to GOMP_offload_register (const void *openmp_target);
The openmp_target descriptor in every DSO will have target-independent entries (addresses of host tables) and target-dependent entries for each target. Its format may be like this:

void *__OPENMP_TARGET__[] =
{
  _omp_host_func_table;
  _omp_host_funcs_end;
  _omp_host_var_table;
  _omp_host_vars_end;
  _omp_num_targets;
  _omp_target_descs[]; /* array of tgt_desc */
}

struct tgt_desc
{
  int _omp_tgt_id;
  void *_omp_tgt_%s_image_start;
  void *_omp_tgt_%s_image_end;
  void *_omp_tgt_%s_func_mappings;
  void *_omp_tgt_%s_var_mappings;
  /* some other data if needed */
}

The mkoffload tool will fill those symbols, that are required by the corresponding target.
E.g. for the MIC and PTX targets the openmp_target descriptor will look like:

{
  &_omp_host_func_table,
  &_omp_host_funcs_end,
  &_omp_host_var_table,
  &_omp_host_vars_end,
  2,

  MIC_ID,
  &_omp_tgt_mic_image_start,
  &_omp_tgt_mic_image_end,
  &_omp_tgt_mic_func_mappings, /* 0 */
  &_omp_tgt_mic_var_mappings, /* 0 */

  PTX_ID,
  &_omp_tgt_ptx_image_start,
  &_omp_tgt_ptx_image_end, /* 0 */
  &_omp_tgt_ptx_func_mappings,
  &_omp_tgt_ptx_var_mappings
}

During the devices initialization libgomp will pass the openmp_target pointer to all plugins. Each plugin will scan over tgt_descs and find the required entries using the _omp_tgt_id.
Then the plugin loads the image to the target, does whatever it wants, and returns func_mappings and var_mappings to libgomp, because libgomp has to add host-target mapping into the splay tree.
How does this look?

BTW, do you have any estimate when you will commit your patches to the branch, so that we could merge them with ours, and get something working for everybody?

  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-03-05 17:15                   ` Ilya Verbin
@ 2014-03-06  8:48                     ` Bernd Schmidt
  2014-03-06 11:11                       ` Ilya Verbin
  0 siblings, 1 reply; 62+ messages in thread
From: Bernd Schmidt @ 2014-03-06  8:48 UTC (permalink / raw)
  To: Ilya Verbin
  Cc: Thomas Schwinge, Michael V. Zolotukhin, Jakub Jelinek,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

On 03/05/2014 06:15 PM, Ilya Verbin wrote:
> On 28 Feb 17:21, Bernd Schmidt wrote:
>> I think it won't help that much - I still think this entire scheme
>> is likely to fail on nvptx. I'll try to construct an example at
>> some point.
>>
>> One other thing about the split tables is that we don't have to
>> write a useless size of 1 for functions.
>>
>>
>> The concept of "image" is likely to vary somewhat between
>> accelerators. For ptx, it's just a string and it can't really be
>> generated the same way as for your target where you can manipulate
>> ELF images. So I think it is better to have a call to a gomp
>> registration function for every offload target. That should also
>> give you the ordering you said you wanted between shared
>> libraries.
>>
>>
>> Probably. I think the constructor call to the gomp registration
>> function would contain an opaque pointer to whatever data the
>> target wants, so it can arrange its image/table data in whatever
>> way it likes.
>
> Assuming that we're using the scheme with tables. Every DSO with
> offloading must contain a constructor call to GOMP_offload_register
> (const void *openmp_target); The openmp_target descriptor in every
> DSO will have target-independent entries (addresses of host tables)
> and target-dependent entries for each target. Its format may be like
> this:
>
> void *__OPENMP_TARGET__[] = { _omp_host_func_table;
> _omp_host_funcs_end; _omp_host_var_table; _omp_host_vars_end;
> _omp_num_targets; _omp_target_descs[]; /* array of tgt_desc */ }

I don't see why you want the array of target descriptors - it would take
some effort to construct, and as far as I can tell it's unnecessary. You
can just pass a pointer to the corresponding descriptor to every
GOMP_offload_register call.


> struct tgt_desc { int _omp_tgt_id; void *_omp_tgt_%s_image_start;
> void *_omp_tgt_%s_image_end; void *_omp_tgt_%s_func_mappings; void
> *_omp_tgt_%s_var_mappings; /* some other data if needed */ }

This looks reasonable.

> During the devices initialization libgomp will pass the openmp_target
> pointer to all plugins. Each plugin will scan over tgt_descs and find
> the required entries using the _omp_tgt_id.

Once again, that seems unnecessarily complicated. The plugins can 
register their target ID with libgomp, and when libgomp sees a 
GOMP_offload_register call with the corresponding target ID, it can 
invoke the appropriate plugin immediately.

> BTW, do you have any estimate when you will commit your patches to
> the branch, so that we could merge them with ours, and get something
> working for everybody?

I've been waiting for us to reach agreement on how things should look. 
If there are patches in the series that you're happy with, let me know 
and I can commit them (it may be next week though).


Bernd

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-03-06  8:48                     ` Bernd Schmidt
@ 2014-03-06 11:11                       ` Ilya Verbin
  2014-03-06 11:54                         ` Bernd Schmidt
  0 siblings, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-03-06 11:11 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Thomas Schwinge, Michael V. Zolotukhin, Jakub Jelinek,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

2014-03-06 12:47 GMT+04:00 Bernd Schmidt <bernds@codesourcery.com>:
> I don't see why you want the array of target descriptors - it would take
> some effort to construct, and as far as I can tell it's unnecessary. You
> can just pass a pointer to the corresponding descriptor to every
> GOMP_offload_register call.
>
> Once again, that seems unnecessarily complicated. The plugins can register
> their target ID with libgomp, and when libgomp sees a GOMP_offload_register
> call with the corresponding target ID, it can invoke the appropriate plugin
> immediately.

Do I understand correctly, that you propose to do so:

extern void *_omp_host_func_table[];
extern void *_omp_host_var_table[];
extern void *_omp_host_funcs_end[];
extern void *_omp_host_vars_end[];

void *__OPENMP_TARGET_HOST__[]
__attribute__ ((visibility ("protected"))) =
{
  &_omp_host_func_table, &_omp_host_funcs_end,
  &_omp_host_var_table, &_omp_host_vars_end
};

extern void *__OPENMP_TARGET_MIC__[];
extern void *__OPENMP_TARGET_PTX__[];
extern void GOMP_offload_register_host (const void *);
extern void GOMP_offload_register_target (const void *);

__attribute__ ((constructor))
static void
init (void)
{
  GOMP_offload_register_host (__OPENMP_TARGET_HOST__);
  GOMP_offload_register_target (__OPENMP_TARGET_MIC__);
  GOMP_offload_register_target (__OPENMP_TARGET_PTX__);
}

Where __OPENMP_TARGET_MIC__ and __OPENMP_TARGET_PTX__ descriptors
should be generated in the corresponding mkoffload tools.

  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-03-06 11:11                       ` Ilya Verbin
@ 2014-03-06 11:54                         ` Bernd Schmidt
  2014-03-06 12:52                           ` Ilya Verbin
  0 siblings, 1 reply; 62+ messages in thread
From: Bernd Schmidt @ 2014-03-06 11:54 UTC (permalink / raw)
  To: Ilya Verbin
  Cc: Thomas Schwinge, Michael V. Zolotukhin, Jakub Jelinek,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

On 03/06/2014 12:11 PM, Ilya Verbin wrote:

> Do I understand correctly, that you propose to do so:
>
> extern void *_omp_host_func_table[];
> extern void *_omp_host_var_table[];
> extern void *_omp_host_funcs_end[];
> extern void *_omp_host_vars_end[];
>
> void *__OPENMP_TARGET_HOST__[]
> __attribute__ ((visibility ("protected"))) =
> {
>    &_omp_host_func_table, &_omp_host_funcs_end,
>    &_omp_host_var_table, &_omp_host_vars_end
> };

So far, yes (maybe just call it __OPENMP_HOST_TABLE__).

> extern void *__OPENMP_TARGET_MIC__[];
> extern void *__OPENMP_TARGET_PTX__[];
> extern void GOMP_offload_register_host (const void *);
> extern void GOMP_offload_register_target (const void *);
>
> __attribute__ ((constructor))
> static void
> init (void)
> {
>    GOMP_offload_register_host (__OPENMP_TARGET_HOST__);
>    GOMP_offload_register_target (__OPENMP_TARGET_MIC__);
>    GOMP_offload_register_target (__OPENMP_TARGET_PTX__);
> }
>
> Where __OPENMP_TARGET_MIC__ and __OPENMP_TARGET_PTX__ descriptors
> should be generated in the corresponding mkoffload tools.

No. I don't think we need a global constructor for registering 
__OPENMP_TARGET_HOST__ - this would unnecessarily bloat crtbegin/crtend. 
  We also shouldn't need to have the target tables known outside of the 
image constructed by the mkoffload tools.  The way I imagine it, every 
mkoffload tool creates its own constructor that looks like something 
like this:

__attribute__ ((constructor)) static void
init (void)
{
    GOMP_offload_register_target (__OPENMP_TARGET_HOST__,
                                  PTX_ID, ptx_target_table);
}

That creates a mapping between host and target table for PTX_ID. If 
there are multiple shared libraries with offload support, you can still 
obtain the ordering you want from these GOMP_offload_register_target 
calls. Everything is nicely private to the mkoffload-generated image.

It's implemented in almost this fashion (slightly different naming and 
args, and no real support in libgomp) in the patch kit I sent.


Bernd

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-03-06 11:54                         ` Bernd Schmidt
@ 2014-03-06 12:52                           ` Ilya Verbin
  2014-03-08 15:39                             ` Ilya Verbin
  0 siblings, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-03-06 12:52 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Thomas Schwinge, Michael V. Zolotukhin, Jakub Jelinek,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

2014-03-06 15:53 GMT+04:00 Bernd Schmidt <bernds@codesourcery.com>:
> No. I don't think we need a global constructor for registering
> __OPENMP_TARGET_HOST__ - this would unnecessarily bloat crtbegin/crtend.  We
> also shouldn't need to have the target tables known outside of the image
> constructed by the mkoffload tools.  The way I imagine it, every mkoffload
> tool creates its own constructor that looks like something like this:
>
>
> __attribute__ ((constructor)) static void
> init (void)
> {
>    GOMP_offload_register_target (__OPENMP_TARGET_HOST__,
>                                  PTX_ID, ptx_target_table);
> }
>
> That creates a mapping between host and target table for PTX_ID. If there
> are multiple shared libraries with offload support, you can still obtain the
> ordering you want from these GOMP_offload_register_target calls. Everything
> is nicely private to the mkoffload-generated image.
>
> It's implemented in almost this fashion (slightly different naming and args,
> and no real support in libgomp) in the patch kit I sent.

OK, now I get it, this looks good. I will rewrite the patch for
libgomp posted above to support this scheme.
Since we will pass __OPENMP_HOST_TABLE__ to GOMP_offload_register,
there is no need to pass it to GOMP_target[data/update], right?

  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-03-06 12:52                           ` Ilya Verbin
@ 2014-03-08 15:39                             ` Ilya Verbin
  2014-03-12 14:14                               ` Bernd Schmidt
  0 siblings, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-03-08 15:39 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Thomas Schwinge, Michael V. Zolotukhin, Jakub Jelinek,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

Hi Bernd,

Here is updated patch for libgomp.  It assumes that there is a constructor with
a call to GOMP_offload_register in every target image, created by mkoffload
tool.  How does this look?

---
 libgomp/libgomp.map   |    1 +
 libgomp/plugin-host.c |   58 ++++++++++++++++-
 libgomp/target.c      |  170 +++++++++++++++++++++++++++++++++++++++++++++----
 3 files changed, 213 insertions(+), 16 deletions(-)

diff --git a/libgomp/libgomp.map b/libgomp/libgomp.map
index d8631a6..e43cb42 100644
--- a/libgomp/libgomp.map
+++ b/libgomp/libgomp.map
@@ -208,6 +208,7 @@ GOMP_3.0 {
 
 GOMP_4.0 {
   global:
+	GOMP_offload_register;
 	GOMP_barrier_cancel;
 	GOMP_cancel;
 	GOMP_cancellation_point;
diff --git a/libgomp/plugin-host.c b/libgomp/plugin-host.c
index 5354ebe..ec0c78c 100644
--- a/libgomp/plugin-host.c
+++ b/libgomp/plugin-host.c
@@ -33,14 +33,53 @@
 #include <stdlib.h>
 #include <string.h>
 
-bool
-device_available (void)
+const int TARGET_TYPE_HOST = 0;
+
+int
+get_type (void)
 {
 #ifdef DEBUG
   printf ("libgomp plugin: %s:%s\n", __FILE__, __FUNCTION__);
 #endif
 
-  return true;
+  return TARGET_TYPE_HOST;
+}
+
+int
+get_num_devices (void)
+{
+#ifdef DEBUG
+  printf ("libgomp plugin: %s:%s\n", __FILE__, __FUNCTION__);
+#endif
+
+  return 1;
+}
+
+void
+offload_register (void *host_table, void *target_data)
+{
+#ifdef DEBUG
+  printf ("libgomp plugin: %s:%s (%p, %p)\n", __FILE__, __FUNCTION__,
+	  host_table, target_data);
+#endif
+}
+
+void
+device_init (void)
+{
+#ifdef DEBUG
+  printf ("libgomp plugin: %s:%s\n", __FILE__, __FUNCTION__);
+#endif
+}
+
+int
+device_get_table (void *table)
+{
+#ifdef DEBUG
+  printf ("libgomp plugin: %s:%s (%p)\n", __FILE__, __FUNCTION__, table);
+#endif
+
+  return 0;
 }
 
 void *
@@ -82,3 +121,16 @@ void *device_host2dev (void *dest, const void *src, size_t n)
 
   return memcpy (dest, src, n);
 }
+
+void
+device_run (void *fn_ptr, void *vars)
+{
+#ifdef DEBUG
+  printf ("libgomp plugin: %s:%s (%p, %p)\n", __FILE__, __FUNCTION__, fn_ptr,
+	  vars);
+#endif
+
+  void (*fn)(void *) = (void (*)(void *)) fn_ptr;
+
+  fn (vars);
+}
diff --git a/libgomp/target.c b/libgomp/target.c
index dbe6e28..8be9ea1 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -87,6 +87,26 @@ struct splay_tree_key_s {
   bool copy_from;
 };
 
+enum target_type {
+  TARGET_TYPE_HOST,
+  TARGET_TYPE_INTEL_MIC
+};
+
+/* This structure describes an offload image.
+   It contains type of the target, pointer to host table descriptor, and pointer
+   to target data.  */
+struct offload_image_descr {
+  int type;
+  void *host_table;
+  void *target_data;
+};
+
+/* Array of descriptors of offload images.  */
+static struct offload_image_descr *offload_images;
+
+/* Total number of offload images.  */
+static int num_offload_images;
+
 /* Array of descriptors of all available devices.  */
 static struct gomp_device_descr *devices;
 
@@ -120,15 +140,26 @@ struct gomp_device_descr
      TARGET construct.  */
   int id;
 
+  /* This is the TYPE of device.  */
+  int type;
+
+  /* Set to true when device is initialized.  */
+  bool is_initialized;
+
   /* Plugin file handler.  */
   void *plugin_handle;
 
   /* Function handlers.  */
-  bool (*device_available_func) (void);
+  int (*get_type_func) (void);
+  int (*get_num_devices_func) (void);
+  void (*offload_register_func) (void *, void *);
+  void (*device_init_func) (void);
+  int (*device_get_table_func) (void *);
   void *(*device_alloc_func) (size_t);
   void (*device_free_func) (void *);
-  void *(*device_dev2host_func)(void *, const void *, size_t);
-  void *(*device_host2dev_func)(void *, const void *, size_t);
+  void *(*device_dev2host_func) (void *, const void *, size_t);
+  void *(*device_host2dev_func) (void *, const void *, size_t);
+  void (*device_run_func) (void *, void *);
 
   /* Splay tree containing information about mapped memory regions.  */
   struct splay_tree_s dev_splay_tree;
@@ -137,6 +168,13 @@ struct gomp_device_descr
   gomp_mutex_t dev_env_lock;
 };
 
+struct mapping_table {
+  uintptr_t host_start;
+  uintptr_t host_end;
+  uintptr_t tgt_start;
+  uintptr_t tgt_end;
+};
+
 attribute_hidden int
 gomp_get_num_devices (void)
 {
@@ -474,6 +512,63 @@ gomp_update (struct gomp_device_descr *devicep, size_t mapnum,
   gomp_mutex_unlock (&devicep->dev_env_lock);
 }
 
+/* This function should be called from every offload image.  It gets the
+   descriptor of the host func and var tables HOST_TABLE, TYPE of the target,
+   and TARGET_DATA needed by target plugin (target tables, etc.)  */
+void
+GOMP_offload_register (void *host_table, int type, void *target_data)
+{
+  offload_images = realloc (offload_images,
+			    (num_offload_images + 1)
+			    * sizeof (struct offload_image_descr));
+
+  if (offload_images == NULL)
+    return;
+
+  offload_images[num_offload_images].type = type;
+  offload_images[num_offload_images].host_table = host_table;
+  offload_images[num_offload_images].target_data = target_data;
+
+  num_offload_images++;
+}
+
+static void
+gomp_init_device (struct gomp_device_descr *devicep)
+{
+  /* Initialize the target device.  */
+  devicep->device_init_func ();
+
+  /* Get address mapping table for device.  */
+  struct mapping_table *table = NULL;
+  int num_entries = devicep->device_get_table_func (&table);
+
+  /* Insert host-target address mapping into dev_splay_tree.  */
+  int i;
+  for (i = 0; i < num_entries; i++)
+    {
+      struct target_mem_desc *tgt = gomp_malloc (sizeof (*tgt));
+      tgt->refcount = 1;
+      tgt->array = gomp_malloc (sizeof (*tgt->array));
+      tgt->tgt_start = table[i].tgt_start;
+      tgt->tgt_end = table[i].tgt_end;
+      tgt->to_free = NULL;
+      tgt->list_count = 0;
+      tgt->device_descr = devicep;
+      splay_tree_node node = tgt->array;
+      splay_tree_key k = &node->key;
+      k->host_start = table[i].host_start;
+      k->host_end = table[i].host_end;
+      k->tgt_offset = 0;
+      k->tgt = tgt;
+      node->left = NULL;
+      node->right = NULL;
+      splay_tree_insert (&devicep->dev_splay_tree, node);
+    }
+
+  free (table);
+  devicep->is_initialized = true;
+}
+
 /* Called when encountering a target directive.  If DEVICE
    is -1, it means use device-var ICV.  If it is -2 (or any other value
    larger than last available hw device, use host fallback.
@@ -507,7 +602,17 @@ GOMP_target (int device, void (*fn) (void *), const void *openmp_target,
       return;
     }
 
-  struct target_mem_desc *tgt
+  if (!devicep->is_initialized)
+    gomp_init_device (devicep);
+
+  struct splay_tree_key_s k;
+  k.host_start = (uintptr_t) fn;
+  k.host_end = k.host_start + 1;
+  splay_tree_key tgt_fn = splay_tree_lookup (&devicep->dev_splay_tree, &k);
+  if (tgt_fn == NULL && devicep->type != TARGET_TYPE_HOST)
+    gomp_fatal ("Target function wasn't mapped");
+
+  struct target_mem_desc *tgt_vars
     = gomp_map_vars (devicep, mapnum, hostaddrs, sizes, kinds, true);
   struct gomp_thread old_thr, *thr = gomp_thread ();
   old_thr = *thr;
@@ -517,10 +622,14 @@ GOMP_target (int device, void (*fn) (void *), const void *openmp_target,
       thr->place = old_thr.place;
       thr->ts.place_partition_len = gomp_places_list_len;
     }
-  fn ((void *) tgt->tgt_start);
+  if (devicep->type == TARGET_TYPE_HOST)
+    devicep->device_run_func (fn, (void *) tgt_vars->tgt_start);
+  else
+    devicep->device_run_func ((void *) tgt_fn->tgt->tgt_start,
+			      (void *) tgt_vars->tgt_start);
   gomp_free_thread (thr);
   *thr = old_thr;
-  gomp_unmap_vars (tgt);
+  gomp_unmap_vars (tgt_vars);
 }
 
 void
@@ -546,6 +655,9 @@ GOMP_target_data (int device, const void *openmp_target, size_t mapnum,
       return;
     }
 
+  if (!devicep->is_initialized)
+    gomp_init_device (devicep);
+
   struct target_mem_desc *tgt
     = gomp_map_vars (devicep, mapnum, hostaddrs, sizes, kinds, false);
   struct gomp_task_icv *icv = gomp_icv (true);
@@ -573,6 +685,9 @@ GOMP_target_update (int device, const void *openmp_target, size_t mapnum,
   if (devicep == NULL)
     return;
 
+  if (!devicep->is_initialized)
+    gomp_init_device (devicep);
+
   gomp_update (devicep, mapnum, hostaddrs, sizes, kinds);
 }
 
@@ -639,11 +754,16 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device,
 	goto out;							\
     }									\
   while (0)
-  DLSYM (device_available);
+  DLSYM (get_type);
+  DLSYM (get_num_devices);
+  DLSYM (offload_register);
+  DLSYM (device_init);
+  DLSYM (device_get_table);
   DLSYM (device_alloc);
   DLSYM (device_free);
   DLSYM (device_dev2host);
   DLSYM (device_host2dev);
+  DLSYM (device_run);
 #undef DLSYM
 
  out:
@@ -656,6 +776,21 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device,
   return err == NULL;
 }
 
+/* This function finds OFFLOAD_IMAGES corresponding to DEVICE type, and
+   registers them in the plugin.  */
+static void
+gomp_register_images_for_device (struct gomp_device_descr *device)
+{
+  int i;
+  for (i = 0; i < num_offload_images; i++)
+    {
+      struct offload_image_descr *image = &offload_images[i];
+
+      if (device->type == image->type || device->type == TARGET_TYPE_HOST)
+	device->offload_register_func (image->host_table, image->target_data);
+    }
+}
+
 /* This functions scans folder, specified in environment variable
    LIBGOMP_PLUGIN_PATH, and loads all suitable libgomp plugins from this folder.
    For a plugin to be suitable, its name should be "libgomp-plugin-*.so.1" and
@@ -701,16 +836,25 @@ gomp_find_available_plugins (void)
 	  goto out;
 	}
 
-      devices[num_devices] = current_device;
-      devices[num_devices].id = num_devices + 1;
-      devices[num_devices].dev_splay_tree.root = NULL;
-      gomp_mutex_init (&devices[num_devices].dev_env_lock);
-      num_devices++;
+      /* FIXME: Properly handle multiple devices of the same type.  */
+      if (current_device.get_num_devices_func () >= 1)
+	{
+	  current_device.id = num_devices + 1;
+	  current_device.type = current_device.get_type_func ();
+	  current_device.is_initialized = false;
+	  current_device.dev_splay_tree.root = NULL;
+	  gomp_register_images_for_device (&current_device);
+	  devices[num_devices] = current_device;
+	  gomp_mutex_init (&devices[num_devices].dev_env_lock);
+	  num_devices++;
+	}
     }
 
- out:
+out:
   if (dir)
     closedir (dir);
+  free (offload_images);
+  num_offload_images = 0;
 }
 
 /* This function initializes runtime needed for offloading.
-- 
1.7.1

  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-03-08 15:39                             ` Ilya Verbin
@ 2014-03-12 14:14                               ` Bernd Schmidt
  2014-03-12 14:52                                 ` Ilya Verbin
  0 siblings, 1 reply; 62+ messages in thread
From: Bernd Schmidt @ 2014-03-12 14:14 UTC (permalink / raw)
  To: Ilya Verbin
  Cc: Thomas Schwinge, Michael V. Zolotukhin, Jakub Jelinek,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

Hi,

On 03/08/2014 03:50 PM, Ilya Verbin wrote:
> Here is updated patch for libgomp.  It assumes that there is a constructor with
> a call to GOMP_offload_register in every target image, created by mkoffload
> tool.  How does this look?

LGTM. Shall I start committing my changes to the branch?


Bernd


^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-03-12 14:14                               ` Bernd Schmidt
@ 2014-03-12 14:52                                 ` Ilya Verbin
  2014-03-20 17:41                                   ` Bernd Schmidt
  0 siblings, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-03-12 14:52 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Thomas Schwinge, Michael V. Zolotukhin, Jakub Jelinek,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

2014-03-12 18:12 GMT+04:00 Bernd Schmidt <bernds@codesourcery.com>:
> LGTM. Shall I start committing my changes to the branch?

Yes, I think you should commit your changes.
And we will rewrite our part to use the new configure approach.

  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: [RFC][gomp4] Offloading: Add device initialization and host->target function mapping
  2014-01-15 15:09   ` Ilya Verbin
@ 2014-03-12 18:21     ` Ilya Verbin
  2014-03-17 13:10       ` Ilya Verbin
  2014-03-17 15:12       ` Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation Thomas Schwinge
  0 siblings, 2 replies; 62+ messages in thread
From: Ilya Verbin @ 2014-03-12 18:21 UTC (permalink / raw)
  To: Thomas Schwinge
  Cc: Bernd Schmidt, Jakub Jelinek, Richard Biener, Kirill Yukhin,
	Michael V. Zolotukhin, Andrey Turetskiy, Ilya Tocar, gcc-patches

Hi Thomas,

Here is a new version of this patch (it was discussed in other thread: http://gcc.gnu.org/ml/gcc-patches/2014-03/msg00573.html ) with ChangeLog.
Bootstrap and make check passed.
Ok to commit?


 libgomp/ChangeLog.gomp |   29 ++++++++
 libgomp/libgomp.map    |    1 +
 libgomp/plugin-host.c  |   58 ++++++++++++++++-
 libgomp/target.c       |  170 ++++++++++++++++++++++++++++++++++++++++++++----
 4 files changed, 242 insertions(+), 16 deletions(-)

diff --git a/libgomp/ChangeLog.gomp b/libgomp/ChangeLog.gomp
index 7f9ce11..57a600e 100644
--- a/libgomp/ChangeLog.gomp
+++ b/libgomp/ChangeLog.gomp
@@ -1,3 +1,32 @@
+2014-03-12  Ilya Verbin  <ilya.verbin@intel.com>
+
+	* libgomp.map (GOMP_4.0): Add GOMP_offload_register.
+	* plugin-host.c (device_available): Replace with:
+	(get_num_devices): This.
+	(get_type): New.
+	(offload_register): Ditto.
+	(device_init): Ditto.
+	(device_get_table): Ditto.
+	(device_run): Ditto.
+	* target.c (target_type): New enum.
+	(offload_image_descr): New struct.
+	(offload_images, num_offload_images): New globals.
+	(struct gomp_device_descr): Remove device_available_func.
+	Add type, is_initialized, get_type_func, get_num_devices_func,
+	offload_register_func, device_init_func, device_get_table_func,
+	device_run_func.
+	(mapping_table): New struct.
+	(GOMP_offload_register): New function.
+	(gomp_init_device): Ditto.
+	(GOMP_target): Add device initialization and lookup for target fn.
+	(GOMP_target_data): Add device initialization.
+	(GOMP_target_update): Ditto.
+	(gomp_load_plugin_for_device): Take handles for get_type,
+	get_num_devices, offload_register, device_init, device_get_table,
+	device_run functions.
+	(gomp_register_images_for_device): New function.
+	(gomp_find_available_plugins): Add registration of offload images.
+
 2014-02-28  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* testsuite/libgomp.oacc-c/goacc_kernels.c: New file.
diff --git a/libgomp/libgomp.map b/libgomp/libgomp.map
index e9f8b55..9328767 100644
--- a/libgomp/libgomp.map
+++ b/libgomp/libgomp.map
@@ -208,6 +208,7 @@ GOMP_3.0 {
 
 GOMP_4.0 {
   global:
+	GOMP_offload_register;
 	GOMP_barrier_cancel;
 	GOMP_cancel;
 	GOMP_cancellation_point;
diff --git a/libgomp/plugin-host.c b/libgomp/plugin-host.c
index 5354ebe..ec0c78c 100644
--- a/libgomp/plugin-host.c
+++ b/libgomp/plugin-host.c
@@ -33,14 +33,53 @@
 #include <stdlib.h>
 #include <string.h>
 
-bool
-device_available (void)
+const int TARGET_TYPE_HOST = 0;
+
+int
+get_type (void)
 {
 #ifdef DEBUG
   printf ("libgomp plugin: %s:%s\n", __FILE__, __FUNCTION__);
 #endif
 
-  return true;
+  return TARGET_TYPE_HOST;
+}
+
+int
+get_num_devices (void)
+{
+#ifdef DEBUG
+  printf ("libgomp plugin: %s:%s\n", __FILE__, __FUNCTION__);
+#endif
+
+  return 1;
+}
+
+void
+offload_register (void *host_table, void *target_data)
+{
+#ifdef DEBUG
+  printf ("libgomp plugin: %s:%s (%p, %p)\n", __FILE__, __FUNCTION__,
+	  host_table, target_data);
+#endif
+}
+
+void
+device_init (void)
+{
+#ifdef DEBUG
+  printf ("libgomp plugin: %s:%s\n", __FILE__, __FUNCTION__);
+#endif
+}
+
+int
+device_get_table (void *table)
+{
+#ifdef DEBUG
+  printf ("libgomp plugin: %s:%s (%p)\n", __FILE__, __FUNCTION__, table);
+#endif
+
+  return 0;
 }
 
 void *
@@ -82,3 +121,16 @@ void *device_host2dev (void *dest, const void *src, size_t n)
 
   return memcpy (dest, src, n);
 }
+
+void
+device_run (void *fn_ptr, void *vars)
+{
+#ifdef DEBUG
+  printf ("libgomp plugin: %s:%s (%p, %p)\n", __FILE__, __FUNCTION__, fn_ptr,
+	  vars);
+#endif
+
+  void (*fn)(void *) = (void (*)(void *)) fn_ptr;
+
+  fn (vars);
+}
diff --git a/libgomp/target.c b/libgomp/target.c
index a6a5505..0715b31 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -84,6 +84,26 @@ struct splay_tree_key_s {
   bool copy_from;
 };
 
+enum target_type {
+  TARGET_TYPE_HOST,
+  TARGET_TYPE_INTEL_MIC
+};
+
+/* This structure describes an offload image.
+   It contains type of the target, pointer to host table descriptor, and pointer
+   to target data.  */
+struct offload_image_descr {
+  int type;
+  void *host_table;
+  void *target_data;
+};
+
+/* Array of descriptors of offload images.  */
+static struct offload_image_descr *offload_images;
+
+/* Total number of offload images.  */
+static int num_offload_images;
+
 /* Array of descriptors of all available devices.  */
 static struct gomp_device_descr *devices;
 
@@ -117,15 +137,26 @@ struct gomp_device_descr
      TARGET construct.  */
   int id;
 
+  /* This is the TYPE of device.  */
+  int type;
+
+  /* Set to true when device is initialized.  */
+  bool is_initialized;
+
   /* Plugin file handler.  */
   void *plugin_handle;
 
   /* Function handlers.  */
-  bool (*device_available_func) (void);
+  int (*get_type_func) (void);
+  int (*get_num_devices_func) (void);
+  void (*offload_register_func) (void *, void *);
+  void (*device_init_func) (void);
+  int (*device_get_table_func) (void *);
   void *(*device_alloc_func) (size_t);
   void (*device_free_func) (void *);
-  void *(*device_dev2host_func)(void *, const void *, size_t);
-  void *(*device_host2dev_func)(void *, const void *, size_t);
+  void *(*device_dev2host_func) (void *, const void *, size_t);
+  void *(*device_host2dev_func) (void *, const void *, size_t);
+  void (*device_run_func) (void *, void *);
 
   /* Splay tree containing information about mapped memory regions.  */
   struct splay_tree_s dev_splay_tree;
@@ -134,6 +165,13 @@ struct gomp_device_descr
   gomp_mutex_t dev_env_lock;
 };
 
+struct mapping_table {
+  uintptr_t host_start;
+  uintptr_t host_end;
+  uintptr_t tgt_start;
+  uintptr_t tgt_end;
+};
+
 attribute_hidden int
 gomp_get_num_devices (void)
 {
@@ -471,6 +509,63 @@ gomp_update (struct gomp_device_descr *devicep, size_t mapnum,
   gomp_mutex_unlock (&devicep->dev_env_lock);
 }
 
+/* This function should be called from every offload image.  It gets the
+   descriptor of the host func and var tables HOST_TABLE, TYPE of the target,
+   and TARGET_DATA needed by target plugin (target tables, etc.)  */
+void
+GOMP_offload_register (void *host_table, int type, void *target_data)
+{
+  offload_images = realloc (offload_images,
+			    (num_offload_images + 1)
+			    * sizeof (struct offload_image_descr));
+
+  if (offload_images == NULL)
+    return;
+
+  offload_images[num_offload_images].type = type;
+  offload_images[num_offload_images].host_table = host_table;
+  offload_images[num_offload_images].target_data = target_data;
+
+  num_offload_images++;
+}
+
+static void
+gomp_init_device (struct gomp_device_descr *devicep)
+{
+  /* Initialize the target device.  */
+  devicep->device_init_func ();
+
+  /* Get address mapping table for device.  */
+  struct mapping_table *table = NULL;
+  int num_entries = devicep->device_get_table_func (&table);
+
+  /* Insert host-target address mapping into dev_splay_tree.  */
+  int i;
+  for (i = 0; i < num_entries; i++)
+    {
+      struct target_mem_desc *tgt = gomp_malloc (sizeof (*tgt));
+      tgt->refcount = 1;
+      tgt->array = gomp_malloc (sizeof (*tgt->array));
+      tgt->tgt_start = table[i].tgt_start;
+      tgt->tgt_end = table[i].tgt_end;
+      tgt->to_free = NULL;
+      tgt->list_count = 0;
+      tgt->device_descr = devicep;
+      splay_tree_node node = tgt->array;
+      splay_tree_key k = &node->key;
+      k->host_start = table[i].host_start;
+      k->host_end = table[i].host_end;
+      k->tgt_offset = 0;
+      k->tgt = tgt;
+      node->left = NULL;
+      node->right = NULL;
+      splay_tree_insert (&devicep->dev_splay_tree, node);
+    }
+
+  free (table);
+  devicep->is_initialized = true;
+}
+
 /* Called when encountering a target directive.  If DEVICE
    is -1, it means use device-var ICV.  If it is -2 (or any other value
    larger than last available hw device, use host fallback.
@@ -504,7 +599,17 @@ GOMP_target (int device, void (*fn) (void *), const void *openmp_target,
       return;
     }
 
-  struct target_mem_desc *tgt
+  if (!devicep->is_initialized)
+    gomp_init_device (devicep);
+
+  struct splay_tree_key_s k;
+  k.host_start = (uintptr_t) fn;
+  k.host_end = k.host_start + 1;
+  splay_tree_key tgt_fn = splay_tree_lookup (&devicep->dev_splay_tree, &k);
+  if (tgt_fn == NULL && devicep->type != TARGET_TYPE_HOST)
+    gomp_fatal ("Target function wasn't mapped");
+
+  struct target_mem_desc *tgt_vars
     = gomp_map_vars (devicep, mapnum, hostaddrs, sizes, kinds, true);
   struct gomp_thread old_thr, *thr = gomp_thread ();
   old_thr = *thr;
@@ -514,10 +619,14 @@ GOMP_target (int device, void (*fn) (void *), const void *openmp_target,
       thr->place = old_thr.place;
       thr->ts.place_partition_len = gomp_places_list_len;
     }
-  fn ((void *) tgt->tgt_start);
+  if (devicep->type == TARGET_TYPE_HOST)
+    devicep->device_run_func (fn, (void *) tgt_vars->tgt_start);
+  else
+    devicep->device_run_func ((void *) tgt_fn->tgt->tgt_start,
+			      (void *) tgt_vars->tgt_start);
   gomp_free_thread (thr);
   *thr = old_thr;
-  gomp_unmap_vars (tgt);
+  gomp_unmap_vars (tgt_vars);
 }
 
 void
@@ -543,6 +652,9 @@ GOMP_target_data (int device, const void *openmp_target, size_t mapnum,
       return;
     }
 
+  if (!devicep->is_initialized)
+    gomp_init_device (devicep);
+
   struct target_mem_desc *tgt
     = gomp_map_vars (devicep, mapnum, hostaddrs, sizes, kinds, false);
   struct gomp_task_icv *icv = gomp_icv (true);
@@ -570,6 +682,9 @@ GOMP_target_update (int device, const void *openmp_target, size_t mapnum,
   if (devicep == NULL)
     return;
 
+  if (!devicep->is_initialized)
+    gomp_init_device (devicep);
+
   gomp_update (devicep, mapnum, hostaddrs, sizes, kinds);
 }
 
@@ -636,11 +751,16 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device,
 	goto out;							\
     }									\
   while (0)
-  DLSYM (device_available);
+  DLSYM (get_type);
+  DLSYM (get_num_devices);
+  DLSYM (offload_register);
+  DLSYM (device_init);
+  DLSYM (device_get_table);
   DLSYM (device_alloc);
   DLSYM (device_free);
   DLSYM (device_dev2host);
   DLSYM (device_host2dev);
+  DLSYM (device_run);
 #undef DLSYM
 
  out:
@@ -653,6 +773,21 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device,
   return err == NULL;
 }
 
+/* This function finds OFFLOAD_IMAGES corresponding to DEVICE type, and
+   registers them in the plugin.  */
+static void
+gomp_register_images_for_device (struct gomp_device_descr *device)
+{
+  int i;
+  for (i = 0; i < num_offload_images; i++)
+    {
+      struct offload_image_descr *image = &offload_images[i];
+
+      if (device->type == image->type || device->type == TARGET_TYPE_HOST)
+	device->offload_register_func (image->host_table, image->target_data);
+    }
+}
+
 /* This functions scans folder, specified in environment variable
    LIBGOMP_PLUGIN_PATH, and loads all suitable libgomp plugins from this folder.
    For a plugin to be suitable, its name should be "libgomp-plugin-*.so.1" and
@@ -698,16 +833,25 @@ gomp_find_available_plugins (void)
 	  goto out;
 	}
 
-      devices[num_devices] = current_device;
-      devices[num_devices].id = num_devices + 1;
-      devices[num_devices].dev_splay_tree.root = NULL;
-      gomp_mutex_init (&devices[num_devices].dev_env_lock);
-      num_devices++;
+      /* FIXME: Properly handle multiple devices of the same type.  */
+      if (current_device.get_num_devices_func () >= 1)
+	{
+	  current_device.id = num_devices + 1;
+	  current_device.type = current_device.get_type_func ();
+	  current_device.is_initialized = false;
+	  current_device.dev_splay_tree.root = NULL;
+	  gomp_register_images_for_device (&current_device);
+	  devices[num_devices] = current_device;
+	  gomp_mutex_init (&devices[num_devices].dev_env_lock);
+	  num_devices++;
+	}
     }
 
- out:
+out:
   if (dir)
     closedir (dir);
+  free (offload_images);
+  num_offload_images = 0;
 }
 
 /* This function initializes runtime needed for offloading.
-- 
1.7.1


  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: [RFC][gomp4] Offloading: Add device initialization and host->target function mapping
  2014-03-12 18:21     ` Ilya Verbin
@ 2014-03-17 13:10       ` Ilya Verbin
  2014-03-17 15:12       ` Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation Thomas Schwinge
  1 sibling, 0 replies; 62+ messages in thread
From: Ilya Verbin @ 2014-03-17 13:10 UTC (permalink / raw)
  To: Thomas Schwinge
  Cc: Bernd Schmidt, Jakub Jelinek, Richard Biener, Kirill Yukhin,
	Michael V. Zolotukhin, Andrey Turetskiy, Ilya Tocar, gcc

Ping.

2014-03-12 21:56 GMT+04:00 Ilya Verbin <iverbin@gmail.com>:
> Hi Thomas,
>
> Here is a new version of this patch (it was discussed in other thread: http://gcc.gnu.org/ml/gcc-patches/2014-03/msg00573.html ) with ChangeLog.
> Bootstrap and make check passed.
> Ok to commit?

  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-03-12 18:21     ` Ilya Verbin
  2014-03-17 13:10       ` Ilya Verbin
@ 2014-03-17 15:12       ` Thomas Schwinge
  2014-03-17 16:49         ` Jakub Jelinek
  2014-03-18 17:36         ` Ilya Verbin
  1 sibling, 2 replies; 62+ messages in thread
From: Thomas Schwinge @ 2014-03-17 15:12 UTC (permalink / raw)
  To: Ilya Verbin, Bernd Schmidt, Jakub Jelinek
  Cc: Michael V. Zolotukhin, Richard Biener, Kirill Yukhin,
	Andrey Turetskiy, Ilya Tocar, gcc-patches, Nathan Sidwell

[-- Attachment #1: Type: text/plain, Size: 3021 bytes --]

Hi!

On Sat, 8 Mar 2014 18:50:15 +0400, Ilya Verbin <iverbin@gmail.com> wrote:
> --- a/libgomp/libgomp.map
> +++ b/libgomp/libgomp.map
> @@ -208,6 +208,7 @@ GOMP_3.0 {
>  
>  GOMP_4.0 {
>    global:
> +	GOMP_offload_register;
>  	GOMP_barrier_cancel;
>  	GOMP_cancel;
>  	GOMP_cancellation_point;

Now that the GOMP_4.0 symbol version is being used in GCC trunk, and will
be in the GCC 4.9 release, can we still add new symbols to it here?
(Jakub?)

> --- a/libgomp/plugin-host.c
> +++ b/libgomp/plugin-host.c

> +const int TARGET_TYPE_HOST = 0;

We'll have to see whether this (that is, libgomp/target.c:enum
target_type) should live in a shared header file, but OK for the moment.

> +void
> +device_run (void *fn_ptr, void *vars)
> +{
> +#ifdef DEBUG
> +  printf ("libgomp plugin: %s:%s (%p, %p)\n", __FILE__, __FUNCTION__, fn_ptr,
> +	  vars);
> +#endif
> +
> +  void (*fn)(void *) = (void (*)(void *)) fn_ptr;
> +
> +  fn (vars);
> +}

Why not make fn_ptr a proper function pointer?  Ah, because of
GOMP_target passing (void *) tgt_fn->tgt->tgt_start for the
!TARGET_TYPE_HOST case...

Would it make sense to have device_run return a value to make it able to
indicate to libgomp that the function cannot be run on the device (for
whatever reason), and libgomp should use host-fallback execution?
(Probably that needs more thought and discussion, OK to defer.)

> --- a/libgomp/target.c
> +++ b/libgomp/target.c

> +enum target_type {
> +  TARGET_TYPE_HOST,
> +  TARGET_TYPE_INTEL_MIC
> +};

(As discussed above, but OK to defer.)

> @@ -120,15 +140,26 @@ struct gomp_device_descr
>       TARGET construct.  */
>    int id;
>  
> +  /* This is the TYPE of device.  */
> +  int type;

Use enum target_type instead of int?

> +/* This function should be called from every offload image.  It gets the
> +   descriptor of the host func and var tables HOST_TABLE, TYPE of the target,
> +   and TARGET_DATA needed by target plugin (target tables, etc.)  */
> +void
> +GOMP_offload_register (void *host_table, int type, void *target_data)
> +{
> +  offload_images = realloc (offload_images,
> +			    (num_offload_images + 1)
> +			    * sizeof (struct offload_image_descr));
> +
> +  if (offload_images == NULL)
> +    return;

Fail silently, or use gomp_realloc to fail loudly?

> @@ -701,16 +836,25 @@ gomp_find_available_plugins (void)

> - out:
> +out:

Emacs wants the space to be there, so I assume that's the coding standard
to use.  ;-)

>    if (dir)
>      closedir (dir);
> +  free (offload_images);

I suggest to set offload_images = NULL, for clarity.

> +  num_offload_images = 0;
>  }

We may need to revisit this later: currently it's not possible to
register additional plugins after libgomp has initialized
(gomp_target_init, gomp_find_available_plugins just executed once), but
should that ever be made possible, we'd need to preserve offload_images.


OK to commit, thanks!


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-03-17 15:12       ` Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation Thomas Schwinge
@ 2014-03-17 16:49         ` Jakub Jelinek
  2014-03-18 17:36         ` Ilya Verbin
  1 sibling, 0 replies; 62+ messages in thread
From: Jakub Jelinek @ 2014-03-17 16:49 UTC (permalink / raw)
  To: Thomas Schwinge
  Cc: Ilya Verbin, Bernd Schmidt, Michael V. Zolotukhin,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

On Mon, Mar 17, 2014 at 04:00:11PM +0100, Thomas Schwinge wrote:
> Hi!
> 
> On Sat, 8 Mar 2014 18:50:15 +0400, Ilya Verbin <iverbin@gmail.com> wrote:
> > --- a/libgomp/libgomp.map
> > +++ b/libgomp/libgomp.map
> > @@ -208,6 +208,7 @@ GOMP_3.0 {
> >  
> >  GOMP_4.0 {
> >    global:
> > +	GOMP_offload_register;
> >  	GOMP_barrier_cancel;
> >  	GOMP_cancel;
> >  	GOMP_cancellation_point;
> 
> Now that the GOMP_4.0 symbol version is being used in GCC trunk, and will
> be in the GCC 4.9 release, can we still add new symbols to it here?
> (Jakub?)

If GCC 4.9 release will not include that symbol, then it must be in a new
symbol version, e.g. GOMP_4.1 (note, the fact that GOMP_ symbol version
matched now the OpenMP standard version wasn't always true and might not be
true always either (or we could use GOMP_4.0.1 symver).

	Jakub

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-03-17 15:12       ` Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation Thomas Schwinge
  2014-03-17 16:49         ` Jakub Jelinek
@ 2014-03-18 17:36         ` Ilya Verbin
  1 sibling, 0 replies; 62+ messages in thread
From: Ilya Verbin @ 2014-03-18 17:36 UTC (permalink / raw)
  To: Thomas Schwinge
  Cc: Bernd Schmidt, Jakub Jelinek, Michael V. Zolotukhin,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

On 17 Mar 16:00, Thomas Schwinge wrote:
> >  GOMP_4.0 {
> >    global:
> > +	GOMP_offload_register;
> >  	GOMP_barrier_cancel;
> >  	GOMP_cancel;
> >  	GOMP_cancellation_point;
> 
> Now that the GOMP_4.0 symbol version is being used in GCC trunk, and will
> be in the GCC 4.9 release, can we still add new symbols to it here?
> (Jakub?)

I moved it to GOMP_4.0.1.

> > +  /* This is the TYPE of device.  */
> > +  int type;
> 
> Use enum target_type instead of int?

Done.

> > +  offload_images = realloc (offload_images,
> > +			    (num_offload_images + 1)
> > +			    * sizeof (struct offload_image_descr));
> > +
> > +  if (offload_images == NULL)
> > +    return;
> 
> Fail silently, or use gomp_realloc to fail loudly?

Replaced with gomp_realloc.

> >    if (dir)
> >      closedir (dir);
> > +  free (offload_images);
> 
> I suggest to set offload_images = NULL, for clarity.

Done.

> OK to commit, thanks!

Committed as r208657.


> Would it make sense to have device_run return a value to make it able to
> indicate to libgomp that the function cannot be run on the device (for
> whatever reason), and libgomp should use host-fallback execution?
> (Probably that needs more thought and discussion, OK to defer.)

Consider the following example (using OpenMP, I don't know OpenACC :)

int foo ()
{
  int x = 0;

  /* offload_fn1  */
  #pragma omp target map(to: x)
    {
      x += 5;
    }

  /* Some code on host without updating 'x' from target.  */

  /* offload_fn2  */
  #pragma omp target map(from: x)
    {
      x += 10;
    }

  return x;
}

If both offload_fn1 and offload_fn2 are executed on host, everything is fine
and x = 15.  The same goes to the case when both offload_fn1 and offload_fn2
are executed on target.  But if offload_fn1 is executed on target and
offload_fn2 is executed on host, then 'x' will have incorrect value (10).

Therefore, I proposed to check for target device availability only during
initialization of the plugin.  And to make a decision at this point, will
libgomp run all functions on host or on target.  Probably libgomp should return
an error if something was executed on device, but then it becomes unavailable.

  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-03-12 14:52                                 ` Ilya Verbin
@ 2014-03-20 17:41                                   ` Bernd Schmidt
  0 siblings, 0 replies; 62+ messages in thread
From: Bernd Schmidt @ 2014-03-20 17:41 UTC (permalink / raw)
  To: Ilya Verbin
  Cc: Thomas Schwinge, Michael V. Zolotukhin, Jakub Jelinek,
	Richard Biener, Kirill Yukhin, Andrey Turetskiy, Ilya Tocar,
	gcc-patches, Nathan Sidwell

On 03/12/2014 03:51 PM, Ilya Verbin wrote:
> 2014-03-12 18:12 GMT+04:00 Bernd Schmidt <bernds@codesourcery.com>:
>> LGTM. Shall I start committing my changes to the branch?
>
> Yes, I think you should commit your changes.
> And we will rewrite our part to use the new configure approach.

Done now.  I think/hope that I've committed all the ones that are not 
entirely related to ptx - let me know if you find there are any missing 
pieces.


Bernd


^ permalink raw reply	[flat|nested] 62+ messages in thread

* [gomp4] Mark __OPENMP_TARGET__ as addressable (was: Offloading patches (2/3): Add tables generation)
  2013-12-17 11:40 Michael V. Zolotukhin
  2014-01-16 11:37 ` Michael Zolotukhin
  2014-01-28 11:20 ` Bernd Schmidt
@ 2014-05-08  9:44 ` Thomas Schwinge
  2 siblings, 0 replies; 62+ messages in thread
From: Thomas Schwinge @ 2014-05-08  9:44 UTC (permalink / raw)
  To: Michael V. Zolotukhin
  Cc: Jakub Jelinek, Bernd Schmidt, Richard Biener, Kirill Yukhin,
	Ilya Verbin, Andrey Turetskiy, Ilya Tocar, gcc

[-- Attachment #1: Type: text/plain, Size: 4702 bytes --]

Hi!

On Tue, 17 Dec 2013 15:39:57 +0400, "Michael V. Zolotukhin" <michael.v.zolotukhin@gmail.com> wrote:
> in this patch we
> start to pass '__OPENMP_TARGET__' symbol to GOMP_target calls.

> --- a/gcc/omp-low.c
> +++ b/gcc/omp-low.c
> @@ -8371,19 +8372,22 @@ expand_omp_target (struct omp_region *region)
>      }
>  
>    gimple g;
> -  /* FIXME: This will be address of
> -     extern char __OPENMP_TARGET__[] __attribute__((visibility ("hidden")))
> -     symbol, as soon as the linker plugin is able to create it for us.  */
> -  tree openmp_target = build_zero_cst (ptr_type_node);
> +  tree openmp_target
> +    = build_decl (UNKNOWN_LOCATION, VAR_DECL,
> +		  get_identifier ("__OPENMP_TARGET__"), ptr_type_node);
> +  TREE_PUBLIC (openmp_target) = 1;
> +  DECL_EXTERNAL (openmp_target) = 1;
>    if (kind == GF_OMP_TARGET_KIND_REGION)
>      {
>        tree fnaddr = build_fold_addr_expr (child_fn);
> -      g = gimple_build_call (builtin_decl_explicit (start_ix), 7,
> -			     device, fnaddr, openmp_target, t1, t2, t3, t4);
> +      g = gimple_build_call (builtin_decl_explicit (start_ix), 7, device,
> +			     fnaddr, build_fold_addr_expr (openmp_target),
> +			     t1, t2, t3, t4);

In the trunk into gomp-4_0-branch merge that I'm currently preparing, all
offloading usage results in an ICE like:

    spawn [...]/build/gcc/xgcc -B[...]/build/gcc/ [...]/source/libgomp/testsuite/libgomp.c/target-1.c -B[...]/build/x86_64-unknown-linux-gnu/./libgomp/ -B[...]/build/x86_64-unknown-linux-gnu/./libgomp/.libs -I[...]/build/x86_64-unknown-linux-gnu/./libgomp -I[...]/source/libgomp/testsuite/.. -fmessage-length=0 -fno-diagnostics-show-caret -fdiagnostics-color=never -fopenmp -O2 -L[...]/build/x86_64-unknown-linux-gnu/./libgomp/.libs -lm -o ./target-1.exe
    [...]/source/libgomp/testsuite/libgomp.c/target-1.c: In function 'fn2':
    [...]/source/libgomp/testsuite/libgomp.c/target-1.c:46:3: error: address taken, but ADDRESSABLE bit not set
    __OPENMP_TARGET__
    [...]/source/libgomp/testsuite/libgomp.c/target-1.c:35:11: note: in statement
    __builtin_GOMP_target_data (-1, &__OPENMP_TARGET__, 1, &.omp_data_arr.12, &.omp_data_sizes.13, &.omp_data_kinds.14);
    [...]/source/libgomp/testsuite/libgomp.c/target-1.c:46:3: error: address taken, but ADDRESSABLE bit not set
    __OPENMP_TARGET__
    [...]/source/libgomp/testsuite/libgomp.c/target-1.c:37:13: note: in statement
    __builtin_GOMP_target (-1, fn2._omp_fn.0, &__OPENMP_TARGET__, 6, &.omp_data_arr.6, &.omp_data_sizes.7, &.omp_data_kinds.8);
    [...]/source/libgomp/testsuite/libgomp.c/target-1.c:46:3: error: address taken, but ADDRESSABLE bit not set
    __OPENMP_TARGET__
    [...]/source/libgomp/testsuite/libgomp.c/target-1.c:44:13: note: in statement
    __builtin_GOMP_target_update (-1, &__OPENMP_TARGET__, 2, &.omp_data_arr.9, &.omp_data_sizes.10, &.omp_data_kinds.11);
    [...]/source/libgomp/testsuite/libgomp.c/target-1.c:46:3: internal compiler error: verify_gimple failed
    0xa149ec verify_gimple_in_cfg(function*, bool)
            ../../source/gcc/tree-cfg.c:4954
    0x93a407 execute_function_todo
            ../../source/gcc/passes.c:1777
    0x93ad63 execute_todo
            ../../source/gcc/passes.c:1834

In r210207, I committed the following patch; should we also be setting
any additional flags, such as DECL_ARTIFICIAL?

commit aaf964a67612f5aa50b405d2aa7998ed3b5d5ac6
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu May 8 09:41:33 2014 +0000

    Mark __OPENMP_TARGET__ as addressable.
    
    	gcc/
    	* omp-low.c (get_offload_symbol_decl): Mark __OPENMP_TARGET__ as
    	addressable.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@210207 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp
index 1bd1f51..b1e73c0 100644
--- gcc/ChangeLog.gomp
+++ gcc/ChangeLog.gomp
@@ -1,3 +1,8 @@
+2014-05-08  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* omp-low.c (get_offload_symbol_decl): Mark __OPENMP_TARGET__ as
+	addressable.
+
 2014-04-04  Bernd Schmidt  <bernds@codesourcery.com>
 
 	* lto-wrapper.c (replace_special_characters): Remove functions and
diff --git gcc/omp-low.c gcc/omp-low.c
index de00516..5e90ce3 100644
--- gcc/omp-low.c
+++ gcc/omp-low.c
@@ -233,6 +233,7 @@ get_offload_symbol_decl (void)
       tree decl = build_decl (UNKNOWN_LOCATION, VAR_DECL,
 			      get_identifier ("__OPENMP_TARGET__"),
 			      ptr_type_node);
+      TREE_ADDRESSABLE (decl) = 1;
       TREE_PUBLIC (decl) = 1;
       DECL_EXTERNAL (decl) = 1;
       DECL_WEAK (decl) = 1;


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-02-28 21:41                   ` Bernd Schmidt
@ 2014-05-27 10:18                     ` Ilya Verbin
  2014-05-27 10:59                       ` Bernd Schmidt
  0 siblings, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-05-27 10:18 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: Jakub Jelinek, gcc-patches

2014-03-01 1:40 GMT+04:00 Bernd Schmidt <bernds@codesourcery.com>:
>> For your use case, I'd imagine the offload compiler would be built
>> relatively normally as a full build with
>> "--enable-as-accelerator-for=x86_64-linux", which would install it into
>> locations where the host will eventually be able to find it. Then the
>> host compiler would be built with another new configure option (as yet
>> unimplemented in my patch set) "--enable-offload-targets=mic,..." which
>> would tell the host compiler about the pre-built offload target
>> compilers.

Hi Bernd,

Could you please advise me how to build the offload gcc and target
libraries during the build of host gcc?
I see a possible way: to duplicate all modules in Makefile.def needed
for regular build of gcc and libs. But it looks ugly. Is there a
better solution?

Thanks,
  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-05-27 10:18                     ` Ilya Verbin
@ 2014-05-27 10:59                       ` Bernd Schmidt
  2014-05-27 11:11                         ` Ilya Verbin
  0 siblings, 1 reply; 62+ messages in thread
From: Bernd Schmidt @ 2014-05-27 10:59 UTC (permalink / raw)
  To: Ilya Verbin; +Cc: Jakub Jelinek, gcc-patches

On 05/27/2014 12:17 PM, Ilya Verbin wrote:
> 2014-03-01 1:40 GMT+04:00 Bernd Schmidt <bernds@codesourcery.com>:
>>> For your use case, I'd imagine the offload compiler would be built
>>> relatively normally as a full build with
>>> "--enable-as-accelerator-for=x86_64-linux", which would install it into
>>> locations where the host will eventually be able to find it. Then the
>>> host compiler would be built with another new configure option (as yet
>>> unimplemented in my patch set) "--enable-offload-targets=mic,..." which
>>> would tell the host compiler about the pre-built offload target
>>> compilers.
>
> Hi Bernd,
>
> Could you please advise me how to build the offload gcc and target
> libraries during the build of host gcc?

There isn't a way to do this. For ptx, target libraries can't be built 
anyway. For your use case, I'd recommend building the offload gcc first, 
installing it, and then building the host gcc with 
--enable-offload-targets as described above.


Bernd

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-05-27 10:59                       ` Bernd Schmidt
@ 2014-05-27 11:11                         ` Ilya Verbin
  2014-05-27 11:16                           ` Bernd Schmidt
  0 siblings, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-05-27 11:11 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: Jakub Jelinek, gcc-patches

2014-05-27 14:59 GMT+04:00 Bernd Schmidt <bernds@codesourcery.com>:
> There isn't a way to do this. For ptx, target libraries can't be built
> anyway. For your use case, I'd recommend building the offload gcc first,
> installing it, and then building the host gcc with --enable-offload-targets
> as described above.

Do I understand correctly that you recommend to build our offload gcc
manually, rather than during configure/make?

  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-05-27 11:11                         ` Ilya Verbin
@ 2014-05-27 11:16                           ` Bernd Schmidt
  2014-05-27 15:33                             ` Ilya Verbin
  0 siblings, 1 reply; 62+ messages in thread
From: Bernd Schmidt @ 2014-05-27 11:16 UTC (permalink / raw)
  To: Ilya Verbin; +Cc: Jakub Jelinek, gcc-patches

On 05/27/2014 01:11 PM, Ilya Verbin wrote:
> 2014-05-27 14:59 GMT+04:00 Bernd Schmidt <bernds@codesourcery.com>:
>> There isn't a way to do this. For ptx, target libraries can't be built
>> anyway. For your use case, I'd recommend building the offload gcc first,
>> installing it, and then building the host gcc with --enable-offload-targets
>> as described above.
>
> Do I understand correctly that you recommend to build our offload gcc
> manually, rather than during configure/make?

Well, configure/make it separately - build and install it first.

If there was a way to generalize the Makefiles to allow target libraries 
to be built for multiple targets, that would be pretty good too, but it 
might be too much work for too little gain.


Bernd

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-05-27 11:16                           ` Bernd Schmidt
@ 2014-05-27 15:33                             ` Ilya Verbin
  2014-05-27 19:03                               ` Bernd Schmidt
  0 siblings, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-05-27 15:33 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: Jakub Jelinek, gcc-patches

2014-05-27 15:15 GMT+04:00 Bernd Schmidt <bernds@codesourcery.com>:
> On 05/27/2014 01:11 PM, Ilya Verbin wrote:
>> Do I understand correctly that you recommend to build our offload gcc
>> manually, rather than during configure/make?
>
> Well, configure/make it separately - build and install it first.
>
> If there was a way to generalize the Makefiles to allow target libraries to
> be built for multiple targets, that would be pretty good too, but it might
> be too much work for too little gain.

Ok.

And what about the mkoffload tool? Should it be built during the build
of the host or offload compiler?
Do you have any patches for Makefile that builds it?

Thanks,
  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-05-27 15:33                             ` Ilya Verbin
@ 2014-05-27 19:03                               ` Bernd Schmidt
  0 siblings, 0 replies; 62+ messages in thread
From: Bernd Schmidt @ 2014-05-27 19:03 UTC (permalink / raw)
  To: Ilya Verbin; +Cc: Jakub Jelinek, gcc-patches

On 05/27/2014 05:33 PM, Ilya Verbin wrote:
> 2014-05-27 15:15 GMT+04:00 Bernd Schmidt <bernds@codesourcery.com>:
>> On 05/27/2014 01:11 PM, Ilya Verbin wrote:
>>> Do I understand correctly that you recommend to build our offload gcc
>>> manually, rather than during configure/make?
>>
>> Well, configure/make it separately - build and install it first.
>>
>> If there was a way to generalize the Makefiles to allow target libraries to
>> be built for multiple targets, that would be pretty good too, but it might
>> be too much work for too little gain.
>
> Ok.
>
> And what about the mkoffload tool? Should it be built during the build
> of the host or offload compiler?
> Do you have any patches for Makefile that builds it?

It should be built for the offload compiler, since it needs 
offload-target-specific knowledge. In our t-nvptx file we currently have

mkoffload.o: $(srcdir)/config/nvptx/mkoffload.c
         $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
           -DDEFAULT_REAL_TARGET_MACHINE=\"$(real_target_noncanonical)\" \
           -DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\" \
           $< $(OUTPUT_OPTION)

mkoffload$(exeext): mkoffload.o collect-utils.o libcommon-target.a 
$(LIBIBERTY) $(LIBDEPS)
         $(COMPILER) -o $@ mkoffload.o collect-utils.o 
libcommon-target.a $(LIBIBERTY) $(LIBS)

and in config.gcc:
nvptx-*)
         tm_file="${tm_file} newlib-stdint.h"
         tmake_file="nvptx/t-nvptx"
         if test x$enable_as_accelerator = xyes; then
                 extra_programs="mkoffload\$(exeext)"
         fi
         ;;

That's all that's needed to build it.


Bernd

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-02-28 16:23                 ` Bernd Schmidt
                                     ` (2 preceding siblings ...)
  2014-03-05 17:15                   ` Ilya Verbin
@ 2014-06-17 18:20                   ` Ilya Verbin
  2014-06-17 19:23                     ` Bernd Schmidt
  3 siblings, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-06-17 18:20 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Thomas Schwinge, Jakub Jelinek, Richard Biener, Kirill Yukhin,
	Andrey Turetskiy, Ilya Tocar, gcc-patches, Nathan Sidwell

Hello Bernd,

On 28 Feb 17:21, Bernd Schmidt wrote:
> For your use case, I'd imagine the offload compiler would be built
> relatively normally as a full build with
> "--enable-as-accelerator-for=x86_64-linux", which would install it
> into locations where the host will eventually be able to find it.
> Then the host compiler would be built with another new configure
> option (as yet unimplemented in my patch set)
> "--enable-offload-targets=mic,..." which would tell the host
> compiler about the pre-built offload target compilers. On the ptx

I don't get this part of the plan.  Where a host compiler will look for mkoffloads?

E.g., first I configure/make/install the target gcc and corresponding mkoffload with the following options:
--enable-accelerator=intelmic --enable-as-accelerator-for=x86_64-unknown-linux --prefix=/install_gcc/accel_intelmic

Next I configure/make/install the host gcc with:
--enable-accelerator=intelmic --prefix=/install_gcc/host

Now if I manually copy mkoffload from target's install dir into one of the dirs in host's $COMPILER_PATH,
then lto-wrapper finds it and everything works fine.
E.g.: mkdir -p /install_gcc/host/libexec/gcc/x86_64-unknown-linux-gnu/accel/intelmic/ &&
cp /install_gcc/accel_intelmic/libexec/gcc/x86_64-unknown-linux/4.10.0/accel/x86_64-unknown-linux-gnu/mkoffload
/install_gcc/host/libexec/gcc/x86_64-unknown-linux-gnu/accel/intelmic/

But what was your idea of how to tell host gcc about the path to mkoffload?

Thanks,
  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-06-17 18:20                   ` Ilya Verbin
@ 2014-06-17 19:23                     ` Bernd Schmidt
  2014-06-18 14:14                       ` Ilya Verbin
  0 siblings, 1 reply; 62+ messages in thread
From: Bernd Schmidt @ 2014-06-17 19:23 UTC (permalink / raw)
  To: Ilya Verbin
  Cc: Thomas Schwinge, Jakub Jelinek, Richard Biener, Kirill Yukhin,
	Andrey Turetskiy, Ilya Tocar, gcc-patches, Nathan Sidwell

On 06/17/2014 08:20 PM, Ilya Verbin wrote:
> Hello Bernd,
>
> On 28 Feb 17:21, Bernd Schmidt wrote:
>> For your use case, I'd imagine the offload compiler would be built
>> relatively normally as a full build with
>> "--enable-as-accelerator-for=x86_64-linux", which would install it
>> into locations where the host will eventually be able to find it.
>> Then the host compiler would be built with another new configure
>> option (as yet unimplemented in my patch set)
>> "--enable-offload-targets=mic,..." which would tell the host
>> compiler about the pre-built offload target compilers. On the ptx
>
> I don't get this part of the plan.  Where a host compiler will look for mkoffloads?
>
> E.g., first I configure/make/install the target gcc and corresponding mkoffload with the following options:
> --enable-accelerator=intelmic --enable-as-accelerator-for=x86_64-unknown-linux --prefix=/install_gcc/accel_intelmic
>
> Next I configure/make/install the host gcc with:
> --enable-accelerator=intelmic --prefix=/install_gcc/host

Try using the same prefix for both.


Bernd

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-06-17 19:23                     ` Bernd Schmidt
@ 2014-06-18 14:14                       ` Ilya Verbin
  2014-06-18 14:23                         ` Bernd Schmidt
  0 siblings, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-06-18 14:14 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Thomas Schwinge, Jakub Jelinek, Richard Biener, Kirill Yukhin,
	Andrey Turetskiy, Ilya Tocar, gcc-patches, Nathan Sidwell

On 17 Jun 21:22, Bernd Schmidt wrote:
> On 06/17/2014 08:20 PM, Ilya Verbin wrote:
> >I don't get this part of the plan.  Where a host compiler will look for mkoffloads?
> >
> >E.g., first I configure/make/install the target gcc and corresponding mkoffload with the following options:
> >--enable-accelerator=intelmic --enable-as-accelerator-for=x86_64-unknown-linux --prefix=/install_gcc/accel_intelmic
> >
> >Next I configure/make/install the host gcc with:
> >--enable-accelerator=intelmic --prefix=/install_gcc/host
> 
> Try using the same prefix for both.

I tried to do:
1. --enable-accelerator=intelmic --enable-as-accelerator-for=x86_64-intelmic-linux-gnu --prefix=/install_gcc/both
2. --enable-accelerator=intelmic --prefix=/install_gcc/both

In this case only bin/x86_64-intelmic-linux-gnu-accel-intelmic-gcc from accel compiler is saved.
All other binaries in bin, lib, lib64, libexec are replaced by host's ones.
Is there a way to have 2 working compilers and libs in the same prefix?

Thanks,
  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-06-18 14:14                       ` Ilya Verbin
@ 2014-06-18 14:23                         ` Bernd Schmidt
  2014-06-19 10:19                           ` Ilya Verbin
  0 siblings, 1 reply; 62+ messages in thread
From: Bernd Schmidt @ 2014-06-18 14:23 UTC (permalink / raw)
  To: Ilya Verbin
  Cc: Thomas Schwinge, Jakub Jelinek, Richard Biener, Kirill Yukhin,
	Andrey Turetskiy, Ilya Tocar, gcc-patches, Nathan Sidwell

On 06/18/2014 04:13 PM, Ilya Verbin wrote:
> On 17 Jun 21:22, Bernd Schmidt wrote:
>> On 06/17/2014 08:20 PM, Ilya Verbin wrote:
>>> I don't get this part of the plan.  Where a host compiler will look for mkoffloads?
>>>
>>> E.g., first I configure/make/install the target gcc and corresponding mkoffload with the following options:
>>> --enable-accelerator=intelmic --enable-as-accelerator-for=x86_64-unknown-linux --prefix=/install_gcc/accel_intelmic
>>>
>>> Next I configure/make/install the host gcc with:
>>> --enable-accelerator=intelmic --prefix=/install_gcc/host
>>
>> Try using the same prefix for both.
>
> I tried to do:
> 1. --enable-accelerator=intelmic --enable-as-accelerator-for=x86_64-intelmic-linux-gnu --prefix=/install_gcc/both
> 2. --enable-accelerator=intelmic --prefix=/install_gcc/both
>
> In this case only bin/x86_64-intelmic-linux-gnu-accel-intelmic-gcc from accel compiler is saved.
> All other binaries in bin, lib, lib64, libexec are replaced by host's ones.
> Is there a way to have 2 working compilers and libs in the same prefix?

Sure, as long as the target triplet is different.

What I think you need to do is
For the first compiler: --enable-as-accelerator-for=x86_64-pc-linux-gnu 
--target=x86_64-intelmic-linux-gnu --prefix=/somewhere
Build and install, then:
For the second: configure 
--enable-offload-targets=x86_64-intelmic-linux-gnu x86_64-pc-linux-gnu 
--prefix=/somewhere

No --enable-accelerator options at all. This should work, if it doesn't 
let me know what you find in /somewhere after installation for both 
compilers.


Bernd

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-06-18 14:23                         ` Bernd Schmidt
@ 2014-06-19 10:19                           ` Ilya Verbin
  2014-06-27  7:33                             ` Bernd Schmidt
  0 siblings, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-06-19 10:19 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Thomas Schwinge, Jakub Jelinek, Richard Biener, Kirill Yukhin,
	Andrey Turetskiy, Ilya Tocar, gcc-patches, Nathan Sidwell

On 18 Jun 16:22, Bernd Schmidt wrote:
> What I think you need to do is
> For the first compiler:
> --enable-as-accelerator-for=x86_64-pc-linux-gnu
> --target=x86_64-intelmic-linux-gnu --prefix=/somewhere
> 
> No --enable-accelerator options at all. This should work, if it
> doesn't let me know what you find in /somewhere after installation
> for both compilers.

It doesn't work without --enable-accelerator:

--enable-as-accelerator-for requires --enable-accelerator
make[1]: *** [configure-gcc] Error 1

  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-06-19 10:19                           ` Ilya Verbin
@ 2014-06-27  7:33                             ` Bernd Schmidt
  2014-07-07 14:51                               ` Ilya Verbin
  0 siblings, 1 reply; 62+ messages in thread
From: Bernd Schmidt @ 2014-06-27  7:33 UTC (permalink / raw)
  To: Ilya Verbin
  Cc: Thomas Schwinge, Jakub Jelinek, Richard Biener, Kirill Yukhin,
	Andrey Turetskiy, Ilya Tocar, gcc-patches, Nathan Sidwell

[-- Attachment #1: Type: text/plain, Size: 867 bytes --]

On 06/19/2014 12:19 PM, Ilya Verbin wrote:
> On 18 Jun 16:22, Bernd Schmidt wrote:
>> What I think you need to do is
>> For the first compiler:
>> --enable-as-accelerator-for=x86_64-pc-linux-gnu
>> --target=x86_64-intelmic-linux-gnu --prefix=/somewhere
>>
>> No --enable-accelerator options at all. This should work, if it
>> doesn't let me know what you find in /somewhere after installation
>> for both compilers.
>
> It doesn't work without --enable-accelerator:
>
> --enable-as-accelerator-for requires --enable-accelerator
> make[1]: *** [configure-gcc] Error 1

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).


Bernd


[-- Attachment #2: as-accel.diff --]
[-- Type: text/x-patch, Size: 4116 bytes --]

Index: configure.ac
===================================================================
--- configure.ac	(revision 435407)
+++ configure.ac	(working copy)
@@ -905,15 +905,12 @@ 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
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 435407)
+++ Makefile.in	(working copy)
@@ -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.
@@ -777,7 +776,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)')
 
@@ -3247,25 +3246,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.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-06-27  7:33                             ` Bernd Schmidt
@ 2014-07-07 14:51                               ` Ilya Verbin
  2014-07-07 15:04                                 ` Bernd Schmidt
  2014-07-23 14:18                                 ` Bernd Schmidt
  0 siblings, 2 replies; 62+ messages in thread
From: Ilya Verbin @ 2014-07-07 14:51 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Thomas Schwinge, Jakub Jelinek, Richard Biener, Kirill Yukhin,
	Andrey Turetskiy, Ilya Tocar, gcc-patches, Nathan Sidwell

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.

1) I tried to build accel compiler as a native x86_64-intelmic-linux-gnu compiler.  Then I installed host's x86_64-pc-linux-gnu into the same prefix.
In this case the are no collisions between the executables (cc1, etc.), but lib64 is common to both.  So libgomp.so from the host compiler overwrites libgomp.so from the accel compiler, but they need to be different.

2) Or should I build accel compiler as a cross from x86_64-pc-linux-gnu to x86_64-intelmic-linux-gnu?  Will it help to distinguish the libs?
Such a cross build will require additional changes to config files, since currently it can't find some of the binutils (--with-ar=/usr/bin/ar didn't help):
/bin/sh: line 7: x86_64-intelmic-linux-gnu-ar: command not found
make[2]: *** [libgcc.a] Error 127

Thanks,
  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-07-07 14:51                               ` Ilya Verbin
@ 2014-07-07 15:04                                 ` Bernd Schmidt
  2014-07-07 15:14                                   ` Jakub Jelinek
  2014-07-10 18:24                                   ` Ilya Verbin
  2014-07-23 14:18                                 ` Bernd Schmidt
  1 sibling, 2 replies; 62+ messages in thread
From: Bernd Schmidt @ 2014-07-07 15:04 UTC (permalink / raw)
  To: Ilya Verbin
  Cc: Thomas Schwinge, Jakub Jelinek, Richard Biener, Kirill Yukhin,
	Andrey Turetskiy, Ilya Tocar, gcc-patches, Nathan Sidwell

On 07/07/2014 04:50 PM, Ilya Verbin wrote:
> 2) Or should I build accel compiler as a cross from
> x86_64-pc-linux-gnu to x86_64-intelmic-linux-gnu?

Yes, that's the general idea.

> Will it help to distinguish the libs?

Is libgomp the only problematic one? (Does the accel compiler even need 
one?) It seems to be installed in /usr/lib rather than in a gcc-specific 
directory, which is a little surprising to me. It may be necessary to 
give the accel compiler a different sysroot to avoid library clashes.


Bernd

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-07-07 15:04                                 ` Bernd Schmidt
@ 2014-07-07 15:14                                   ` Jakub Jelinek
  2014-07-07 15:22                                     ` Jakub Jelinek
  2014-07-10 18:24                                   ` Ilya Verbin
  1 sibling, 1 reply; 62+ messages in thread
From: Jakub Jelinek @ 2014-07-07 15:14 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Ilya Verbin, Thomas Schwinge, Richard Biener, Kirill Yukhin,
	Andrey Turetskiy, Ilya Tocar, gcc-patches, Nathan Sidwell

On Mon, Jul 07, 2014 at 05:03:07PM +0200, Bernd Schmidt wrote:
> On 07/07/2014 04:50 PM, Ilya Verbin wrote:
> >2) Or should I build accel compiler as a cross from
> >x86_64-pc-linux-gnu to x86_64-intelmic-linux-gnu?
> 
> Yes, that's the general idea.
> 
> >Will it help to distinguish the libs?
> 
> Is libgomp the only problematic one? (Does the accel compiler even need
> one?) It seems to be installed in /usr/lib rather than in a gcc-specific
> directory, which is a little surprising to me. It may be necessary to give
> the accel compiler a different sysroot to avoid library clashes.

We need a libgomp for the offload targets to be different from the host
libgomp even on targets like mic, because there are various omp_* functions
that should behave differently.  Or the host libgomp needs to have a way how
to query whether it is invoked as offloading target library.
At least omp_is_default_device should return 0 when invoked inside of the
offloaded program (but, note that e.g. sshing into Intel MIC and running
there a program linked against -lgomp should return 1, because in that
case the MIC is the host device).
Other than that single function, I think on MIC/HSAIL that is the only thing
that needs to change, for PTX where you supposedly want to support more than
one team it is also the omp_get_num_teams and omp_get_team_num functions.

And yes, you need libgomp for the offloading targets, because at least in
OpenMP you can call lots of omp_* functions in the target regions, and can
use most of the #pragma omp * directives that actually need to have runtime
support too.  For offloading targets where you right now can't link stuff
I'm afraid you'll need to inline the parts of libgomp compiled for the PTX
(or HSAIL) targets manually during compilation (but what do you do for math
library functions, C functions etc.)?

	Jakub

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-07-07 15:14                                   ` Jakub Jelinek
@ 2014-07-07 15:22                                     ` Jakub Jelinek
  0 siblings, 0 replies; 62+ messages in thread
From: Jakub Jelinek @ 2014-07-07 15:22 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Ilya Verbin, Thomas Schwinge, Richard Biener, Kirill Yukhin,
	Andrey Turetskiy, Ilya Tocar, gcc-patches, Nathan Sidwell

On Mon, Jul 07, 2014 at 05:14:27PM +0200, Jakub Jelinek wrote:
> We need a libgomp for the offload targets to be different from the host
> libgomp even on targets like mic, because there are various omp_* functions
> that should behave differently.  Or the host libgomp needs to have a way how
> to query whether it is invoked as offloading target library.
> At least omp_is_default_device should return 0 when invoked inside of the
> offloaded program (but, note that e.g. sshing into Intel MIC and running
> there a program linked against -lgomp should return 1, because in that
> case the MIC is the host device).
> Other than that single function, I think on MIC/HSAIL that is the only thing
> that needs to change, for PTX where you supposedly want to support more than
> one team it is also the omp_get_num_teams and omp_get_team_num functions.

E.g. to use the same libgomp.so the solution could be for mkoffload to add
omp_is_default_device and omp_is_default_device_ functions to the binary,
where it will therefore override the symbol from libgomp.so.

	Jakub

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-07-07 15:04                                 ` Bernd Schmidt
  2014-07-07 15:14                                   ` Jakub Jelinek
@ 2014-07-10 18:24                                   ` Ilya Verbin
  2014-07-10 18:28                                     ` Bernd Schmidt
  1 sibling, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-07-10 18:24 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Thomas Schwinge, Jakub Jelinek, Richard Biener, Kirill Yukhin,
	Andrey Turetskiy, Ilya Tocar, gcc-patches, Nathan Sidwell

On 07 Jul 17:03, Bernd Schmidt wrote:
> Is libgomp the only problematic one? (Does the accel compiler even
> need one?) It seems to be installed in /usr/lib rather than in a
> gcc-specific directory, which is a little surprising to me. It may
> be necessary to give the accel compiler a different sysroot to avoid
> library clashes.

In the MIC case, not only libgomp is the problematic one.  Since, in general,
all libraries can be compiled for the MIC target, which can have an instruction
set that differs from the host's.

When mkoffload runs the accel compiler, it sets the LIBRARY_PATH env var,
telling where to find the libraries.  So, the question is how to specify this
installation directory for the accel's libraries during the configuration?
I tried the --libdir option for configure, but it affects only 'lib', but doesn't
affect 'lib64', because the path to 64 bit libs is determined in configure by
executing `$CC -print-multi-os-directory`, which returns "../lib64".

Probably I should somehow modify the spec string, so that under
ifdef ACCEL_COMPILER the multilib_os_dir will contain "../lib64/gcc/triplet",
instead of "../lib64"?

Thanks,
  -- Ilya

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-07-10 18:24                                   ` Ilya Verbin
@ 2014-07-10 18:28                                     ` Bernd Schmidt
  0 siblings, 0 replies; 62+ messages in thread
From: Bernd Schmidt @ 2014-07-10 18:28 UTC (permalink / raw)
  To: Ilya Verbin
  Cc: Thomas Schwinge, Jakub Jelinek, Richard Biener, Kirill Yukhin,
	Andrey Turetskiy, Ilya Tocar, gcc-patches, Nathan Sidwell

On 07/10/2014 08:24 PM, Ilya Verbin wrote:
> On 07 Jul 17:03, Bernd Schmidt wrote:
>> Is libgomp the only problematic one? (Does the accel compiler even
>> need one?) It seems to be installed in /usr/lib rather than in a
>> gcc-specific directory, which is a little surprising to me. It may
>> be necessary to give the accel compiler a different sysroot to avoid
>> library clashes.
>
> In the MIC case, not only libgomp is the problematic one.  Since, in general,
> all libraries can be compiled for the MIC target, which can have an instruction
> set that differs from the host's.
>
> When mkoffload runs the accel compiler, it sets the LIBRARY_PATH env var,
> telling where to find the libraries.  So, the question is how to specify this
> installation directory for the accel's libraries during the configuration?
> I tried the --libdir option for configure, but it affects only 'lib', but doesn't
> affect 'lib64', because the path to 64 bit libs is determined in configure by
> executing `$CC -print-multi-os-directory`, which returns "../lib64".
>
> Probably I should somehow modify the spec string, so that under
> ifdef ACCEL_COMPILER the multilib_os_dir will contain "../lib64/gcc/triplet",
> instead of "../lib64"?

I suspect you'll need to specify a --with-sysroot when building the mic 
toolchain. That'll contain all the pieces required for that toolchain, 
separate from whatever is installed for the host.


Bernd

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-07-07 14:51                               ` Ilya Verbin
  2014-07-07 15:04                                 ` Bernd Schmidt
@ 2014-07-23 14:18                                 ` Bernd Schmidt
  2014-07-23 14:40                                   ` Ilya Verbin
  2014-07-24 15:58                                   ` Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation Ilya Verbin
  1 sibling, 2 replies; 62+ messages in thread
From: Bernd Schmidt @ 2014-07-23 14:18 UTC (permalink / raw)
  To: Ilya Verbin
  Cc: Thomas Schwinge, Jakub Jelinek, Richard Biener, Kirill Yukhin,
	Andrey Turetskiy, Ilya Tocar, gcc-patches, Nathan Sidwell

[-- Attachment #1: Type: text/plain, Size: 830 bytes --]

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


[-- Attachment #2: newmf.diff --]
[-- Type: text/x-patch, Size: 8711 bytes --]

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
 	}
 
 #\f
-# 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 $@
-
-#\f
 # 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)
 

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-07-23 14:18                                 ` Bernd Schmidt
@ 2014-07-23 14:40                                   ` Ilya Verbin
  2014-08-04 21:00                                     ` Bernd Schmidt
  2014-07-24 15:58                                   ` Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation Ilya Verbin
  1 sibling, 1 reply; 62+ messages in thread
From: Ilya Verbin @ 2014-07-23 14:40 UTC (permalink / raw)
  To: Bernd Schmidt
  Cc: Thomas Schwinge, Jakub Jelinek, Richard Biener, Kirill Yukhin,
	Andrey Turetskiy, Ilya Tocar, gcc-patches, Nathan Sidwell

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

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-07-23 14:18                                 ` Bernd Schmidt
  2014-07-23 14:40                                   ` Ilya Verbin
@ 2014-07-24 15:58                                   ` Ilya Verbin
  1 sibling, 0 replies; 62+ messages in thread
From: Ilya Verbin @ 2014-07-24 15:58 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: Andrey Turetskiy, gcc-patches

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

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-07-23 14:40                                   ` Ilya Verbin
@ 2014-08-04 21:00                                     ` Bernd Schmidt
  2014-08-07 17:35                                       ` Thomas Schwinge
  0 siblings, 1 reply; 62+ messages in thread
From: Bernd Schmidt @ 2014-08-04 21:00 UTC (permalink / raw)
  To: Ilya Verbin
  Cc: Thomas Schwinge, Jakub Jelinek, Richard Biener, Kirill Yukhin,
	Andrey Turetskiy, Ilya Tocar, gcc-patches, Nathan Sidwell

[-- Attachment #1: Type: text/plain, Size: 711 bytes --]

On 07/23/2014 04:37 PM, Ilya Verbin wrote:
> 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.

I've committed this version to gomp-4_0-branch. This also includes the 
additional 'g' for the sed command you noticed.


Bernd



[-- Attachment #2: newmf2.diff --]
[-- Type: text/x-patch, Size: 39714 bytes --]

Index: ChangeLog.gomp
===================================================================
--- ChangeLog.gomp	(revision 213606)
+++ ChangeLog.gomp	(working copy)
@@ -1,3 +1,14 @@
+2014-08-04  Bernd Schmidt  <bernds@codesourcery.com>
+
+	* Makefile.def (accel-gcc host module): Remove, and all of its
+	dependencies too.
+	* Makefile.in: Regenerate.
+	* configure.ac (host_tools): Remove accel-gcc.
+	(enable-accelerator): Remove handling for this option.
+	(enable-offload-targets): Handle this instead.
+	(configdirs): Revert previous changes.
+	* configure: Regenerate.
+
 2014-06-12  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* configure.ac (--enable-target-gcc-configure-flags)
Index: Makefile.def
===================================================================
--- Makefile.def	(revision 213606)
+++ Makefile.def	(working copy)
@@ -46,10 +46,6 @@ host_modules= { module= gas; bootstrap=t
 host_modules= { module= gcc; bootstrap=true; 
 		extra_configure_flags='@extra_target_gcc_configure_flags@';
 		extra_make_flags="$(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS)"; };
-host_modules= { module= accel-gcc;
-	        module_srcdir=gcc;
-		extra_configure_flags='--enable-as-accelerator-for=$(target_alias) @extra_accelerator_gcc_configure_flags@';
-		extra_make_flags="$(EXTRA_ACCELERATOR_GCC_FLAGS)"; };
 host_modules= { module= gmp; lib_path=.libs; bootstrap=true;
 		extra_configure_flags='--disable-shared';
 		no_install= true;
@@ -322,7 +318,6 @@ dependencies = { module=all-gcc; on=all-
 dependencies = { module=all-gcc; on=all-mpfr; };
 dependencies = { module=all-gcc; on=all-mpc; };
 dependencies = { module=all-gcc; on=all-cloog; };
-dependencies = { module=all-gcc; on=all-accel-gcc; };
 dependencies = { module=all-gcc; on=all-build-texinfo; };
 dependencies = { module=all-gcc; on=all-build-bison; };
 dependencies = { module=all-gcc; on=all-build-flex; };
@@ -335,24 +330,6 @@ dependencies = { module=all-gcc; on=all-
 dependencies = { module=all-gcc; on=all-libiberty; };
 dependencies = { module=all-gcc; on=all-fixincludes; };
 dependencies = { module=all-gcc; on=all-lto-plugin; };
-dependencies = { module=all-accel-gcc; on=all-libiberty; hard=true; };
-dependencies = { module=all-accel-gcc; on=all-intl; };
-dependencies = { module=all-accel-gcc; on=all-mpfr; };
-dependencies = { module=all-accel-gcc; on=all-mpc; };
-dependencies = { module=all-accel-gcc; on=all-cloog; };
-dependencies = { module=all-accel-gcc; on=all-accel-gcc; };
-dependencies = { module=all-accel-gcc; on=all-build-texinfo; };
-dependencies = { module=all-accel-gcc; on=all-build-bison; };
-dependencies = { module=all-accel-gcc; on=all-build-flex; };
-dependencies = { module=all-accel-gcc; on=all-build-libiberty; };
-dependencies = { module=all-accel-gcc; on=all-build-fixincludes; };
-dependencies = { module=all-accel-gcc; on=all-zlib; };
-dependencies = { module=all-accel-gcc; on=all-libbacktrace; hard=true; };
-dependencies = { module=all-accel-gcc; on=all-libcpp; hard=true; };
-dependencies = { module=all-accel-gcc; on=all-libdecnumber; hard=true; };
-dependencies = { module=all-accel-gcc; on=all-libiberty; };
-dependencies = { module=all-accel-gcc; on=all-fixincludes; };
-dependencies = { module=all-accel-gcc; on=all-lto-plugin; };
 dependencies = { module=info-gcc; on=all-build-libiberty; };
 dependencies = { module=dvi-gcc; on=all-build-libiberty; };
 dependencies = { module=pdf-gcc; on=all-build-libiberty; };
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 213606)
+++ Makefile.in	(working copy)
@@ -899,7 +899,6 @@ configure-host:  \
     maybe-configure-flex \
     maybe-configure-gas \
     maybe-configure-gcc \
-    maybe-configure-accel-gcc \
     maybe-configure-gmp \
     maybe-configure-mpfr \
     maybe-configure-mpc \
@@ -1020,7 +1019,6 @@ all-host: maybe-all-gas
 @if gcc-no-bootstrap
 all-host: maybe-all-gcc
 @endif gcc-no-bootstrap
-all-host: maybe-all-accel-gcc
 @if gmp-no-bootstrap
 all-host: maybe-all-gmp
 @endif gmp-no-bootstrap
@@ -1152,7 +1150,6 @@ info-host: maybe-info-fixincludes
 info-host: maybe-info-flex
 info-host: maybe-info-gas
 info-host: maybe-info-gcc
-info-host: maybe-info-accel-gcc
 info-host: maybe-info-gmp
 info-host: maybe-info-mpfr
 info-host: maybe-info-mpc
@@ -1237,7 +1234,6 @@ dvi-host: maybe-dvi-fixincludes
 dvi-host: maybe-dvi-flex
 dvi-host: maybe-dvi-gas
 dvi-host: maybe-dvi-gcc
-dvi-host: maybe-dvi-accel-gcc
 dvi-host: maybe-dvi-gmp
 dvi-host: maybe-dvi-mpfr
 dvi-host: maybe-dvi-mpc
@@ -1322,7 +1318,6 @@ pdf-host: maybe-pdf-fixincludes
 pdf-host: maybe-pdf-flex
 pdf-host: maybe-pdf-gas
 pdf-host: maybe-pdf-gcc
-pdf-host: maybe-pdf-accel-gcc
 pdf-host: maybe-pdf-gmp
 pdf-host: maybe-pdf-mpfr
 pdf-host: maybe-pdf-mpc
@@ -1407,7 +1402,6 @@ html-host: maybe-html-fixincludes
 html-host: maybe-html-flex
 html-host: maybe-html-gas
 html-host: maybe-html-gcc
-html-host: maybe-html-accel-gcc
 html-host: maybe-html-gmp
 html-host: maybe-html-mpfr
 html-host: maybe-html-mpc
@@ -1492,7 +1486,6 @@ TAGS-host: maybe-TAGS-fixincludes
 TAGS-host: maybe-TAGS-flex
 TAGS-host: maybe-TAGS-gas
 TAGS-host: maybe-TAGS-gcc
-TAGS-host: maybe-TAGS-accel-gcc
 TAGS-host: maybe-TAGS-gmp
 TAGS-host: maybe-TAGS-mpfr
 TAGS-host: maybe-TAGS-mpc
@@ -1577,7 +1570,6 @@ install-info-host: maybe-install-info-fi
 install-info-host: maybe-install-info-flex
 install-info-host: maybe-install-info-gas
 install-info-host: maybe-install-info-gcc
-install-info-host: maybe-install-info-accel-gcc
 install-info-host: maybe-install-info-gmp
 install-info-host: maybe-install-info-mpfr
 install-info-host: maybe-install-info-mpc
@@ -1662,7 +1654,6 @@ install-pdf-host: maybe-install-pdf-fixi
 install-pdf-host: maybe-install-pdf-flex
 install-pdf-host: maybe-install-pdf-gas
 install-pdf-host: maybe-install-pdf-gcc
-install-pdf-host: maybe-install-pdf-accel-gcc
 install-pdf-host: maybe-install-pdf-gmp
 install-pdf-host: maybe-install-pdf-mpfr
 install-pdf-host: maybe-install-pdf-mpc
@@ -1747,7 +1738,6 @@ install-html-host: maybe-install-html-fi
 install-html-host: maybe-install-html-flex
 install-html-host: maybe-install-html-gas
 install-html-host: maybe-install-html-gcc
-install-html-host: maybe-install-html-accel-gcc
 install-html-host: maybe-install-html-gmp
 install-html-host: maybe-install-html-mpfr
 install-html-host: maybe-install-html-mpc
@@ -1832,7 +1822,6 @@ installcheck-host: maybe-installcheck-fi
 installcheck-host: maybe-installcheck-flex
 installcheck-host: maybe-installcheck-gas
 installcheck-host: maybe-installcheck-gcc
-installcheck-host: maybe-installcheck-accel-gcc
 installcheck-host: maybe-installcheck-gmp
 installcheck-host: maybe-installcheck-mpfr
 installcheck-host: maybe-installcheck-mpc
@@ -1917,7 +1906,6 @@ mostlyclean-host: maybe-mostlyclean-fixi
 mostlyclean-host: maybe-mostlyclean-flex
 mostlyclean-host: maybe-mostlyclean-gas
 mostlyclean-host: maybe-mostlyclean-gcc
-mostlyclean-host: maybe-mostlyclean-accel-gcc
 mostlyclean-host: maybe-mostlyclean-gmp
 mostlyclean-host: maybe-mostlyclean-mpfr
 mostlyclean-host: maybe-mostlyclean-mpc
@@ -2002,7 +1990,6 @@ clean-host: maybe-clean-fixincludes
 clean-host: maybe-clean-flex
 clean-host: maybe-clean-gas
 clean-host: maybe-clean-gcc
-clean-host: maybe-clean-accel-gcc
 clean-host: maybe-clean-gmp
 clean-host: maybe-clean-mpfr
 clean-host: maybe-clean-mpc
@@ -2087,7 +2074,6 @@ distclean-host: maybe-distclean-fixinclu
 distclean-host: maybe-distclean-flex
 distclean-host: maybe-distclean-gas
 distclean-host: maybe-distclean-gcc
-distclean-host: maybe-distclean-accel-gcc
 distclean-host: maybe-distclean-gmp
 distclean-host: maybe-distclean-mpfr
 distclean-host: maybe-distclean-mpc
@@ -2172,7 +2158,6 @@ maintainer-clean-host: maybe-maintainer-
 maintainer-clean-host: maybe-maintainer-clean-flex
 maintainer-clean-host: maybe-maintainer-clean-gas
 maintainer-clean-host: maybe-maintainer-clean-gcc
-maintainer-clean-host: maybe-maintainer-clean-accel-gcc
 maintainer-clean-host: maybe-maintainer-clean-gmp
 maintainer-clean-host: maybe-maintainer-clean-mpfr
 maintainer-clean-host: maybe-maintainer-clean-mpc
@@ -2312,7 +2297,6 @@ check-host:  \
     maybe-check-flex \
     maybe-check-gas \
     maybe-check-gcc \
-    maybe-check-accel-gcc \
     maybe-check-gmp \
     maybe-check-mpfr \
     maybe-check-mpc \
@@ -2423,7 +2407,6 @@ install-host-nogcc:  \
     maybe-install-fixincludes \
     maybe-install-flex \
     maybe-install-gas \
-    maybe-install-accel-gcc \
     maybe-install-gmp \
     maybe-install-mpfr \
     maybe-install-mpc \
@@ -2472,7 +2455,6 @@ install-host:  \
     maybe-install-flex \
     maybe-install-gas \
     maybe-install-gcc \
-    maybe-install-accel-gcc \
     maybe-install-gmp \
     maybe-install-mpfr \
     maybe-install-mpc \
@@ -2577,7 +2559,6 @@ install-strip-host:  \
     maybe-install-strip-flex \
     maybe-install-strip-gas \
     maybe-install-strip-gcc \
-    maybe-install-strip-accel-gcc \
     maybe-install-strip-gmp \
     maybe-install-strip-mpfr \
     maybe-install-strip-mpc \
@@ -10974,450 +10955,6 @@ maintainer-clean-gcc:
 
 
 
-.PHONY: configure-accel-gcc maybe-configure-accel-gcc
-maybe-configure-accel-gcc:
-@if gcc-bootstrap
-configure-accel-gcc: stage_current
-@endif gcc-bootstrap
-@if accel-gcc
-maybe-configure-accel-gcc: configure-accel-gcc
-configure-accel-gcc: 
-	@: $(MAKE); $(unstage)
-	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	test ! -f $(HOST_SUBDIR)/accel-gcc/Makefile || exit 0; \
-	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/accel-gcc ; \
-	$(HOST_EXPORTS)  \
-	echo Configuring in $(HOST_SUBDIR)/accel-gcc; \
-	 \
-	this_target="$(accel_target_alias)"; \
-	 \
-	cd "$(HOST_SUBDIR)/accel-gcc" || exit 1; \
-	case $(srcdir) in \
-	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-	  *) topdir=`echo $(HOST_SUBDIR)/accel-gcc/ | \
-		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
-	esac; \
-	module_srcdir=gcc; \
-	$(SHELL) \
-	  $$s/$$module_srcdir/configure \
-	  --srcdir=$${topdir}/$$module_srcdir \
-	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target} --enable-as-accelerator-for=$(target_alias) @extra_accelerator_gcc_configure_flags@ \
-	  || exit 1
-@endif accel-gcc
-
-
-
-
-
-.PHONY: all-accel-gcc maybe-all-accel-gcc
-maybe-all-accel-gcc:
-@if gcc-bootstrap
-all-accel-gcc: stage_current
-@endif gcc-bootstrap
-@if accel-gcc
-TARGET-accel-gcc=all
-maybe-all-accel-gcc: all-accel-gcc
-all-accel-gcc: configure-accel-gcc
-	@: $(MAKE); $(unstage)
-	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS)  \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS) $(EXTRA_ACCELERATOR_GCC_FLAGS) \
-		$(TARGET-accel-gcc))
-@endif accel-gcc
-
-
-
-
-.PHONY: check-accel-gcc maybe-check-accel-gcc
-maybe-check-accel-gcc:
-@if accel-gcc
-maybe-check-accel-gcc: check-accel-gcc
-
-check-accel-gcc:
-	@: $(MAKE); $(unstage)
-	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_ACCELERATOR_GCC_FLAGS) check)
-
-@endif accel-gcc
-
-.PHONY: install-accel-gcc maybe-install-accel-gcc
-maybe-install-accel-gcc:
-@if accel-gcc
-maybe-install-accel-gcc: install-accel-gcc
-
-install-accel-gcc: installdirs
-	@: $(MAKE); $(unstage)
-	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_ACCELERATOR_GCC_FLAGS) install)
-
-@endif accel-gcc
-
-.PHONY: install-strip-accel-gcc maybe-install-strip-accel-gcc
-maybe-install-strip-accel-gcc:
-@if accel-gcc
-maybe-install-strip-accel-gcc: install-strip-accel-gcc
-
-install-strip-accel-gcc: installdirs
-	@: $(MAKE); $(unstage)
-	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_ACCELERATOR_GCC_FLAGS) install-strip)
-
-@endif accel-gcc
-
-# Other targets (info, dvi, pdf, etc.)
-
-.PHONY: maybe-info-accel-gcc info-accel-gcc
-maybe-info-accel-gcc:
-@if accel-gcc
-maybe-info-accel-gcc: info-accel-gcc
-
-info-accel-gcc: \
-    configure-accel-gcc 
-	@: $(MAKE); $(unstage)
-	@[ -f ./accel-gcc/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_ACCELERATOR_GCC_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing info in accel-gcc" ; \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          info) \
-	  || exit 1
-
-@endif accel-gcc
-
-.PHONY: maybe-dvi-accel-gcc dvi-accel-gcc
-maybe-dvi-accel-gcc:
-@if accel-gcc
-maybe-dvi-accel-gcc: dvi-accel-gcc
-
-dvi-accel-gcc: \
-    configure-accel-gcc 
-	@: $(MAKE); $(unstage)
-	@[ -f ./accel-gcc/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_ACCELERATOR_GCC_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing dvi in accel-gcc" ; \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          dvi) \
-	  || exit 1
-
-@endif accel-gcc
-
-.PHONY: maybe-pdf-accel-gcc pdf-accel-gcc
-maybe-pdf-accel-gcc:
-@if accel-gcc
-maybe-pdf-accel-gcc: pdf-accel-gcc
-
-pdf-accel-gcc: \
-    configure-accel-gcc 
-	@: $(MAKE); $(unstage)
-	@[ -f ./accel-gcc/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_ACCELERATOR_GCC_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing pdf in accel-gcc" ; \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          pdf) \
-	  || exit 1
-
-@endif accel-gcc
-
-.PHONY: maybe-html-accel-gcc html-accel-gcc
-maybe-html-accel-gcc:
-@if accel-gcc
-maybe-html-accel-gcc: html-accel-gcc
-
-html-accel-gcc: \
-    configure-accel-gcc 
-	@: $(MAKE); $(unstage)
-	@[ -f ./accel-gcc/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_ACCELERATOR_GCC_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing html in accel-gcc" ; \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          html) \
-	  || exit 1
-
-@endif accel-gcc
-
-.PHONY: maybe-TAGS-accel-gcc TAGS-accel-gcc
-maybe-TAGS-accel-gcc:
-@if accel-gcc
-maybe-TAGS-accel-gcc: TAGS-accel-gcc
-
-TAGS-accel-gcc: \
-    configure-accel-gcc 
-	@: $(MAKE); $(unstage)
-	@[ -f ./accel-gcc/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_ACCELERATOR_GCC_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing TAGS in accel-gcc" ; \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          TAGS) \
-	  || exit 1
-
-@endif accel-gcc
-
-.PHONY: maybe-install-info-accel-gcc install-info-accel-gcc
-maybe-install-info-accel-gcc:
-@if accel-gcc
-maybe-install-info-accel-gcc: install-info-accel-gcc
-
-install-info-accel-gcc: \
-    configure-accel-gcc \
-    info-accel-gcc 
-	@: $(MAKE); $(unstage)
-	@[ -f ./accel-gcc/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_ACCELERATOR_GCC_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing install-info in accel-gcc" ; \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          install-info) \
-	  || exit 1
-
-@endif accel-gcc
-
-.PHONY: maybe-install-pdf-accel-gcc install-pdf-accel-gcc
-maybe-install-pdf-accel-gcc:
-@if accel-gcc
-maybe-install-pdf-accel-gcc: install-pdf-accel-gcc
-
-install-pdf-accel-gcc: \
-    configure-accel-gcc \
-    pdf-accel-gcc 
-	@: $(MAKE); $(unstage)
-	@[ -f ./accel-gcc/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_ACCELERATOR_GCC_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing install-pdf in accel-gcc" ; \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          install-pdf) \
-	  || exit 1
-
-@endif accel-gcc
-
-.PHONY: maybe-install-html-accel-gcc install-html-accel-gcc
-maybe-install-html-accel-gcc:
-@if accel-gcc
-maybe-install-html-accel-gcc: install-html-accel-gcc
-
-install-html-accel-gcc: \
-    configure-accel-gcc \
-    html-accel-gcc 
-	@: $(MAKE); $(unstage)
-	@[ -f ./accel-gcc/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_ACCELERATOR_GCC_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing install-html in accel-gcc" ; \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          install-html) \
-	  || exit 1
-
-@endif accel-gcc
-
-.PHONY: maybe-installcheck-accel-gcc installcheck-accel-gcc
-maybe-installcheck-accel-gcc:
-@if accel-gcc
-maybe-installcheck-accel-gcc: installcheck-accel-gcc
-
-installcheck-accel-gcc: \
-    configure-accel-gcc 
-	@: $(MAKE); $(unstage)
-	@[ -f ./accel-gcc/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_ACCELERATOR_GCC_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing installcheck in accel-gcc" ; \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          installcheck) \
-	  || exit 1
-
-@endif accel-gcc
-
-.PHONY: maybe-mostlyclean-accel-gcc mostlyclean-accel-gcc
-maybe-mostlyclean-accel-gcc:
-@if accel-gcc
-maybe-mostlyclean-accel-gcc: mostlyclean-accel-gcc
-
-mostlyclean-accel-gcc: 
-	@: $(MAKE); $(unstage)
-	@[ -f ./accel-gcc/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_ACCELERATOR_GCC_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing mostlyclean in accel-gcc" ; \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          mostlyclean) \
-	  || exit 1
-
-@endif accel-gcc
-
-.PHONY: maybe-clean-accel-gcc clean-accel-gcc
-maybe-clean-accel-gcc:
-@if accel-gcc
-maybe-clean-accel-gcc: clean-accel-gcc
-
-clean-accel-gcc: 
-	@: $(MAKE); $(unstage)
-	@[ -f ./accel-gcc/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_ACCELERATOR_GCC_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing clean in accel-gcc" ; \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          clean) \
-	  || exit 1
-
-@endif accel-gcc
-
-.PHONY: maybe-distclean-accel-gcc distclean-accel-gcc
-maybe-distclean-accel-gcc:
-@if accel-gcc
-maybe-distclean-accel-gcc: distclean-accel-gcc
-
-distclean-accel-gcc: 
-	@: $(MAKE); $(unstage)
-	@[ -f ./accel-gcc/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_ACCELERATOR_GCC_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing distclean in accel-gcc" ; \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          distclean) \
-	  || exit 1
-
-@endif accel-gcc
-
-.PHONY: maybe-maintainer-clean-accel-gcc maintainer-clean-accel-gcc
-maybe-maintainer-clean-accel-gcc:
-@if accel-gcc
-maybe-maintainer-clean-accel-gcc: maintainer-clean-accel-gcc
-
-maintainer-clean-accel-gcc: 
-	@: $(MAKE); $(unstage)
-	@[ -f ./accel-gcc/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_ACCELERATOR_GCC_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing maintainer-clean in accel-gcc" ; \
-	(cd $(HOST_SUBDIR)/accel-gcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          maintainer-clean) \
-	  || exit 1
-
-@endif accel-gcc
-
-
-
 .PHONY: configure-gmp maybe-configure-gmp
 maybe-configure-gmp:
 @if gcc-bootstrap
@@ -48846,7 +48383,6 @@ all-stage3-gcc: maybe-all-stage3-cloog
 all-stage4-gcc: maybe-all-stage4-cloog
 all-stageprofile-gcc: maybe-all-stageprofile-cloog
 all-stagefeedback-gcc: maybe-all-stagefeedback-cloog
-all-gcc: maybe-all-accel-gcc
 all-gcc: maybe-all-build-texinfo
 
 all-stage1-gcc: maybe-all-build-texinfo
@@ -48943,24 +48479,6 @@ all-stage3-gcc: maybe-all-stage3-lto-plu
 all-stage4-gcc: maybe-all-stage4-lto-plugin
 all-stageprofile-gcc: maybe-all-stageprofile-lto-plugin
 all-stagefeedback-gcc: maybe-all-stagefeedback-lto-plugin
-all-accel-gcc: all-libiberty
-all-accel-gcc: maybe-all-intl
-all-accel-gcc: maybe-all-mpfr
-all-accel-gcc: maybe-all-mpc
-all-accel-gcc: maybe-all-cloog
-all-accel-gcc: maybe-all-accel-gcc
-all-accel-gcc: maybe-all-build-texinfo
-all-accel-gcc: maybe-all-build-bison
-all-accel-gcc: maybe-all-build-flex
-all-accel-gcc: maybe-all-build-libiberty
-all-accel-gcc: maybe-all-build-fixincludes
-all-accel-gcc: maybe-all-zlib
-all-accel-gcc: all-libbacktrace
-all-accel-gcc: all-libcpp
-all-accel-gcc: all-libdecnumber
-all-accel-gcc: maybe-all-libiberty
-all-accel-gcc: maybe-all-fixincludes
-all-accel-gcc: maybe-all-lto-plugin
 info-gcc: maybe-all-build-libiberty
 
 info-stage1-gcc: maybe-all-build-libiberty
Index: configure
===================================================================
--- configure	(revision 213606)
+++ configure	(working copy)
@@ -754,7 +754,7 @@ ospace_frag'
 ac_user_opts='
 enable_option_checking
 with_build_libsubdir
-enable_accelerator
+enable_offload_targets
 enable_target_gcc_configure_flags
 enable_accelerator_gcc_configure_flags
 enable_gold
@@ -1476,9 +1476,8 @@ 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-accelerator[=ARG]
-                          build accelerator
-                          [ARG={no,auto-device-triplet,device-triplet}]
+  --enable-offload-targets=LIST
+                          enable offloading to devices from LIST
   --enable-target-gcc-configure-flags=FLAGS
                           additional flags for configuring the target GCC
                           [none]
@@ -2789,7 +2788,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 \
@@ -2954,38 +2953,19 @@ 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'.
-# Check whether --enable-accelerator was given.
-if test "${enable_accelerator+set}" = set; then :
-  enableval=$enable_accelerator; ENABLE_ACCELERATOR=$enableval
+offload_targets=
+
+# 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_ACCELERATOR=no
+  enable_offload_targets=
 fi
 
-accel_target_noncanonical=NONE
-case "${ENABLE_ACCELERATOR}" in
-  yes)
-    as_fn_error "--enable-accelerators must name accelerator" "$LINENO" 5
-    skipdirs="${skipdirs} accel-gcc"
-    ;;
-  no)
-    skipdirs="${skipdirs} accel-gcc"
-    ;;
-  auto-nvptx*|nvptx*)
-    accel_target_noncanonical=`echo "$ENABLE_ACCELERATOR" | sed -e s/auto-//g`
-    ;;
-  *)
-    as_fn_error "unrecognized accelerator" "$LINENO" 5
-    skipdirs="${skipdirs} accel-gcc"
-    ;;
-esac
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking accelerator target system type" >&5
 $as_echo_n "checking accelerator target system type... " >&6; }
@@ -6770,15 +6750,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: configure.ac
===================================================================
--- configure.ac	(revision 213606)
+++ configure.ac	(working copy)
@@ -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
 
@@ -2187,15 +2167,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/ChangeLog.gomp
===================================================================
--- gcc/ChangeLog.gomp	(revision 213606)
+++ gcc/ChangeLog.gomp	(working copy)
@@ -1,3 +1,12 @@
+2014-08-04  Bernd Schmidt  <bernds@codesourcery.com>
+
+	* Makefile.in (tool_prefix): Remove.
+	(unlibsubdir): Change depending on enable_as_accelerator.
+	(GCC_TARGET_INSTALL_NAME): Revert previous change.
+	(install_driver): Rework offloading changes.
+	* configure.ac (tool_prefix): Remove.
+	(enable-as-accelerator-for): Don't require --enable-as-accelerator.
+	Update the program_transform_name
 2014-07-28  Cesar Philippidis  <cesar@codesourcery.com>
 
 	* omp-low.c (get_base_type): New function.
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 213606)
+++ gcc/Makefile.in	(working copy)
@@ -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.
@@ -604,7 +603,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:
@@ -774,7 +777,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)')
 
@@ -3227,25 +3230,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
===================================================================
--- gcc/configure	(revision 213606)
+++ gcc/configure	(working copy)
@@ -612,7 +612,6 @@ GMPINC
 GMPLIBS
 accel_dir_suffix
 real_target_noncanonical
-tool_prefix
 target_cpu_default
 fortran_target_objs
 cxx_target_objs
@@ -3209,7 +3208,6 @@ esac
 
 # Used for constructing correct paths for offload compilers.
 real_target_noncanonical=${target_noncanonical}
-tool_prefix=$target_noncanonical
 accel_dir_suffix=
 
 # Determine the target- and build-specific subdirectories
@@ -7429,15 +7427,12 @@ fi
 # Check whether --enable-as-accelerator-for was given.
 if test "${enable_as_accelerator_for+set}" = set; then :
   enableval=$enable_as_accelerator_for;
-  if test $enable_accelerator = no; then
-    echo "--enable-as-accelerator-for requires --enable-accelerator"
-    exit 1;
-  fi
 
 $as_echo "#define ACCEL_COMPILER 1" >>confdefs.h
 
   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}
 
@@ -7465,7 +7460,7 @@ else
 fi
 
 
-offload_targets=`echo $offload_targets | sed -e 's#,#:#'`
+offload_targets=`echo $offload_targets | sed -e 's#,#:#g'`
 
 cat >>confdefs.h <<_ACEOF
 #define OFFLOAD_TARGETS "$offload_targets"
@@ -18119,7 +18114,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18122 "configure"
+#line 18117 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18225,7 +18220,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18228 "configure"
+#line 18223 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -27892,7 +27887,6 @@ fi
 
 
 
-
 
 
 
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 213606)
+++ gcc/configure.ac	(working copy)
@@ -40,7 +40,6 @@ ACX_NONCANONICAL_TARGET
 
 # Used for constructing correct paths for offload compilers.
 real_target_noncanonical=${target_noncanonical}
-tool_prefix=$target_noncanonical
 accel_dir_suffix=
 
 # Determine the target- and build-specific subdirectories
@@ -904,15 +903,12 @@ 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}
 ], [enable_as_accelerator=no])
@@ -933,7 +929,7 @@ AC_ARG_ENABLE(offload-targets,
   fi
 ], [enable_accelerator=no])
 AC_SUBST(enable_accelerator)
-offload_targets=`echo $offload_targets | sed -e 's#,#:#'`
+offload_targets=`echo $offload_targets | sed -e 's#,#:#g'`
 AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
  [Define to hold the list of target names suitable for offloading.])
 if test x$offload_targets != x; then
@@ -5546,7 +5542,6 @@ AC_SUBST(c_target_objs)
 AC_SUBST(cxx_target_objs)
 AC_SUBST(fortran_target_objs)
 AC_SUBST(target_cpu_default)
-AC_SUBST(tool_prefix)
 AC_SUBST(real_target_noncanonical)
 AC_SUBST(accel_dir_suffix)
 

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
  2014-08-04 21:00                                     ` Bernd Schmidt
@ 2014-08-07 17:35                                       ` Thomas Schwinge
  2014-09-05 16:36                                         ` [gomp4] Revert more old Makefile/configure bits Bernd Schmidt
  0 siblings, 1 reply; 62+ messages in thread
From: Thomas Schwinge @ 2014-08-07 17:35 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1940 bytes --]

Hi Bernd!

On Mon, 4 Aug 2014 23:00:07 +0200, Bernd Schmidt <bernds@codesourcery.com> wrote:
> On 07/23/2014 04:37 PM, Ilya Verbin wrote:
> > 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.

> I've committed this version to gomp-4_0-branch.

Diffing against the last merge base, I see some accel-gcc mentions still
remain in the build system, which I assume can also be removed now?  That
is, accel_target_* stuff in Makefile.def and Makefile.tpl.

As we now no longer build accel-gcc, my commit r211513 »Different
configure and make flags for target vs. accelerator GCC« should be
reverted, too.

The »accelerator target system type« check complains:

    $ ../source/configure --prefix=[...] --disable-bootstrap --enable-languages=c,c++,fortran,lto --disable-multilib [...]
    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-unknown-linux-gnu
    checking target system type... x86_64-unknown-linux-gnu
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether ln works... yes
    checking whether ln -s works... yes
    checking for a sed that does not truncate output... /bin/sed
    checking for gawk... gawk
    checking accelerator target system type... config.sub: missing argument
    Try `config.sub --help' for more information.
    
    checking for libatomic support... yes

I suspect this is due to:

> --- configure.ac	(revision 213606)
> +++ configure.ac	(working copy)

> -# Handle --enable-accelerator.  This is in top-level because both libgomp and
> -[...]
> -accel_target_noncanonical=NONE
> -[...]
> +[...]
>  
>  ACX_CANONICAL_ACCEL_TARGET

... accel_target_noncanonical no longer being initialized here, but then
used in config/acx.m4:ACX_CANONICAL_ACCEL_TARGET.


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [gomp4] Revert more old Makefile/configure bits
@ 2014-09-05 16:36                                         ` Bernd Schmidt
  2014-09-08  9:42                                           ` Thomas Schwinge
  0 siblings, 1 reply; 62+ messages in thread
From: Bernd Schmidt @ 2014-09-05 16:36 UTC (permalink / raw)
  To: GCC Patches; +Cc: Ilya Verbin

[-- Attachment #1: Type: text/plain, Size: 212 bytes --]

This removes some remnants from the accel-gcc support that turned out 
not to be viable for ptx. Ilya Verbin has confirmed the patch doesn't 
break their setup either, so I've committed it on the branch.


Bernd

[-- Attachment #2: remnants.diff --]
[-- Type: text/x-patch, Size: 25001 bytes --]

Index: ChangeLog.gomp
===================================================================
--- ChangeLog.gomp	(revision 214959)
+++ ChangeLog.gomp	(working copy)
@@ -1,3 +1,11 @@
+2014-09-05  Bernd Schmidt  <bernds@codesourcery.com>
+
+	* Makefile.def (host_modules, flags_to_pass): Remove accel-gcc remnants.
+	* configure.ac: Don't call ACX_CANONICAL_ACCEL_TARGET.  Remove
+	target-gcc-configure-flags and accelerator-gcc-configure-flags options.
+	* Makefile.in: Regenerate.
+	* configure: Regenerate.
+
 2014-08-04  Bernd Schmidt  <bernds@codesourcery.com>
 
 	* Makefile.def (accel-gcc host module): Remove, and all of its
Index: Makefile.def
===================================================================
--- Makefile.def	(revision 214959)
+++ Makefile.def	(working copy)
@@ -44,8 +44,7 @@ host_modules= { module= fixincludes; boo
 host_modules= { module= flex; no_check_cross= true; };
 host_modules= { module= gas; bootstrap=true; };
 host_modules= { module= gcc; bootstrap=true; 
-		extra_configure_flags='@extra_target_gcc_configure_flags@';
-		extra_make_flags="$(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS)"; };
+		extra_make_flags="$(EXTRA_GCC_FLAGS)"; };
 host_modules= { module= gmp; lib_path=.libs; bootstrap=true;
 		extra_configure_flags='--disable-shared';
 		no_install= true;
@@ -221,7 +220,6 @@ flags_to_pass = { flag= sysconfdir ; };
 flags_to_pass = { flag= tooldir ; };
 flags_to_pass = { flag= build_tooldir ; };
 flags_to_pass = { flag= target_alias ; };
-flags_to_pass = { flag= accel_target_alias ; };
 
 // Build tools
 flags_to_pass = { flag= AWK ; };
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 214959)
+++ Makefile.in	(working copy)
@@ -705,7 +705,6 @@ BASE_FLAGS_TO_PASS = \
 	"tooldir=$(tooldir)" \
 	"build_tooldir=$(build_tooldir)" \
 	"target_alias=$(target_alias)" \
-	"accel_target_alias=$(accel_target_alias)" \
 	"AWK=$(AWK)" \
 	"BISON=$(BISON)" \
 	"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
@@ -10100,7 +10099,7 @@ configure-gcc:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target} @extra_target_gcc_configure_flags@ \
+	  --target=$${this_target}  \
 	  || exit 1
 @endif gcc
 
@@ -10135,8 +10134,7 @@ configure-stage1-gcc:
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
 	  --target=${target_alias} \
 	   \
-	  $(STAGE1_CONFIGURE_FLAGS) \
-	  @extra_target_gcc_configure_flags@
+	  $(STAGE1_CONFIGURE_FLAGS)
 @endif gcc-bootstrap
 
 .PHONY: configure-stage2-gcc maybe-configure-stage2-gcc
@@ -10169,8 +10167,7 @@ configure-stage2-gcc:
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
 	  --target=${target_alias} \
 	   --with-build-libsubdir=$(HOST_SUBDIR)  \
-	  $(STAGE2_CONFIGURE_FLAGS) \
-	  @extra_target_gcc_configure_flags@
+	  $(STAGE2_CONFIGURE_FLAGS)
 @endif gcc-bootstrap
 
 .PHONY: configure-stage3-gcc maybe-configure-stage3-gcc
@@ -10203,8 +10200,7 @@ configure-stage3-gcc:
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
 	  --target=${target_alias} \
 	   --with-build-libsubdir=$(HOST_SUBDIR)  \
-	  $(STAGE3_CONFIGURE_FLAGS) \
-	  @extra_target_gcc_configure_flags@
+	  $(STAGE3_CONFIGURE_FLAGS)
 @endif gcc-bootstrap
 
 .PHONY: configure-stage4-gcc maybe-configure-stage4-gcc
@@ -10237,8 +10233,7 @@ configure-stage4-gcc:
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
 	  --target=${target_alias} \
 	   --with-build-libsubdir=$(HOST_SUBDIR)  \
-	  $(STAGE4_CONFIGURE_FLAGS) \
-	  @extra_target_gcc_configure_flags@
+	  $(STAGE4_CONFIGURE_FLAGS)
 @endif gcc-bootstrap
 
 .PHONY: configure-stageprofile-gcc maybe-configure-stageprofile-gcc
@@ -10271,8 +10266,7 @@ configure-stageprofile-gcc:
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
 	  --target=${target_alias} \
 	   --with-build-libsubdir=$(HOST_SUBDIR)  \
-	  $(STAGEprofile_CONFIGURE_FLAGS) \
-	  @extra_target_gcc_configure_flags@
+	  $(STAGEprofile_CONFIGURE_FLAGS)
 @endif gcc-bootstrap
 
 .PHONY: configure-stagefeedback-gcc maybe-configure-stagefeedback-gcc
@@ -10305,8 +10299,7 @@ configure-stagefeedback-gcc:
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
 	  --target=${target_alias} \
 	   --with-build-libsubdir=$(HOST_SUBDIR)  \
-	  $(STAGEfeedback_CONFIGURE_FLAGS) \
-	  @extra_target_gcc_configure_flags@
+	  $(STAGEfeedback_CONFIGURE_FLAGS)
 @endif gcc-bootstrap
 
 
@@ -10326,7 +10319,7 @@ all-gcc: configure-gcc
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/gcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS) \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) \
 		$(TARGET-gcc))
 @endif gcc
 
@@ -10355,7 +10348,7 @@ all-stage1-gcc: configure-stage1-gcc
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
 		$(EXTRA_HOST_FLAGS)  \
-		$(STAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS) \
+		$(STAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-gcc)
 
@@ -10370,7 +10363,7 @@ clean-stage1-gcc:
 	fi; \
 	cd $(HOST_SUBDIR)/gcc && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-	$(STAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS) clean
+	$(STAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) clean
 @endif gcc-bootstrap
 
 
@@ -10397,7 +10390,7 @@ all-stage2-gcc: configure-stage2-gcc
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS) \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) \
 		TFLAGS="$(STAGE2_TFLAGS)" \
 		$(TARGET-stage2-gcc)
 
@@ -10411,7 +10404,7 @@ clean-stage2-gcc:
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gcc && \
-	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS) clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) clean
 @endif gcc-bootstrap
 
 
@@ -10438,7 +10431,7 @@ all-stage3-gcc: configure-stage3-gcc
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS) \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) \
 		TFLAGS="$(STAGE3_TFLAGS)" \
 		$(TARGET-stage3-gcc)
 
@@ -10452,7 +10445,7 @@ clean-stage3-gcc:
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gcc && \
-	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS) clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) clean
 @endif gcc-bootstrap
 
 
@@ -10479,7 +10472,7 @@ all-stage4-gcc: configure-stage4-gcc
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS) \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) \
 		TFLAGS="$(STAGE4_TFLAGS)" \
 		$(TARGET-stage4-gcc)
 
@@ -10493,7 +10486,7 @@ clean-stage4-gcc:
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gcc && \
-	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS) clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) clean
 @endif gcc-bootstrap
 
 
@@ -10520,7 +10513,7 @@ all-stageprofile-gcc: configure-stagepro
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS) \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) \
 		TFLAGS="$(STAGEprofile_TFLAGS)" \
 		$(TARGET-stageprofile-gcc)
 
@@ -10534,7 +10527,7 @@ clean-stageprofile-gcc:
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gcc && \
-	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS) clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) clean
 @endif gcc-bootstrap
 
 
@@ -10561,7 +10554,7 @@ all-stagefeedback-gcc: configure-stagefe
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS) \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) \
 		TFLAGS="$(STAGEfeedback_TFLAGS)" \
 		$(TARGET-stagefeedback-gcc)
 
@@ -10575,7 +10568,7 @@ clean-stagefeedback-gcc:
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gcc && \
-	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS) clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) clean
 @endif gcc-bootstrap
 
 
@@ -10593,7 +10586,7 @@ check-gcc:
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
 	(cd $(HOST_SUBDIR)/gcc && \
-	  $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS) check)
+	  $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) check)
 
 @endif gcc
 
@@ -10608,7 +10601,7 @@ install-gcc: installdirs
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
 	(cd $(HOST_SUBDIR)/gcc && \
-	  $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS) install)
+	  $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) install)
 
 @endif gcc
 
@@ -10623,7 +10616,7 @@ install-strip-gcc: installdirs
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
 	(cd $(HOST_SUBDIR)/gcc && \
-	  $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS) install-strip)
+	  $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) install-strip)
 
 @endif gcc
 
@@ -10640,7 +10633,7 @@ info-gcc: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS); do \
+	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing info in gcc" ; \
@@ -10665,7 +10658,7 @@ dvi-gcc: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS); do \
+	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing dvi in gcc" ; \
@@ -10690,7 +10683,7 @@ pdf-gcc: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS); do \
+	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing pdf in gcc" ; \
@@ -10715,7 +10708,7 @@ html-gcc: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS); do \
+	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing html in gcc" ; \
@@ -10740,7 +10733,7 @@ TAGS-gcc: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS); do \
+	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing TAGS in gcc" ; \
@@ -10766,7 +10759,7 @@ install-info-gcc: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS); do \
+	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing install-info in gcc" ; \
@@ -10792,7 +10785,7 @@ install-pdf-gcc: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS); do \
+	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing install-pdf in gcc" ; \
@@ -10818,7 +10811,7 @@ install-html-gcc: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS); do \
+	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing install-html in gcc" ; \
@@ -10843,7 +10836,7 @@ installcheck-gcc: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS); do \
+	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing installcheck in gcc" ; \
@@ -10867,7 +10860,7 @@ mostlyclean-gcc:
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS); do \
+	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing mostlyclean in gcc" ; \
@@ -10891,7 +10884,7 @@ clean-gcc:
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS); do \
+	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing clean in gcc" ; \
@@ -10915,7 +10908,7 @@ distclean-gcc:
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS); do \
+	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing distclean in gcc" ; \
@@ -10939,7 +10932,7 @@ maintainer-clean-gcc:
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS); do \
+	for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing maintainer-clean in gcc" ; \
Index: config/ChangeLog.gomp
===================================================================
--- config/ChangeLog.gomp	(revision 214959)
+++ config/ChangeLog.gomp	(working copy)
@@ -1,3 +1,7 @@
+2014-09-05  Bernd Schmidt  <bernds@codesourcery.com>
+
+	* acx.m4 (ACX_CANONICAL_ACCEL_TARGET): Revert previous change.
+
 2014-03-20  Bernd Schmidt  <bernds@codesourcery.com>
 
 	* acx.m4 (ACX_CANONICAL_ACCEL_TARGET): New macro.
Index: config/acx.m4
===================================================================
--- config/acx.m4	(revision 214959)
+++ config/acx.m4	(working copy)
@@ -61,36 +61,6 @@ AC_DEFUN([ACX_NONCANONICAL_TARGET],
 AC_SUBST(target_noncanonical)
 ]) []dnl # ACX_NONCANONICAL_TARGET
 
-AC_DEFUN([ACX_CANONICAL_ACCEL_TARGET],
-[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
-AC_MSG_CHECKING(accelerator target system type)
-
-dnl Set accel_target_alias.
-accel_target_alias=$accel_target_noncanonical
-case "$accel_target_alias" in
-NONE)
-  accel_target=NONE
-  ;;
-*)
-  accel_target=`$ac_config_sub $accel_target_alias`
-  ;;
-esac
-
-dnl Set the other accel_target vars.
-changequote(<<, >>)dnl
-accel_target_cpu=`echo $accel_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-accel_target_vendor=`echo $accel_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-accel_target_os=`echo $accel_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-changequote([, ])dnl
-AC_MSG_RESULT($accel_target)
-AC_SUBST(accel_target_noncanonical)dnl
-AC_SUBST(accel_target)dnl
-AC_SUBST(accel_target_alias)dnl
-AC_SUBST(accel_target_cpu)dnl
-AC_SUBST(accel_target_vendor)dnl
-AC_SUBST(accel_target_os)dnl
-])
-
 dnl ####
 dnl # GCC_TOPLEV_SUBDIRS
 dnl # GCC & friends build 'build', 'host', and 'target' tools.  These must
Index: configure
===================================================================
--- configure	(revision 214959)
+++ configure	(working copy)
@@ -673,14 +673,6 @@ LDFLAGS
 CFLAGS
 CC
 EXTRA_CONFIGARGS_LIBJAVA
-extra_accelerator_gcc_configure_flags
-extra_target_gcc_configure_flags
-accel_target_os
-accel_target_vendor
-accel_target_cpu
-accel_target_alias
-accel_target
-accel_target_noncanonical
 target_subdir
 host_subdir
 build_subdir
@@ -755,8 +747,6 @@ ac_user_opts='
 enable_option_checking
 with_build_libsubdir
 enable_offload_targets
-enable_target_gcc_configure_flags
-enable_accelerator_gcc_configure_flags
 enable_gold
 enable_ld
 enable_libquadmath
@@ -1478,12 +1468,6 @@ Optional Features:
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --enable-offload-targets=LIST
                           enable offloading to devices from LIST
-  --enable-target-gcc-configure-flags=FLAGS
-                          additional flags for configuring the target GCC
-                          [none]
-  --enable-accelerator-gcc-configure-flags=FLAGS
-                          additional flags for configuring the accelerator GCC
-                          [none]
   --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
@@ -2967,47 +2951,6 @@ else
 fi
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking accelerator target system type" >&5
-$as_echo_n "checking accelerator target system type... " >&6; }
-
-accel_target_alias=$accel_target_noncanonical
-case "$accel_target_alias" in
-NONE)
-  accel_target=NONE
-  ;;
-*)
-  accel_target=`$ac_config_sub $accel_target_alias`
-  ;;
-esac
-
-accel_target_cpu=`echo $accel_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-accel_target_vendor=`echo $accel_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-accel_target_os=`echo $accel_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $accel_target" >&5
-$as_echo "$accel_target" >&6; }
-
-
-# Allow for specifying configure flags that apply to only the target GCC, or
-# only the accelerator GCC.
-
-# Check whether --enable-target-gcc-configure-flags was given.
-if test "${enable_target_gcc_configure_flags+set}" = set; then :
-  enableval=$enable_target_gcc_configure_flags; extra_target_gcc_configure_flags=$enableval
-else
-  extra_target_gcc_configure_flags=
-fi
-
-
-
-# Check whether --enable-accelerator-gcc-configure-flags was given.
-if test "${enable_accelerator_gcc_configure_flags+set}" = set; then :
-  enableval=$enable_accelerator_gcc_configure_flags; extra_accelerator_gcc_configure_flags=$enableval
-else
-  extra_accelerator_gcc_configure_flags=
-fi
-
-
-
 # Handle --enable-gold, --enable-ld.
 # --disable-gold [--enable-ld]
 #     Build only ld.  Default option.
Index: configure.ac
===================================================================
--- configure.ac	(revision 214959)
+++ configure.ac	(working copy)
@@ -297,25 +297,6 @@ AC_ARG_ENABLE(offload-targets,
   fi
 ], [enable_offload_targets=])
 
-ACX_CANONICAL_ACCEL_TARGET
-
-# Allow for specifying configure flags that apply to only the target GCC, or
-# only the accelerator GCC.
-
-AC_ARG_ENABLE(target-gcc-configure-flags,
-  [AS_HELP_STRING([[--enable-target-gcc-configure-flags=FLAGS]],
-    [additional flags for configuring the target GCC @<:@none@:>@])],
-  extra_target_gcc_configure_flags=$enableval,
-  extra_target_gcc_configure_flags=)
-AC_SUBST(extra_target_gcc_configure_flags)
-
-AC_ARG_ENABLE(accelerator-gcc-configure-flags,
-  [AS_HELP_STRING([[--enable-accelerator-gcc-configure-flags=FLAGS]],
-    [additional flags for configuring the accelerator GCC @<:@none@:>@])],
-  extra_accelerator_gcc_configure_flags=$enableval,
-  extra_accelerator_gcc_configure_flags=)
-AC_SUBST(extra_accelerator_gcc_configure_flags)
-
 # Handle --enable-gold, --enable-ld.
 # --disable-gold [--enable-ld]
 #     Build only ld.  Default option.
Index: gcc/ChangeLog.gomp
===================================================================
--- gcc/ChangeLog.gomp	(revision 214959)
+++ gcc/ChangeLog.gomp	(working copy)
@@ -1,3 +1,9 @@
+2014-09-05  Bernd Schmidt  <bernds@codesourcery.com>
+
+	* configure.ac (enable-accelerator): Remove option.
+	(enable_accelerator): Don't subst.
+	* configure: Regenerate.
+
 2014-09-03  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* omp-low.c (expand_oacc_offload): Add child_fn to offload_funcs.
Index: gcc/configure
===================================================================
--- gcc/configure	(revision 214959)
+++ gcc/configure	(working copy)
@@ -764,7 +764,6 @@ LN_S
 AWK
 SET_MAKE
 enable_as_accelerator
-enable_accelerator
 REPORT_BUGS_TEXI
 REPORT_BUGS_TO
 PKGVERSION
@@ -905,7 +904,6 @@ with_specs
 with_pkgversion
 with_bugurl
 enable_languages
-enable_accelerator
 enable_as_accelerator_for
 enable_offload_targets
 with_multilib_list
@@ -1617,7 +1615,6 @@ Optional Features:
                           GNU Objective-C runtime
   --disable-shared        don't provide a shared libgcc
   --enable-languages=LIST specify which front-ends to build
-  --enable-accelerator    build accelerator [ARG={no,device-triplet}]
   --enable-as-accelerator-for
                           build compiler as accelerator target for given host
   --enable-offload-targets=LIST
@@ -7407,23 +7404,6 @@ else
 fi
 
 
-offload_targets=
-# Check whether --enable-accelerator was given.
-if test "${enable_accelerator+set}" = set; then :
-  enableval=$enable_accelerator;
-  case $enable_accelerator in
-  no) ;;
-  *)
-    offload_targets=$enable_accelerator
-    ;;
-  esac
-
-else
-  enable_accelerator=no
-fi
-
-
-
 # Check whether --enable-as-accelerator-for was given.
 if test "${enable_as_accelerator_for+set}" = set; then :
   enableval=$enable_as_accelerator_for;
@@ -7456,7 +7436,7 @@ if test "${enable_offload_targets+set}"
   fi
 
 else
-  enable_accelerator=no
+  offload_targets=
 fi
 
 
@@ -18114,7 +18094,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18117 "configure"
+#line 18097 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18220,7 +18200,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18223 "configure"
+#line 18203 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 214959)
+++ gcc/configure.ac	(working copy)
@@ -887,19 +887,6 @@ AC_ARG_ENABLE(languages,
 esac],
 [enable_languages=c])
 
-offload_targets=
-AC_ARG_ENABLE(accelerator,
-[AS_HELP_STRING([--enable-accelerator], [build accelerator @<:@ARG={no,device-triplet}@:>@])],
-[
-  case $enable_accelerator in
-  no) ;;
-  *)
-    offload_targets=$enable_accelerator
-    ;;
-  esac
-], [enable_accelerator=no])
-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])],
 [
@@ -927,8 +914,8 @@ AC_ARG_ENABLE(offload-targets,
       offload_targets=$offload_targets,$enable_offload_targets
     fi
   fi
-], [enable_accelerator=no])
-AC_SUBST(enable_accelerator)
+], [offload_targets=])
+
 offload_targets=`echo $offload_targets | sed -e 's#,#:#g'`
 AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
  [Define to hold the list of target names suitable for offloading.])

^ permalink raw reply	[flat|nested] 62+ messages in thread

* Re: [gomp4] Revert more old Makefile/configure bits
  2014-09-05 16:36                                         ` [gomp4] Revert more old Makefile/configure bits Bernd Schmidt
@ 2014-09-08  9:42                                           ` Thomas Schwinge
  0 siblings, 0 replies; 62+ messages in thread
From: Thomas Schwinge @ 2014-09-08  9:42 UTC (permalink / raw)
  To: Bernd Schmidt, Ilya Verbin; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 62363 bytes --]

Hi!

On Fri, 5 Sep 2014 18:35:23 +0200, Bernd Schmidt <bernds@codesourcery.com> wrote:
> This removes some remnants from the accel-gcc support that turned out 
> not to be viable for ptx. Ilya Verbin has confirmed the patch doesn't 
> break their setup either, so I've committed it on the branch.

In gomp-4_0-branch's rr215009, I committed some more build system cleanup
as follows:

commit fcdb38e02f606c0c0a8288097b60481a8c337d0d
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Sep 8 09:40:24 2014 +0000

    Some more build system cleanup.
    
    	* Makefile.tpl (accel_target_alias, accel_target_vendor)
    	(accel_target_os, accel_target): Remove.
    	(configure-[+prefix+][+module+]): Remove "accel-gcc" case.
    	* Makefile.in: Regenerate.
    	* configure.ac (offload_targets): Remove.
    	* configure: Regenerate.
    	gcc/
    	* configure.ac (offload_targets): Remove.
    	* configure: Regenerate.
    	libgcc/
    	* configure.ac (enable_accelerator, offload_targets): Remove.
    	* configure: Regenerate.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@215009 138bc75d-0d04-0410-961f-82ee72b054a4
---
 ChangeLog.gomp        |   9 ++
 Makefile.in           | 379 ++++++++++----------------------------------------
 Makefile.tpl          |  11 +-
 configure             |   5 +-
 configure.ac          |   5 +-
 gcc/ChangeLog.gomp    |   5 +
 gcc/configure         |  21 +--
 gcc/configure.ac      |  17 +--
 libgcc/ChangeLog.gomp |   5 +
 libgcc/configure      |  31 +----
 libgcc/configure.ac   |  26 +---
 11 files changed, 117 insertions(+), 397 deletions(-)

diff --git ChangeLog.gomp ChangeLog.gomp
index d3da977..a64bf25 100644
--- ChangeLog.gomp
+++ ChangeLog.gomp
@@ -1,3 +1,12 @@
+2014-09-08  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* Makefile.tpl (accel_target_alias, accel_target_vendor)
+	(accel_target_os, accel_target): Remove.
+	(configure-[+prefix+][+module+]): Remove "accel-gcc" case.
+	* Makefile.in: Regenerate.
+	* configure.ac (offload_targets): Remove.
+	* configure: Regenerate.
+
 2014-09-05  Bernd Schmidt  <bernds@codesourcery.com>
 
 	* Makefile.def (host_modules, flags_to_pass): Remove accel-gcc remnants.
diff --git Makefile.in Makefile.in
index 336908c..329af7f 100644
--- Makefile.in
+++ Makefile.in
@@ -46,10 +46,6 @@ target_alias=@target_noncanonical@
 target_vendor=@target_vendor@
 target_os=@target_os@
 target=@target@
-accel_target_alias=@accel_target_noncanonical@
-accel_target_vendor=@accel_target_vendor@
-accel_target_os=@accel_target_os@
-accel_target=@accel_target@
 
 program_transform_name = @program_transform_name@
 
@@ -2678,9 +2674,6 @@ configure-build-libiberty:
 	$(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/libiberty ; \
 	$(BUILD_EXPORTS)  \
 	echo Configuring in $(BUILD_SUBDIR)/libiberty; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(BUILD_SUBDIR)/libiberty" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -2693,7 +2686,7 @@ configure-build-libiberty:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(BUILD_CONFIGARGS) --build=${build_alias} --host=${build_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif build-libiberty
 
@@ -2738,9 +2731,6 @@ configure-build-bison:
 	$(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/bison ; \
 	$(BUILD_EXPORTS)  \
 	echo Configuring in $(BUILD_SUBDIR)/bison; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(BUILD_SUBDIR)/bison" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -2753,7 +2743,7 @@ configure-build-bison:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(BUILD_CONFIGARGS) --build=${build_alias} --host=${build_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif build-bison
 
@@ -2798,9 +2788,6 @@ configure-build-flex:
 	$(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/flex ; \
 	$(BUILD_EXPORTS)  \
 	echo Configuring in $(BUILD_SUBDIR)/flex; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(BUILD_SUBDIR)/flex" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -2813,7 +2800,7 @@ configure-build-flex:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(BUILD_CONFIGARGS) --build=${build_alias} --host=${build_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif build-flex
 
@@ -2858,9 +2845,6 @@ configure-build-m4:
 	$(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/m4 ; \
 	$(BUILD_EXPORTS)  \
 	echo Configuring in $(BUILD_SUBDIR)/m4; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(BUILD_SUBDIR)/m4" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -2873,7 +2857,7 @@ configure-build-m4:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(BUILD_CONFIGARGS) --build=${build_alias} --host=${build_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif build-m4
 
@@ -2918,9 +2902,6 @@ configure-build-texinfo:
 	$(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/texinfo ; \
 	$(BUILD_EXPORTS)  \
 	echo Configuring in $(BUILD_SUBDIR)/texinfo; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(BUILD_SUBDIR)/texinfo" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -2933,7 +2914,7 @@ configure-build-texinfo:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(BUILD_CONFIGARGS) --build=${build_alias} --host=${build_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif build-texinfo
 
@@ -2978,9 +2959,6 @@ configure-build-fixincludes:
 	$(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/fixincludes ; \
 	$(BUILD_EXPORTS)  \
 	echo Configuring in $(BUILD_SUBDIR)/fixincludes; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(BUILD_SUBDIR)/fixincludes" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -2993,7 +2971,7 @@ configure-build-fixincludes:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(BUILD_CONFIGARGS) --build=${build_alias} --host=${build_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif build-fixincludes
 
@@ -3042,9 +3020,6 @@ configure-bfd:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bfd ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/bfd; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/bfd" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -3056,7 +3031,7 @@ configure-bfd:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif bfd
 
@@ -3919,9 +3894,6 @@ configure-opcodes:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/opcodes ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/opcodes; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/opcodes" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -3933,7 +3905,7 @@ configure-opcodes:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif opcodes
 
@@ -4796,9 +4768,6 @@ configure-binutils:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/binutils ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/binutils; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/binutils" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -4810,7 +4779,7 @@ configure-binutils:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif binutils
 
@@ -5674,9 +5643,6 @@ configure-bison:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bison ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/bison; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/bison" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -5688,7 +5654,7 @@ configure-bison:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif bison
 
@@ -6121,9 +6087,6 @@ configure-cgen:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/cgen ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/cgen; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/cgen" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -6135,7 +6098,7 @@ configure-cgen:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif cgen
 
@@ -6565,9 +6528,6 @@ configure-dejagnu:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/dejagnu ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/dejagnu; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/dejagnu" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -6579,7 +6539,7 @@ configure-dejagnu:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif dejagnu
 
@@ -7009,9 +6969,6 @@ configure-etc:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/etc ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/etc; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/etc" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -7023,7 +6980,7 @@ configure-etc:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif etc
 
@@ -7453,9 +7410,6 @@ configure-fastjar:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/fastjar ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/fastjar; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/fastjar" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -7467,7 +7421,7 @@ configure-fastjar:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif fastjar
 
@@ -7899,9 +7853,6 @@ configure-fixincludes:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/fixincludes ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/fixincludes; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/fixincludes" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -7913,7 +7864,7 @@ configure-fixincludes:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif fixincludes
 
@@ -8762,9 +8713,6 @@ configure-flex:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/flex ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/flex; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/flex" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -8776,7 +8724,7 @@ configure-flex:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif flex
 
@@ -9208,9 +9156,6 @@ configure-gas:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gas ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/gas; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/gas" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -9222,7 +9167,7 @@ configure-gas:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif gas
 
@@ -10085,9 +10030,6 @@ configure-gcc:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gcc ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/gcc; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/gcc" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -10099,7 +10041,7 @@ configure-gcc:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif gcc
 
@@ -10962,9 +10904,6 @@ configure-gmp:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gmp ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/gmp; \
-	 \
-	this_target="none-${host_vendor}-${host_os}"; \
-	 \
 	cd "$(HOST_SUBDIR)/gmp" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -10976,7 +10915,7 @@ configure-gmp:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=none-${host_vendor}-${host_os} \
-	  --target=$${this_target} --disable-shared \
+	  --target=none-${host_vendor}-${host_os} --disable-shared \
 	  || exit 1
 @endif gmp
 
@@ -11833,9 +11772,6 @@ configure-mpfr:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/mpfr ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/mpfr; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/mpfr" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -11847,7 +11783,7 @@ configure-mpfr:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target} --disable-shared @extra_mpfr_configure_flags@ \
+	  --target=${target_alias} --disable-shared @extra_mpfr_configure_flags@ \
 	  || exit 1
 @endif mpfr
 
@@ -12704,9 +12640,6 @@ configure-mpc:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/mpc ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/mpc; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/mpc" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -12718,7 +12651,7 @@ configure-mpc:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target} --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ \
+	  --target=${target_alias} --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ \
 	  || exit 1
 @endif mpc
 
@@ -13575,9 +13508,6 @@ configure-isl:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/isl; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/isl" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -13589,7 +13519,7 @@ configure-isl:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target} --disable-shared @extra_isl_gmp_configure_flags@ \
+	  --target=${target_alias} --disable-shared @extra_isl_gmp_configure_flags@ \
 	  || exit 1
 @endif isl
 
@@ -14446,9 +14376,6 @@ configure-cloog:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/cloog ; \
 	$(HOST_EXPORTS) CPPFLAGS="$(HOST_GMPINC) $(HOST_ISLINC) $$CPPFLAGS"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS;  \
 	echo Configuring in $(HOST_SUBDIR)/cloog; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/cloog" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -14460,7 +14387,7 @@ configure-cloog:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target} --disable-shared --with-gmp=system --with-bits=gmp --with-isl=system \
+	  --target=${target_alias} --disable-shared --with-gmp=system --with-bits=gmp --with-isl=system \
 	  || exit 1
 @endif cloog
 
@@ -15317,9 +15244,6 @@ configure-libelf:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libelf ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/libelf; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/libelf" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -15331,7 +15255,7 @@ configure-libelf:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target} --disable-shared \
+	  --target=${target_alias} --disable-shared \
 	  || exit 1
 @endif libelf
 
@@ -16188,9 +16112,6 @@ configure-gold:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gold ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/gold; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/gold" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -16202,7 +16123,7 @@ configure-gold:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif gold
 
@@ -17066,9 +16987,6 @@ configure-gprof:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gprof ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/gprof; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/gprof" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -17080,7 +16998,7 @@ configure-gprof:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif gprof
 
@@ -17509,9 +17427,6 @@ configure-intl:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/intl ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/intl; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/intl" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -17523,7 +17438,7 @@ configure-intl:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif intl
 
@@ -18387,9 +18302,6 @@ configure-tcl:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/tcl ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/tcl; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/tcl" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -18401,7 +18313,7 @@ configure-tcl:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif tcl
 
@@ -18816,9 +18728,6 @@ configure-itcl:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/itcl ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/itcl; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/itcl" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -18830,7 +18739,7 @@ configure-itcl:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif itcl
 
@@ -19259,9 +19168,6 @@ configure-ld:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ld ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/ld; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/ld" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -19273,7 +19179,7 @@ configure-ld:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif ld
 
@@ -20136,9 +20042,6 @@ configure-libbacktrace:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libbacktrace ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/libbacktrace; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/libbacktrace" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -20150,7 +20053,7 @@ configure-libbacktrace:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif libbacktrace
 
@@ -21013,9 +20916,6 @@ configure-libcpp:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libcpp ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/libcpp; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/libcpp" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -21027,7 +20927,7 @@ configure-libcpp:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif libcpp
 
@@ -21890,9 +21790,6 @@ configure-libdecnumber:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libdecnumber ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/libdecnumber; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/libdecnumber" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -21904,7 +21801,7 @@ configure-libdecnumber:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif libdecnumber
 
@@ -22768,9 +22665,6 @@ configure-libgui:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libgui ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/libgui; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/libgui" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -22782,7 +22676,7 @@ configure-libgui:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif libgui
 
@@ -23211,9 +23105,6 @@ configure-libiberty:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiberty ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/libiberty; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/libiberty" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -23225,7 +23116,7 @@ configure-libiberty:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target} @extra_host_libiberty_configure_flags@ \
+	  --target=${target_alias} @extra_host_libiberty_configure_flags@ \
 	  || exit 1
 @endif libiberty
 
@@ -24094,9 +23985,6 @@ configure-libiberty-linker-plugin:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiberty-linker-plugin ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/libiberty-linker-plugin; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/libiberty-linker-plugin" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -24108,7 +23996,7 @@ configure-libiberty-linker-plugin:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target} @extra_host_libiberty_configure_flags@ --disable-install-libiberty @extra_linker_plugin_flags@ @extra_linker_plugin_configure_flags@ \
+	  --target=${target_alias} @extra_host_libiberty_configure_flags@ --disable-install-libiberty @extra_linker_plugin_flags@ @extra_linker_plugin_configure_flags@ \
 	  || exit 1
 @endif libiberty-linker-plugin
 
@@ -24978,9 +24866,6 @@ configure-libiconv:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiconv ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/libiconv; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/libiconv" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -24992,7 +24877,7 @@ configure-libiconv:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target} --disable-shared \
+	  --target=${target_alias} --disable-shared \
 	  || exit 1
 @endif libiconv
 
@@ -25359,9 +25244,6 @@ configure-m4:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/m4 ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/m4; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/m4" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -25373,7 +25255,7 @@ configure-m4:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif m4
 
@@ -25803,9 +25685,6 @@ configure-readline:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/readline ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/readline; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/readline" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -25817,7 +25696,7 @@ configure-readline:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif readline
 
@@ -26247,9 +26126,6 @@ configure-sid:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/sid ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/sid; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/sid" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -26261,7 +26137,7 @@ configure-sid:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif sid
 
@@ -26691,9 +26567,6 @@ configure-sim:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/sim ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/sim; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/sim" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -26705,7 +26578,7 @@ configure-sim:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif sim
 
@@ -27135,9 +27008,6 @@ configure-texinfo:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/texinfo ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/texinfo; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/texinfo" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -27149,7 +27019,7 @@ configure-texinfo:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif texinfo
 
@@ -27566,9 +27436,6 @@ configure-zlib:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zlib ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/zlib; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/zlib" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -27580,7 +27447,7 @@ configure-zlib:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif zlib
 
@@ -28426,9 +28293,6 @@ configure-gdb:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gdb ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/gdb; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/gdb" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -28440,7 +28304,7 @@ configure-gdb:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif gdb
 
@@ -28870,9 +28734,6 @@ configure-expect:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/expect ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/expect; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/expect" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -28884,7 +28745,7 @@ configure-expect:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif expect
 
@@ -29314,9 +29175,6 @@ configure-guile:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/guile ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/guile; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/guile" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -29328,7 +29186,7 @@ configure-guile:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif guile
 
@@ -29758,9 +29616,6 @@ configure-tk:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/tk ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/tk; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/tk" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -29772,7 +29627,7 @@ configure-tk:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif tk
 
@@ -30202,9 +30057,6 @@ configure-libtermcap:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libtermcap ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/libtermcap; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/libtermcap" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -30216,7 +30068,7 @@ configure-libtermcap:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif libtermcap
 
@@ -30580,9 +30432,6 @@ configure-utils:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/utils ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/utils; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/utils" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -30594,7 +30443,7 @@ configure-utils:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif utils
 
@@ -31018,9 +30867,6 @@ configure-gnattools:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gnattools ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/gnattools; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/gnattools" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -31032,7 +30878,7 @@ configure-gnattools:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif gnattools
 
@@ -31461,9 +31307,6 @@ configure-lto-plugin:
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/lto-plugin ; \
 	$(HOST_EXPORTS)  \
 	echo Configuring in $(HOST_SUBDIR)/lto-plugin; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(HOST_SUBDIR)/lto-plugin" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -31475,7 +31318,7 @@ configure-lto-plugin:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=$${this_target} --enable-shared @extra_linker_plugin_flags@ @extra_linker_plugin_configure_flags@ \
+	  --target=${target_alias} --enable-shared @extra_linker_plugin_flags@ @extra_linker_plugin_configure_flags@ \
 	  || exit 1
 @endif lto-plugin
 
@@ -32364,9 +32207,6 @@ configure-target-libstdc++-v3:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libstdc++-v3 ; \
 	$(RAW_CXX_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libstdc++-v3; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libstdc++-v3" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -32379,7 +32219,7 @@ configure-target-libstdc++-v3:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libstdc++-v3
 
@@ -33343,9 +33183,6 @@ configure-target-libsanitizer:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libsanitizer ; \
 	$(RAW_CXX_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libsanitizer; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libsanitizer" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -33358,7 +33195,7 @@ configure-target-libsanitizer:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libsanitizer
 
@@ -34322,9 +34159,6 @@ configure-target-libvtv:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libvtv ; \
 	$(RAW_CXX_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libvtv; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libvtv" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -34337,7 +34171,7 @@ configure-target-libvtv:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libvtv
 
@@ -35302,9 +35136,6 @@ configure-target-libcilkrts:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libcilkrts ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libcilkrts; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libcilkrts" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -35317,7 +35148,7 @@ configure-target-libcilkrts:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libcilkrts
 
@@ -35763,9 +35594,6 @@ configure-target-libssp:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libssp ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libssp; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libssp" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -35778,7 +35606,7 @@ configure-target-libssp:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libssp
 
@@ -36224,9 +36052,6 @@ configure-target-newlib:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/newlib ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/newlib; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/newlib" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -36239,7 +36064,7 @@ configure-target-newlib:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-newlib
 
@@ -36684,9 +36509,6 @@ configure-target-libgcc:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgcc ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libgcc; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libgcc" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -36699,7 +36521,7 @@ configure-target-libgcc:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libgcc
 
@@ -37659,9 +37481,6 @@ configure-target-libbacktrace:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libbacktrace ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libbacktrace; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libbacktrace" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -37674,7 +37493,7 @@ configure-target-libbacktrace:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libbacktrace
 
@@ -38120,9 +37939,6 @@ configure-target-libquadmath:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libquadmath ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libquadmath; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libquadmath" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -38135,7 +37951,7 @@ configure-target-libquadmath:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libquadmath
 
@@ -38581,9 +38397,6 @@ configure-target-libgfortran:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgfortran ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libgfortran; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libgfortran" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -38596,7 +38409,7 @@ configure-target-libgfortran:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libgfortran
 
@@ -39042,9 +38855,6 @@ configure-target-libobjc:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libobjc ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libobjc; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libobjc" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -39057,7 +38867,7 @@ configure-target-libobjc:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libobjc
 
@@ -39503,9 +39313,6 @@ configure-target-libgo:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgo ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libgo; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libgo" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -39518,7 +39325,7 @@ configure-target-libgo:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libgo
 
@@ -39964,9 +39771,6 @@ configure-target-libtermcap:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libtermcap ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libtermcap; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libtermcap" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -39979,7 +39783,7 @@ configure-target-libtermcap:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libtermcap
 
@@ -40360,9 +40164,6 @@ configure-target-winsup:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/winsup ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/winsup; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/winsup" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -40375,7 +40176,7 @@ configure-target-winsup:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-winsup
 
@@ -40821,9 +40622,6 @@ configure-target-libgloss:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgloss ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libgloss; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libgloss" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -40836,7 +40634,7 @@ configure-target-libgloss:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libgloss
 
@@ -41277,9 +41075,6 @@ configure-target-libffi:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libffi ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libffi; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libffi" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -41292,7 +41087,7 @@ configure-target-libffi:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libffi
 
@@ -41728,9 +41523,6 @@ configure-target-libjava:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libjava ; \
 	$(RAW_CXX_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libjava; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libjava" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -41743,7 +41535,7 @@ configure-target-libjava:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target} $(EXTRA_CONFIGARGS_LIBJAVA) \
+	  --target=${target_alias} $(EXTRA_CONFIGARGS_LIBJAVA) \
 	  || exit 1
 @endif target-libjava
 
@@ -42189,9 +41981,6 @@ configure-target-zlib:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/zlib ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/zlib; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/zlib" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -42204,7 +41993,7 @@ configure-target-zlib:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-zlib
 
@@ -42650,9 +42439,6 @@ configure-target-boehm-gc:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/boehm-gc ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/boehm-gc; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/boehm-gc" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -42665,7 +42451,7 @@ configure-target-boehm-gc:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-boehm-gc
 
@@ -43111,9 +42897,6 @@ configure-target-rda:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/rda ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/rda; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/rda" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -43126,7 +42909,7 @@ configure-target-rda:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-rda
 
@@ -43572,9 +43355,6 @@ configure-target-libada:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libada ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libada; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libada" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -43587,7 +43367,7 @@ configure-target-libada:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libada
 
@@ -44032,9 +43812,6 @@ configure-target-libgomp:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgomp ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libgomp; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libgomp" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -44047,7 +43824,7 @@ configure-target-libgomp:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libgomp
 
@@ -45012,9 +44789,6 @@ configure-target-libitm:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libitm ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libitm; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libitm" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -45027,7 +44801,7 @@ configure-target-libitm:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libitm
 
@@ -45473,9 +45247,6 @@ configure-target-libatomic:
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libatomic ; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	echo Configuring in $(TARGET_SUBDIR)/libatomic; \
-	 \
-	this_target="${target_alias}"; \
-	 \
 	cd "$(TARGET_SUBDIR)/libatomic" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -45488,7 +45259,7 @@ configure-target-libatomic:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-	  --target=$${this_target}  \
+	  --target=${target_alias}  \
 	  || exit 1
 @endif target-libatomic
 
diff --git Makefile.tpl Makefile.tpl
index eef404b..4822c32 100644
--- Makefile.tpl
+++ Makefile.tpl
@@ -49,10 +49,6 @@ target_alias=@target_noncanonical@
 target_vendor=@target_vendor@
 target_os=@target_os@
 target=@target@
-accel_target_alias=@accel_target_noncanonical@
-accel_target_vendor=@accel_target_vendor@
-accel_target_os=@accel_target_os@
-accel_target=@accel_target@
 
 program_transform_name = @program_transform_name@
 
@@ -1000,11 +996,6 @@ configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
 	$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
 	[+exports+] [+extra_exports+] \
 	echo Configuring in [+subdir+]/[+module+]; \
-	[+ IF (= (get "module") "accel-gcc") +] \
-	this_target="$(accel_target_alias)"; \
-	[+ ELSE +] \
-	this_target="[+target_alias+]"; \
-	[+ ENDIF +] \
 	cd "[+subdir+]/[+module+]" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -1017,7 +1008,7 @@ configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  [+args+] --build=${build_alias} --host=[+host_alias+] \
-	  --target=$${this_target} [+extra_configure_flags+] \
+	  --target=[+target_alias+] [+extra_configure_flags+] \
 	  || exit 1
 @endif [+prefix+][+module+]
 
diff --git configure configure
index c37ec4b..e2d65c9 100755
--- configure
+++ configure
@@ -2937,12 +2937,10 @@ case ${with_newlib} in
   yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
 esac
 
-offload_targets=
-
 # 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
+  if test x"$enable_offload_targets" = x; then
     as_fn_error "no offload targets specified" "$LINENO" 5
   fi
 
@@ -8157,6 +8155,7 @@ case " $configdirs " in
     ;;
 esac
 
+
 # Host tools.
 ncn_tool_prefix=
 test -n "$host_alias" && ncn_tool_prefix=$host_alias-
diff --git configure.ac configure.ac
index 1c05027..96a2126 100644
--- configure.ac
+++ configure.ac
@@ -286,13 +286,11 @@ case ${with_newlib} in
   yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
 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
+  if test x"$enable_offload_targets" = x; then
     AC_MSG_ERROR([no offload targets specified])
   fi
 ], [enable_offload_targets=])
@@ -3219,6 +3217,7 @@ case " $configdirs " in
     ;;
 esac
 
+
 # Host tools.
 NCN_STRICT_CHECK_TOOLS(AR, ar)
 NCN_STRICT_CHECK_TOOLS(AS, as)
diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp
index 0764c69..ef9a81d 100644
--- gcc/ChangeLog.gomp
+++ gcc/ChangeLog.gomp
@@ -1,3 +1,8 @@
+2014-09-08  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* configure.ac (offload_targets): Remove.
+	* configure: Regenerate.
+
 2014-09-05  Bernd Schmidt  <bernds@codesourcery.com>
 
 	* configure.ac (enable-accelerator): Remove option.
diff --git gcc/configure gcc/configure
index f606e24..6630dc2 100755
--- gcc/configure
+++ gcc/configure
@@ -7425,28 +7425,21 @@ 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
+  if test x"$enable_offload_targets" = x; then
     as_fn_error "no offload targets specified" "$LINENO" 5
-  else
-    if test x$offload_targets = x; then
-      offload_targets=$enable_offload_targets
-    else
-      offload_targets=$offload_targets,$enable_offload_targets
-    fi
   fi
 
 else
-  offload_targets=
+  enable_offload_targets=
 fi
 
-
-offload_targets=`echo $offload_targets | sed -e 's#,#:#g'`
+enable_offload_targets=`echo "$enable_offload_targets" | sed -e 's#,#:#g'`
 
 cat >>confdefs.h <<_ACEOF
-#define OFFLOAD_TARGETS "$offload_targets"
+#define OFFLOAD_TARGETS "$enable_offload_targets"
 _ACEOF
 
-if test x$offload_targets != x; then
+if test x"$enable_offload_targets" != x; then
 
 $as_echo "#define ENABLE_OFFLOADING 1" >>confdefs.h
 
@@ -18094,7 +18087,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18097 "configure"
+#line 18090 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18200,7 +18193,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18203 "configure"
+#line 18196 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git gcc/configure.ac gcc/configure.ac
index 203de5d..e543bae 100644
--- gcc/configure.ac
+++ gcc/configure.ac
@@ -905,21 +905,14 @@ 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
+  if test x"$enable_offload_targets" = x; then
     AC_MSG_ERROR([no offload targets specified])
-  else
-    if test x$offload_targets = x; then
-      offload_targets=$enable_offload_targets
-    else
-      offload_targets=$offload_targets,$enable_offload_targets
-    fi
   fi
-], [offload_targets=])
-
-offload_targets=`echo $offload_targets | sed -e 's#,#:#g'`
-AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
+], [enable_offload_targets=])
+enable_offload_targets=`echo "$enable_offload_targets" | sed -e 's#,#:#g'`
+AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$enable_offload_targets",
  [Define to hold the list of target names suitable for offloading.])
-if test x$offload_targets != x; then
+if test x"$enable_offload_targets" != x; then
   AC_DEFINE(ENABLE_OFFLOADING, 1,
     [Define this to enable support for offloading.])
 fi
diff --git libgcc/ChangeLog.gomp libgcc/ChangeLog.gomp
index 573caa5..7c56fe5 100644
--- libgcc/ChangeLog.gomp
+++ libgcc/ChangeLog.gomp
@@ -1,3 +1,8 @@
+2014-09-08  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* configure.ac (enable_accelerator, offload_targets): Remove.
+	* configure: Regenerate.
+
 2014-05-12  Bernd Schmidt  <bernds@codesourcery.com>
 
 	* ompstuff.c (_omp_func_table, _omp_var_table, _omp_funcs_end,
diff --git libgcc/configure libgcc/configure
index 2a21be7..832f82c 100644
--- libgcc/configure
+++ libgcc/configure
@@ -566,7 +566,6 @@ sfp_machine_header
 set_use_emutls
 set_have_cc_tls
 vis_hide
-enable_accelerator
 fixed_point
 enable_decimal_float
 decimal_float
@@ -665,7 +664,6 @@ with_build_libsubdir
 enable_decimal_float
 with_system_libunwind
 enable_sjlj_exceptions
-enable_accelerator
 enable_offload_targets
 enable_tls
 '
@@ -1304,7 +1302,6 @@ Optional Features:
 			to use
   --enable-sjlj-exceptions
                           force use of builtin_setjmp for exceptions
-  --enable-accelerator    build accelerator [ARG={no,device-triplet}]
   --enable-offload-targets=LIST
                           enable offloading to devices from LIST
   --enable-tls            Use thread-local storage [default=yes]
@@ -4363,40 +4360,18 @@ esac
 # Collect host-machine-specific information.
 . ${srcdir}/config.host
 
-offload_targets=
-# Check whether --enable-accelerator was given.
-if test "${enable_accelerator+set}" = set; then :
-  enableval=$enable_accelerator;
-  case $enable_accelerator in
-  no) ;;
-  *)
-    offload_targets=$enable_accelerator
-    ;;
-  esac
-
-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
+  if test x"$enable_offload_targets" = x; then
     as_fn_error "no offload targets specified" "$LINENO" 5
-  else
-    if test x$offload_targets = x; then
-      offload_targets=$enable_offload_targets
-    else
-      offload_targets=$offload_targets,$enable_offload_targets
-    fi
   fi
 
 else
-  enable_accelerator=no
+  enable_offload_targets=
 fi
 
-
-if test x$offload_targets != x; then
+if test x"$enable_offload_targets" != x; then
   extra_parts="${extra_parts} crtompbegin.o crtompend.o"
 fi
 
diff --git libgcc/configure.ac libgcc/configure.ac
index 1db09b9..8f29f6a 100644
--- libgcc/configure.ac
+++ libgcc/configure.ac
@@ -307,35 +307,15 @@ esac
 # Collect host-machine-specific information.
 . ${srcdir}/config.host
 
-offload_targets=
-AC_ARG_ENABLE(accelerator,
-[AS_HELP_STRING([--enable-accelerator], [build accelerator @<:@ARG={no,device-triplet}@:>@])],
-[
-  case $enable_accelerator in
-  no) ;;
-  *)
-    offload_targets=$enable_accelerator
-    ;;
-  esac
-], [])
-AC_SUBST(enable_accelerator)
-
 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
+  if test x"$enable_offload_targets" = x; then
     AC_MSG_ERROR([no offload targets specified])
-  else
-    if test x$offload_targets = x; then
-      offload_targets=$enable_offload_targets
-    else
-      offload_targets=$offload_targets,$enable_offload_targets
-    fi
   fi
-], [enable_accelerator=no])
-AC_SUBST(enable_accelerator)
-if test x$offload_targets != x; then
+], [enable_offload_targets=])
+if test x"$enable_offload_targets" != x; then
   extra_parts="${extra_parts} crtompbegin.o crtompend.o"
 fi
 


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 62+ messages in thread

end of thread, other threads:[~2014-09-08  9:42 UTC | newest]

Thread overview: 62+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-20 17:18 [RFC][gomp4] Offloading: Add device initialization and host->target function mapping Ilya Verbin
2013-12-26 13:37 ` Ilya Verbin
2014-01-15 15:09   ` Ilya Verbin
2014-03-12 18:21     ` Ilya Verbin
2014-03-17 13:10       ` Ilya Verbin
2014-03-17 15:12       ` Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation Thomas Schwinge
2014-03-17 16:49         ` Jakub Jelinek
2014-03-18 17:36         ` Ilya Verbin
  -- strict thread matches above, loose matches on Subject: below --
2013-12-17 11:40 Michael V. Zolotukhin
2014-01-16 11:37 ` Michael Zolotukhin
2014-01-28 11:20 ` Bernd Schmidt
     [not found]   ` <CADG=Z0GQ8ORLe1XRUU7VMYeLhwuWisMyCcGLQj-nY_bhkbD_1Q@mail.gmail.com>
2014-01-28 12:53     ` Fwd: " Ilya Verbin
2014-01-29 14:43       ` Bernd Schmidt
2014-01-29 16:06         ` Ilya Verbin
2014-02-14 14:49           ` Ilya Verbin
2014-02-14 15:02             ` Bernd Schmidt
2014-02-14 15:12               ` Jakub Jelinek
2014-02-14 15:50                 ` Bernd Schmidt
2014-02-14 16:06                   ` Jakub Jelinek
2014-02-20 18:27             ` Bernd Schmidt
2014-02-21 15:17               ` Ilya Verbin
2014-02-21 15:41                 ` Bernd Schmidt
2014-02-21 18:00                   ` Ilya Verbin
2014-02-28 16:09               ` Ilya Verbin
2014-02-28 16:23                 ` Bernd Schmidt
2014-02-28 21:41                   ` Bernd Schmidt
2014-05-27 10:18                     ` Ilya Verbin
2014-05-27 10:59                       ` Bernd Schmidt
2014-05-27 11:11                         ` Ilya Verbin
2014-05-27 11:16                           ` Bernd Schmidt
2014-05-27 15:33                             ` Ilya Verbin
2014-05-27 19:03                               ` Bernd Schmidt
2014-02-28 22:10                   ` Ilya Verbin
2014-03-05 17:15                   ` Ilya Verbin
2014-03-06  8:48                     ` Bernd Schmidt
2014-03-06 11:11                       ` Ilya Verbin
2014-03-06 11:54                         ` Bernd Schmidt
2014-03-06 12:52                           ` Ilya Verbin
2014-03-08 15:39                             ` Ilya Verbin
2014-03-12 14:14                               ` Bernd Schmidt
2014-03-12 14:52                                 ` Ilya Verbin
2014-03-20 17:41                                   ` Bernd Schmidt
2014-06-17 18:20                   ` Ilya Verbin
2014-06-17 19:23                     ` Bernd Schmidt
2014-06-18 14:14                       ` Ilya Verbin
2014-06-18 14:23                         ` Bernd Schmidt
2014-06-19 10:19                           ` Ilya Verbin
2014-06-27  7:33                             ` Bernd Schmidt
2014-07-07 14:51                               ` Ilya Verbin
2014-07-07 15:04                                 ` Bernd Schmidt
2014-07-07 15:14                                   ` Jakub Jelinek
2014-07-07 15:22                                     ` Jakub Jelinek
2014-07-10 18:24                                   ` Ilya Verbin
2014-07-10 18:28                                     ` Bernd Schmidt
2014-07-23 14:18                                 ` Bernd Schmidt
2014-07-23 14:40                                   ` Ilya Verbin
2014-08-04 21:00                                     ` Bernd Schmidt
2014-08-07 17:35                                       ` Thomas Schwinge
2014-09-05 16:36                                         ` [gomp4] Revert more old Makefile/configure bits Bernd Schmidt
2014-09-08  9:42                                           ` Thomas Schwinge
2014-07-24 15:58                                   ` Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation Ilya Verbin
2014-05-08  9:44 ` [gomp4] Mark __OPENMP_TARGET__ as addressable (was: Offloading patches (2/3): Add tables generation) Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).