diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-08-24 17:10:06 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-08-24 17:10:06 +0000 |
commit | d3d8e632f9a4073e705d3af98725f35356b9f7cb (patch) | |
tree | 139836bcec017a86c8257b2582f253251c7abb45 /libgomp/plugin/plugin-nvptx.c | |
parent | b8c06a0670bcef3e57e397afa04afcc4965cd002 (diff) | |
download | gcc-d3d8e632f9a4073e705d3af98725f35356b9f7cb.tar.gz |
libgomp/
* libgomp.map: Add 4.0.2 version.
* target.c (offload_image_descr): Add version field.
(gomp_load_image_to_device): Add version argument. Adjust plugin
call. Improve load mismatch diagnostic.
(gomp_unload_image_from_device): Add version argument. Adjust plugin
call.
(GOMP_offload_regster): Make stub function, move bulk to ...
(GOMP_offload_register_ver): ... here. Process version argument.
(GOMP_offload_unregister): Make stub function, move bulk to ...
(GOMP_offload_unregister_ver): ... here. Process version argument.
(gomp_init_device): Process version field.
(gomp_unload_device): Process version field.
(gomp_load_plugin_for_device): Reimplement DLSYM & DLSYM_OPT
macros. Check plugin version.
* libgomp.h (gomp_device_descr): Add version function field. Adjust
loader and unloader types.
* oacc-host.c: Include gomp-constants.h.
(host_version): New.
(host_load_image, host_unload_image): Adjust.
(host_dispatch): Add host_version.
* plugin/plugin-nvptx.c: Include gomp-constants.h.
(GOMP_OFFLOAD_version): New.
(GOMP_OFFLOAD_load_image): Add version arg and check it.
(GOMP_OFFLOAD_unload_image): Likewise.
* plugin/plugin-host.c: Include gomp-constants.h.
(GOMP_OFFLOAD_version): New.
(GOMP_OFFLOAD_load_image): Add version arg.
(GOMP_OFFLOAD_unload_image): Likewise.
liboffloadmic/
* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_version): New.
(GOMP_OFFLOAD_load_image): Add version arg and check it.
(GOMP_OFFLOAD_unload_image): Likewise.
include/
* gomp-constants.h (GOMP_VERSION, GOMP_VERSION_NVIDIA_PTX,
GOMP_VERSION_INTEL_MIC): New.
(GOMP_VERSION_PACK, GOMP_VERSION_LIB, GOMP_VERSION_DEV): New.
gcc/
* config/nvptx/mkoffload.c (process): Replace
GOMP_offload_{,un}register with GOMP_offload_{,un}register_ver.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227137 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/plugin/plugin-nvptx.c')
-rw-r--r-- | libgomp/plugin/plugin-nvptx.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c index d02a3fd4b9c..a2f950db580 100644 --- a/libgomp/plugin/plugin-nvptx.c +++ b/libgomp/plugin/plugin-nvptx.c @@ -36,6 +36,7 @@ #include "libgomp-plugin.h" #include "oacc-ptx.h" #include "oacc-plugin.h" +#include "gomp-constants.h" #include <pthread.h> #include <cuda.h> @@ -1570,11 +1571,20 @@ typedef struct nvptx_tdata size_t fn_num; } nvptx_tdata_t; +/* Return the libgomp version number we're compatible with. There is + no requirement for cross-version compatibility. */ + +unsigned +GOMP_OFFLOAD_version (void) +{ + return GOMP_VERSION; +} + /* Load the (partial) program described by TARGET_DATA to device number ORD. Allocate and return TARGET_TABLE. */ int -GOMP_OFFLOAD_load_image (int ord, const void *target_data, +GOMP_OFFLOAD_load_image (int ord, unsigned version, const void *target_data, struct addr_pair **target_table) { CUmodule module; @@ -1587,6 +1597,11 @@ GOMP_OFFLOAD_load_image (int ord, const void *target_data, struct ptx_image_data *new_image; struct ptx_device *dev; + if (GOMP_VERSION_DEV (version) > GOMP_VERSION_NVIDIA_PTX) + GOMP_PLUGIN_fatal ("Offload data incompatible with PTX plugin" + " (expected %u, received %u)", + GOMP_VERSION_NVIDIA_PTX, GOMP_VERSION_DEV (version)); + GOMP_OFFLOAD_init_device (ord); dev = ptx_devices[ord]; @@ -1656,11 +1671,14 @@ GOMP_OFFLOAD_load_image (int ord, const void *target_data, function descriptors allocated by G_O_load_image. */ void -GOMP_OFFLOAD_unload_image (int ord, const void *target_data) +GOMP_OFFLOAD_unload_image (int ord, unsigned version, const void *target_data) { struct ptx_image_data *image, **prev_p; struct ptx_device *dev = ptx_devices[ord]; + if (GOMP_VERSION_DEV (version) > GOMP_VERSION_NVIDIA_PTX) + return; + pthread_mutex_lock (&dev->image_lock); for (prev_p = &dev->images; (image = *prev_p) != 0; prev_p = &image->next) if (image->target_data == target_data) |