From 56e092991a343484fe3d26b4506587d9bb99c1a9 Mon Sep 17 00:00:00 2001 From: tschwinge Date: Mon, 22 Dec 2014 16:37:48 +0000 Subject: [PATCH] libgomp: Fix nvptx plugin's GOMP_OFFLOAD_get_name. This is a function in the "generic" interface, so it should return the "generic" name instead of the OpenACC one. libgomp/ * plugin/plugin-nvptx.c (GOMP_OFFLOAD_get_name): Return "nvptx". * oacc-init.c (resolve_device): Update for that using... (get_openacc_name): ... this new function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219018 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgomp/ChangeLog.gomp | 4 ++++ libgomp/oacc-init.c | 15 ++++++++++++++- libgomp/plugin/plugin-nvptx.c | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/libgomp/ChangeLog.gomp b/libgomp/ChangeLog.gomp index 6653e58a43f..a36ec1f4e69 100644 --- a/libgomp/ChangeLog.gomp +++ b/libgomp/ChangeLog.gomp @@ -1,5 +1,9 @@ 2014-12-22 Thomas Schwinge + * plugin/plugin-nvptx.c (GOMP_OFFLOAD_get_name): Return "nvptx". + * oacc-init.c (resolve_device): Update for that using... + (get_openacc_name): ... this new function. + * testsuite/libgomp-test-support.exp.in (offload_additional_options, offload_additional_lib_paths): Don't set. diff --git a/libgomp/oacc-init.c b/libgomp/oacc-init.c index 7298d9a13d1..ff518567f5a 100644 --- a/libgomp/oacc-init.c +++ b/libgomp/oacc-init.c @@ -35,6 +35,7 @@ #include #include #include +#include static gomp_mutex_t acc_device_lock; @@ -84,6 +85,17 @@ goacc_register (struct gomp_device_descr const *disp) gomp_mutex_unlock (&acc_device_lock); } +/* OpenACC names some things a little differently. */ + +static const char * +get_openacc_name (const char *name) +{ + if (strcmp (name, "nvptx") == 0) + return "nvidia"; + else + return name; +} + static struct gomp_device_descr const * resolve_device (acc_device_t d) { @@ -98,7 +110,8 @@ resolve_device (acc_device_t d) /* Lookup the named device. */ while (++d != _ACC_device_hwm) if (dispatchers[d] - && !strcasecmp (goacc_device_type, dispatchers[d]->name) + && !strcasecmp (goacc_device_type, + get_openacc_name (dispatchers[d]->name)) && dispatchers[d]->get_num_devices_func () > 0) goto found; diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c index bc5739ad6a9..d423d3aab2c 100644 --- a/libgomp/plugin/plugin-nvptx.c +++ b/libgomp/plugin/plugin-nvptx.c @@ -1499,7 +1499,7 @@ GOMP_OFFLOAD_get_caps (void) const char * GOMP_OFFLOAD_get_name (void) { - return "nvidia"; + return "nvptx"; } int -- 2.11.4.GIT