aboutsummaryrefslogtreecommitdiff
path: root/libgomp/libgomp.h
diff options
context:
space:
mode:
authorIlya Verbin <ilya.verbin@intel.com>2015-12-14 16:46:54 +0000
committerIlya Verbin <iverbin@gcc.gnu.org>2015-12-14 16:46:54 +0000
commitd84ffc0a56d84a02929fa67d2edb52d4b81fab37 (patch)
tree942a44d60d4c5cc795b051eb83959cabdbc8fe20 /libgomp/libgomp.h
parent755cd5a907454199a9bff3d6f9f4baa4b298289d (diff)
downloadgcc-d84ffc0a56d84a02929fa67d2edb52d4b81fab37.zip
gcc-d84ffc0a56d84a02929fa67d2edb52d4b81fab37.tar.gz
gcc-d84ffc0a56d84a02929fa67d2edb52d4b81fab37.tar.bz2
libgomp.h (gomp_device_state): New enum.
libgomp/ * libgomp.h (gomp_device_state): New enum. (struct gomp_device_descr): Replace is_initialized with state. (gomp_fini_device): Remove declaration. * oacc-host.c (host_dispatch): Use state instead of is_initialized. * oacc-init.c (acc_init_1): Use state instead of is_initialized. (acc_shutdown_1): Likewise. Inline gomp_fini_device. (acc_set_device_type): Use state instead of is_initialized. (acc_set_device_num): Likewise. * target.c (resolve_device): Use state instead of is_initialized. Do not initialize finalized device. (gomp_map_vars): Do nothing if device is finalized. (gomp_unmap_vars): Likewise. (gomp_update): Likewise. (GOMP_offload_register_ver): Use state instead of is_initialized. (GOMP_offload_unregister_ver): Likewise. (gomp_init_device): Likewise. (gomp_unload_device): Likewise. (gomp_fini_device): Remove. (gomp_get_target_fn_addr): Do nothing if device is finalized. (GOMP_target): Go to host fallback if device is finalized. (GOMP_target_ext): Likewise. (gomp_exit_data): Do nothing if device is finalized. (gomp_target_task_fn): Go to host fallback if device is finalized. (gomp_target_fini): New static function. (gomp_target_init): Use state instead of is_initialized. Call gomp_target_fini at exit. liboffloadmic/ * plugin/libgomp-plugin-intelmic.cpp (unregister_main_image): Remove. (register_main_image): Do not call unregister_main_image at exit. (GOMP_OFFLOAD_fini_device): Allow for OpenMP. Unregister main image. From-SVN: r231623
Diffstat (limited to 'libgomp/libgomp.h')
-rw-r--r--libgomp/libgomp.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h
index c467f97..9d9949f 100644
--- a/libgomp/libgomp.h
+++ b/libgomp/libgomp.h
@@ -888,6 +888,14 @@ typedef struct acc_dispatch_t
} cuda;
} acc_dispatch_t;
+/* Various state of the accelerator device. */
+enum gomp_device_state
+{
+ GOMP_DEVICE_UNINITIALIZED,
+ GOMP_DEVICE_INITIALIZED,
+ GOMP_DEVICE_FINALIZED
+};
+
/* 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
@@ -933,8 +941,10 @@ struct gomp_device_descr
/* Mutex for the mutable data. */
gomp_mutex_t lock;
- /* Set to true when device is initialized. */
- bool is_initialized;
+ /* Current state of the device. OpenACC allows to move from INITIALIZED state
+ back to UNINITIALIZED state. OpenMP allows only to move from INITIALIZED
+ to FINALIZED state (at program shutdown). */
+ enum gomp_device_state state;
/* OpenACC-specific data and functions. */
/* This is mutable because of its mutable data_environ and target_data
@@ -962,7 +972,6 @@ extern void gomp_copy_from_async (struct target_mem_desc *);
extern void gomp_unmap_vars (struct target_mem_desc *, bool);
extern void gomp_init_device (struct gomp_device_descr *);
extern void gomp_free_memmap (struct splay_tree_s *);
-extern void gomp_fini_device (struct gomp_device_descr *);
extern void gomp_unload_device (struct gomp_device_descr *);
/* work.c */