@@ -1,5 +1,8 @@
2014-12-22 Thomas Schwinge <thomas@codesourcery.com>
+ * libgomp.h (struct gomp_device_descr): Move target_data member...
+ (struct acc_dispatch_t): ... into here. Change all users.
+
* target.c (GOMP_target_update): To initialize, call
gomp_init_dev_tables instead of gomp_init_device.
@@ -684,6 +684,9 @@ typedef struct acc_dispatch_t
happen out-of-order with respect to mapping. */
struct target_mem_desc *data_environ;
+ /* Extra information required for a device instance by a given target. */
+ void *target_data;
+
/* Open or close a device instance. */
void *(*open_device_func) (int n);
int (*close_device_func) (void *h);
@@ -769,9 +772,6 @@ struct gomp_device_descr
/* Memory-mapping info for this device instance. */
struct gomp_memory_mapping mem_map;
-
- /* Extra information required for a device instance by a given target. */
- void *target_data;
};
extern void gomp_acc_insert_pointer (size_t, void **, size_t *, void *);
@@ -279,11 +279,11 @@ lazy_open (int ord)
thr->saved_bound_dev = NULL;
thr->mapped_data = NULL;
- if (!acc_dev->target_data)
- acc_dev->target_data = acc_dev->openacc.open_device_func (ord);
+ if (!acc_dev->openacc.target_data)
+ acc_dev->openacc.target_data = acc_dev->openacc.open_device_func (ord);
thr->target_tls
- = acc_dev->openacc.create_thread_data_func (acc_dev->target_data);
+ = acc_dev->openacc.create_thread_data_func (acc_dev->openacc.target_data);
acc_dev->openacc.async_set_async_func (acc_async_sync);
@@ -344,10 +344,11 @@ acc_shutdown_1 (acc_device_t d)
if (walk->dev)
{
- if (walk->dev->openacc.close_device_func (walk->dev->target_data) < 0)
+ void *target_data = walk->dev->openacc.target_data;
+ if (walk->dev->openacc.close_device_func (target_data) < 0)
gomp_fatal ("failed to close device");
- walk->dev->target_data = NULL;
+ walk->dev->openacc.target_data = target_data = NULL;
gomp_free_memmap (walk->dev);
@@ -1106,8 +1106,8 @@ gomp_target_init (void)
current_device.offload_regions_registered = false;
current_device.mem_map.splay_tree.root = NULL;
current_device.mem_map.is_initialized = false;
- current_device.target_data = NULL;
current_device.openacc.data_environ = NULL;
+ current_device.openacc.target_data = NULL;
for (i = 0; i < new_num_devices; i++)
{
current_device.id = num_devices + 1;