On 08 Oct 13:08, Jakub Jelinek wrote:
> On Mon, Oct 06, 2014 at 07:53:17PM +0400, Ilya Verbin wrote:
> > libgomp/
> >     * libgomp.map (GOMP_4.0.1): New symbol version.
> >     Add GOMP_offload_register.
> >     * libgomp_target.h: New file.
> >     * splay-tree.h: New file.
> >     * target.c: Include config.h, libgomp_target.h, dlfcn.h, splay-tree.h.
> >     (gomp_target_init): New forward declaration.
> >     (gomp_is_initialized): New static variable.
> >     (splay_tree_node, splay_tree, splay_tree_key): New typedefs.
> >     (struct target_mem_desc, struct splay_tree_key_s, offload_image_descr):
> >     New structures.
> >     (offload_images, num_offload_images, devices, num_devices): New static
> >     variables.
> >     (splay_compare): New static function.
> >     (struct gomp_device_descr): New structure.
> >     (gomp_get_num_devices): Call gomp_target_init.
> >     (resolve_device, gomp_map_vars_existing, gomp_map_vars, gomp_unmap_tgt)
> >     (gomp_unmap_vars, gomp_update, gomp_init_device): New static functions.
> >     (GOMP_offload_register): New function.
> >     (GOMP_target): Arrange for host callback to be performed in a separate
> >     initial thread and contention group, inheriting ICVs from
> >     gomp_global_icv etc.  Call gomp_map_vars and gomp_unmap_vars.
> >     Add device initialization and lookup for target function in splay tree.
> >     (GOMP_target_data): Add device initialization and call gomp_map_vars.
> >     (GOMP_target_end_data): Call gomp_unmap_vars.
> >     (GOMP_target_update): Add device initialization and call gomp_update.
> >     (gomp_load_plugin_for_device, gomp_register_images_for_device)
> >     (gomp_target_init): New static functions.
> 
> This looks good to me.

A small addition, refcount and copy_from were uninitialized for globals.


diff --git a/libgomp/target.c b/libgomp/target.c
index 4ace170..5b4873b 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -647,6 +647,8 @@ gomp_init_device (struct gomp_device_descr *devicep)
       k->host_start = table[i].host_start;
       k->host_end = table[i].host_end;
       k->tgt_offset = 0;
+      k->refcount = 1;
+      k->copy_from = false;
       k->tgt = tgt;
       node->left = NULL;
       node->right = NULL;


  -- Ilya

Reply via email to