[PATCH 7/10] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin

Thomas Schwinge thomas@codesourcery.com
Mon Dec 22 16:41:00 GMT 2014


Hi!

On Tue, 23 Sep 2014 19:19:31 +0100, Julian Brown <julian@codesourcery.com> wrote:
> This patch contains the bulk of the OpenACC 2.0 runtime support,

> --- /dev/null
> +++ b/libgomp/plugin-nvptx.c
> @@ -0,0 +1,1854 @@
> +/* Plugin for NVPTX execution.

> +const char *
> +get_name (void)
> +{
> +  return "nvidia";
> +}

Committed to gomp-4_0-branch in r219018:

commit 56e092991a343484fe3d26b4506587d9bb99c1a9
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Dec 22 16:37:48 2014 +0000

    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 libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 6653e58..a36ec1f 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,9 @@
 2014-12-22  Thomas Schwinge  <thomas@codesourcery.com>
 
+	* 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 libgomp/oacc-init.c libgomp/oacc-init.c
index 7298d9a..ff51856 100644
--- libgomp/oacc-init.c
+++ libgomp/oacc-init.c
@@ -35,6 +35,7 @@
 #include <strings.h>
 #include <stdbool.h>
 #include <stdio.h>
+#include <string.h>
 
 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 libgomp/plugin/plugin-nvptx.c libgomp/plugin/plugin-nvptx.c
index bc5739a..d423d3a 100644
--- libgomp/plugin/plugin-nvptx.c
+++ 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


Grüße,
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20141222/de5e6471/attachment.sig>


More information about the Gcc-patches mailing list