public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [gomp4] libgomp: plugin for non-shared memory host execution (was: libgomp.c/target-1.c failing in fn2's GOMP_target_update)
       [not found]   ` <87lhzqs3tv.fsf@kepler.schwinge.homeip.net>
@ 2014-02-19 16:10     ` Thomas Schwinge
  2014-02-19 17:49       ` Ilya Verbin
                         ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Thomas Schwinge @ 2014-02-19 16:10 UTC (permalink / raw)
  To: gcc-patches
  Cc: michael.v.zolotukhin, jnorris, Jakub Jelinek, kirill.yukhin, iverbin

[-- Attachment #1: Type: text/plain, Size: 13785 bytes --]

Hi!

On Thu, 12 Dec 2013 12:31:40 +0100, I wrote:
> On Fri, 8 Nov 2013 16:40:00 +0100, Jakub Jelinek <jakub@redhat.com> wrote:
> > [...], device 257 is just a temporary testing hack, [...]
> 
> > [...], once we have at least one supported offloading target,
> > hopefully we'll nuke device 257.
> 
> Hmm, in contrast, I'd advocate to preserve that device, under a proper
> ID, for two (similar) reasons: even if it's the same architecture, we'll
> still want a generic non-shared-memory "offloading target" for GCC
> testsuite usage.  We can't assume that any of the "real hardware"
> acceleration devices to be available, but will still want to test the
> non-shared-memory stuff.  And likewise, GCC users can use this for
> testing their code for shared-memory host (fallback) execution vs.
> non-shared-memory execution.  So basically, just like a user can decide
> to use OpenMP/libgomp, but tie the runtime down to just one thread; but
> that's still different from host fallback execution.  Makes sense?

Here is such a libgomp plugin plus the infrastructure for initial support
of non-shared memory host execution.  Any comments?

I have not yet integrated the plugin into the libgomp build system; use
something like:

    $ gcc -m64 -Wall -Wextra -shared -o libgomp-plugin-host.so.1 [...]/libgomp/plugin-host.c -fPIC -O -DDEBUG

..., and then set LIBGOMP_PLUGIN_PATH=$PWD in the environment.  (Plus
OMP_DEFAULT_DEVICE=0, but that's the default.)

commit 8495aab54fb244ef2643e43eb3e91a092ff0b14e
Author: Thomas Schwinge <thomas@codesourcery.com>, James Norris <jnorris@codesourcery.com>
Date:   Wed Feb 19 16:53:14 2014 +0100

    libgomp: plugin for non-shared memory host execution.
    
    	libgomp/
    	* plugin-host.c: New file.
    	* target.c (struct gomp_device_descr): Add device_alloc_func,
    	device_free_func, device_dev2host_func, device_host2dev_func
    	members.
    	(gomp_load_plugin_for_device): Load these.
    	(gomp_map_vars, gomp_unmap_tgt, gomp_unmap_vars, gomp_update): Use
    	these.
    	(resolve_device, gomp_find_available_plugins): Remove ID 257 hack.

diff --git libgomp/plugin-host.c libgomp/plugin-host.c
new file mode 100644
index 0000000..5354ebe
--- /dev/null
+++ libgomp/plugin-host.c
@@ -0,0 +1,84 @@
+/* Plugin for non-shared memory host execution.
+
+   Copyright (C) 2014 Free Software Foundation, Inc.
+
+   Contributed by Thomas Schwinge <thomas@codesourcery.com>.
+
+   This file is part of the GNU OpenMP Library (libgomp).
+
+   Libgomp is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+   more details.
+
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* Simple implementation of a libgomp plugin for non-shared memory host
+   execution.  */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+bool
+device_available (void)
+{
+#ifdef DEBUG
+  printf ("libgomp plugin: %s:%s\n", __FILE__, __FUNCTION__);
+#endif
+
+  return true;
+}
+
+void *
+device_alloc (size_t size)
+{
+  void *ptr = malloc (size);
+
+#ifdef DEBUG
+  printf ("libgomp plugin: %s:%s (%zd): %p\n", __FILE__, __FUNCTION__, size, ptr);
+#endif
+
+  return ptr;
+}
+
+void
+device_free (void *ptr)
+{
+#ifdef DEBUG
+  printf ("libgomp plugin: %s:%s (%p)\n", __FILE__, __FUNCTION__, ptr);
+#endif
+
+  free (ptr);
+}
+
+void *device_dev2host (void *dest, const void *src, size_t n)
+{
+#ifdef DEBUG
+  printf ("libgomp plugin: %s:%s (%p, %p, %zd)\n", __FILE__, __FUNCTION__, dest, src, n);
+#endif
+
+  return memcpy (dest, src, n);
+}
+
+void *device_host2dev (void *dest, const void *src, size_t n)
+{
+#ifdef DEBUG
+  printf ("libgomp plugin: %s:%s (%p, %p, %zd)\n", __FILE__, __FUNCTION__, dest, src, n);
+#endif
+
+  return memcpy (dest, src, n);
+}
diff --git libgomp/target.c libgomp/target.c
index 55d3891..48f35c4 100644
--- libgomp/target.c
+++ libgomp/target.c
@@ -122,6 +122,10 @@ struct gomp_device_descr
 
   /* Function handlers.  */
   bool (*device_available_func) (void);
+  void *(*device_alloc_func) (size_t);
+  void (*device_free_func) (void *);
+  void *(*device_dev2host_func)(void *, const void *, size_t);
+  void *(*device_host2dev_func)(void *, const void *, size_t);
 
   /* Splay tree containing information about mapped memory regions.  */
   struct splay_tree_s dev_splay_tree;
@@ -146,14 +150,9 @@ resolve_device (int device_id)
       device_id = icv->default_device_var;
     }
   if (device_id < 0
-      || (device_id >= gomp_get_num_devices ()
-	  && device_id != 257))
+      || (device_id >= gomp_get_num_devices ()))
     return NULL;
 
-  /* FIXME: Temporary hack for testing non-shared address spaces on host.  */
-  if (device_id == 257)
-    return &devices[0];
-
   return &devices[device_id];
 }
 
@@ -233,10 +232,10 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
 
   if (not_found_cnt || is_target)
     {
-      /* FIXME: This would be accelerator memory allocation, not
-	 host, and should allocate tgt_align aligned tgt_size block
-	 of memory.  */
-      tgt->to_free = gomp_malloc (tgt_size + tgt_align - 1);
+      /* Allocate tgt_align aligned tgt_size block of memory.  */
+      /* FIXME: Perhaps change interface to allocate properly aligned
+	 memory.  */
+      tgt->to_free = devicep->device_alloc_func (tgt_size + tgt_align - 1);
       tgt->tgt_start = (uintptr_t) tgt->to_free;
       tgt->tgt_start = (tgt->tgt_start + tgt_align - 1) & ~(tgt_align - 1);
       tgt->tgt_end = tgt->tgt_start + tgt_size;
@@ -297,13 +296,14 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
 		    break;
 		  case 1: /* TO */
 		  case 3: /* TOFROM */
-		    /* FIXME: This is supposed to be copy from host to device
-		       memory.  Perhaps add some smarts, like if copying
+		    /* Copy from host to device memory.  */
+		    /* FIXME: Perhaps add some smarts, like if copying
 		       several adjacent fields from host to target, use some
 		       host buffer to avoid sending each var individually.  */
-		    memcpy ((void *) (tgt->tgt_start + k->tgt_offset),
-			    (void *) k->host_start,
-			    k->host_end - k->host_start);
+		    devicep->device_host2dev_func((void *) (tgt->tgt_start
+							    + k->tgt_offset),
+						  (void *) k->host_start,
+						  k->host_end - k->host_start);
 		    break;
 		  case 4: /* POINTER */
 		    cur_node.host_start
@@ -337,10 +337,12 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
 		       array section.  Now subtract bias to get what we want
 		       to initialize the pointer with.  */
 		    cur_node.tgt_offset -= sizes[i];
-		    /* FIXME: host to device copy, see above FIXME comment.  */
-		    memcpy ((void *) (tgt->tgt_start + k->tgt_offset),
-			    (void *) &cur_node.tgt_offset,
-			    sizeof (void *));
+		    /* Copy from host to device memory.  */
+		    /* FIXME: see above FIXME comment.  */
+		    devicep->device_host2dev_func ((void *) (tgt->tgt_start
+							     + k->tgt_offset),
+						   (void *) &cur_node.tgt_offset,
+						   sizeof (void *));
 		    break;
 		  }
 		array++;
@@ -353,10 +355,12 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
 	{
 	  cur_node.tgt_offset = tgt->list[i]->tgt->tgt_start
 				+ tgt->list[i]->tgt_offset;
-	  /* FIXME: host to device copy, see above FIXME comment.  */
-	  memcpy ((void *) (tgt->tgt_start + i * sizeof (void *)),
-		  (void *) &cur_node.tgt_offset,
-		  sizeof (void *));
+	  /* Copy from host to device memory.  */
+	  /* FIXME: see above FIXME comment.  */
+	  devicep->device_host2dev_func ((void *) (tgt->tgt_start
+						   + i * sizeof (void *)),
+					 (void *) &cur_node.tgt_offset,
+					 sizeof (void *));
 	}
     }
 
@@ -367,10 +371,9 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
 static void
 gomp_unmap_tgt (struct target_mem_desc *tgt)
 {
-  /* FIXME: Deallocate on target the tgt->tgt_start .. tgt->tgt_end
-     region.  */
+  /* Deallocate on target the tgt->tgt_start .. tgt->tgt_end region.  */
   if (tgt->tgt_end)
-    free (tgt->to_free);
+    tgt->device_descr->device_free_func(tgt->to_free);
 
   free (tgt->array);
   free (tgt);
@@ -396,10 +399,11 @@ gomp_unmap_vars (struct target_mem_desc *tgt)
       {
 	splay_tree_key k = tgt->list[i];
 	if (k->copy_from)
-	  /* FIXME: device to host copy.  */
-	  memcpy ((void *) k->host_start,
-		  (void *) (k->tgt->tgt_start + k->tgt_offset),
-		  k->host_end - k->host_start);
+	  /* Copy from device to host memory.  */
+	  devicep->device_dev2host_func ((void *) k->host_start,
+					 (void *) (k->tgt->tgt_start
+						   + k->tgt_offset),
+					 k->host_end - k->host_start);
 	splay_tree_remove (&devicep->dev_splay_tree, k);
 	if (k->tgt->refcount > 1)
 	  k->tgt->refcount--;
@@ -446,17 +450,23 @@ gomp_update (struct gomp_device_descr *devicep, size_t mapnum,
 			  (void *) n->host_start,
 			  (void *) n->host_end);
 	    if ((kinds[i] & 7) == 1)
-	      /* FIXME: host to device copy.  */
-	      memcpy ((void *) (n->tgt->tgt_start + n->tgt_offset
-				+ cur_node.host_start - n->host_start),
-		      (void *) cur_node.host_start,
-		      cur_node.host_end - cur_node.host_start);
+	      /* Copy from host to device memory.  */
+	      devicep->device_host2dev_func ((void *) (n->tgt->tgt_start
+						       + n->tgt_offset
+						       + cur_node.host_start
+						       - n->host_start),
+					     (void *) cur_node.host_start,
+					     cur_node.host_end
+					     - cur_node.host_start);
 	    else if ((kinds[i] & 7) == 2)
-	      /* FIXME: device to host copy.  */
-	      memcpy ((void *) cur_node.host_start,
-		      (void *) (n->tgt->tgt_start + n->tgt_offset
-				+ cur_node.host_start - n->host_start),
-		      cur_node.host_end - cur_node.host_start);
+	      /* Copy from device to host memory.  */
+	      devicep->device_dev2host_func ((void *) cur_node.host_start,
+					     (void *) (n->tgt->tgt_start
+						       + n->tgt_offset
+						       + cur_node.host_start
+						       - n->host_start),
+					     cur_node.host_end
+					     - cur_node.host_start);
 	  }
 	else
 	  gomp_fatal ("Trying to update [%p..%p) object that is not mapped",
@@ -608,28 +618,43 @@ static bool
 gomp_load_plugin_for_device (struct gomp_device_descr *device,
 			     const char *plugin_name)
 {
-  if (!device || !plugin_name)
-    return false;
-
-  device->plugin_handle = dlopen (plugin_name, RTLD_LAZY);
-  if (!device->plugin_handle)
-    return false;
+  char *err = NULL;
 
   /* Clear any existing error.  */
   dlerror ();
 
+  device->plugin_handle = dlopen (plugin_name, RTLD_LAZY);
+  if (!device->plugin_handle)
+    {
+      err = dlerror ();
+      goto out;
+    }
+
   /* Check if all required functions are available in the plugin and store
-     their handlers.
-     TODO: check for other routines as well.  */
-  device->device_available_func = dlsym (device->plugin_handle,
-					 "device_available");
-  if (dlerror () != NULL)
+     their handlers.  */
+#define DLSYM(f) \
+  do									\
+    {									\
+      device->f##_func = dlsym (device->plugin_handle, #f);		\
+      err = dlerror ();							\
+      if (err != NULL)							\
+	goto out;							\
+    }									\
+  while (0)
+  DLSYM (device_available);
+  DLSYM (device_alloc);
+  DLSYM (device_free);
+  DLSYM (device_dev2host);
+  DLSYM (device_host2dev);
+#undef DLSYM
+
+ out:
+  if (err != NULL)
     {
+      gomp_error ("while loading %s: %s", plugin_name, err);
       dlclose (device->plugin_handle);
-      return false;
     }
-
-  return true;
+  return err == NULL;
 }
 
 /* This functions scans folder, specified in environment variable
@@ -674,7 +699,6 @@ gomp_find_available_plugins (void)
       if (devices == NULL)
 	{
 	  num_devices = 0;
-	  closedir (dir);
 	  goto out;
 	}
 
@@ -684,26 +708,10 @@ gomp_find_available_plugins (void)
       gomp_mutex_init (&devices[num_devices].dev_env_lock);
       num_devices++;
     }
-  closedir (dir);
 
  out:
-  /* FIXME: Temporary hack for testing non-shared address spaces on host.
-     We create device 257 just to check memory mapping.  */
-  if (num_devices == 0)
-    {
-      num_devices = 1;
-      devices = malloc (sizeof (struct gomp_device_descr));
-      if (devices == NULL)
-	{
-	  num_devices = 0;
-	  return;
-	}
-      devices[0].plugin_handle = NULL;
-      devices[0].device_available_func = NULL;
-      devices[0].dev_splay_tree.root = NULL;
-      gomp_mutex_init (&devices[0].dev_env_lock);
-    }
-  devices[0].id = 257;
+  if (dir)
+    closedir (dir);
 }
 
 /* This function initializes runtime needed for offloading.


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gomp4] libgomp: plugin for non-shared memory host execution (was: libgomp.c/target-1.c failing in fn2's GOMP_target_update)
  2014-02-19 16:10     ` [gomp4] libgomp: plugin for non-shared memory host execution (was: libgomp.c/target-1.c failing in fn2's GOMP_target_update) Thomas Schwinge
@ 2014-02-19 17:49       ` Ilya Verbin
  2014-02-19 18:07         ` Jakub Jelinek
  2014-02-20 11:09       ` Thomas Schwinge
  2015-07-30 12:26       ` Thomas Schwinge
  2 siblings, 1 reply; 9+ messages in thread
From: Ilya Verbin @ 2014-02-19 17:49 UTC (permalink / raw)
  To: Thomas Schwinge
  Cc: gcc, michael.v.zolotukhin, jnorris, Jakub Jelinek, Kirill Yukhin

2014-02-19 20:10 GMT+04:00 Thomas Schwinge <thomas@codesourcery.com>:
> Here is such a libgomp plugin plus the infrastructure for initial support
> of non-shared memory host execution.  Any comments?
>
> Grüße,
>  Thomas

This plugin looks good.

I think the function call in GOMP_target also should be replaced with
a call to plugin:
- fn ((void *) tgt->tgt_start);
+ devicep->device_run_func (fn, (void *) tgt->tgt_start);

Also I have a question (not related with this plugin): How will
libgomp work with multiple devices of the same type?  Probably it
should load the plugin once, query it for the number of available
devices, add received number of descriptors to the devices[] array, an
then pass devicep->id as an argument to all plugin's interfaces.

  -- Ilya

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gomp4] libgomp: plugin for non-shared memory host execution (was: libgomp.c/target-1.c failing in fn2's GOMP_target_update)
  2014-02-19 17:49       ` Ilya Verbin
@ 2014-02-19 18:07         ` Jakub Jelinek
  2014-02-20  9:59           ` [gomp4] libgomp: plugin for non-shared memory host execution Thomas Schwinge
  0 siblings, 1 reply; 9+ messages in thread
From: Jakub Jelinek @ 2014-02-19 18:07 UTC (permalink / raw)
  To: Ilya Verbin
  Cc: Thomas Schwinge, gcc, michael.v.zolotukhin, jnorris, Kirill Yukhin

On Wed, Feb 19, 2014 at 09:49:20PM +0400, Ilya Verbin wrote:
> 2014-02-19 20:10 GMT+04:00 Thomas Schwinge <thomas@codesourcery.com>:
> > Here is such a libgomp plugin plus the infrastructure for initial support
> > of non-shared memory host execution.  Any comments?
> >
> > Grüße,
> >  Thomas
> 
> This plugin looks good.
> 
> I think the function call in GOMP_target also should be replaced with
> a call to plugin:
> - fn ((void *) tgt->tgt_start);
> + devicep->device_run_func (fn, (void *) tgt->tgt_start);
> 
> Also I have a question (not related with this plugin): How will
> libgomp work with multiple devices of the same type?  Probably it
> should load the plugin once, query it for the number of available
> devices, add received number of descriptors to the devices[] array, an
> then pass devicep->id as an argument to all plugin's interfaces.

Or the devicep pointer.

	Jakub

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gomp4] libgomp: plugin for non-shared memory host execution
  2014-02-19 18:07         ` Jakub Jelinek
@ 2014-02-20  9:59           ` Thomas Schwinge
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Schwinge @ 2014-02-20  9:59 UTC (permalink / raw)
  To: Jakub Jelinek, Ilya Verbin
  Cc: gcc, michael.v.zolotukhin, jnorris, Kirill Yukhin

[-- Attachment #1: Type: text/plain, Size: 2066 bytes --]

Hi!

On Wed, 19 Feb 2014 18:59:59 +0100, Jakub Jelinek <jakub@redhat.com> wrote:
> On Wed, Feb 19, 2014 at 09:49:20PM +0400, Ilya Verbin wrote:
> > 2014-02-19 20:10 GMT+04:00 Thomas Schwinge <thomas@codesourcery.com>:
> > > Here is such a libgomp plugin plus the infrastructure for initial support
> > > of non-shared memory host execution.  Any comments?
> > 
> > This plugin looks good.

Committed to gomp-4_0-branch as r207938.

Reviewing old emails, I now see in
<http://news.gmane.org/find-root.php?message_id=%3C20130913123614.GB1817%40tucnak.redhat.com%3E>
that Jakub suggested to check that »sizeof (void *) == sizeof
(uintptr_t), etc.«, and then in
<http://news.gmane.org/find-root.php?message_id=%3C20130918090525.GF1817%40tucnak.redhat.com%3E>
to use »uintptr_t instead of void *« and different names for the
functions: »device_alloc (taking size and align arguments, returning
uintptr_t target address), device_free (taking uintptr_t target address
and perhaps size), device_copyto (like memcpy, just with target address
uintptr_t instead of void *) and device_copyfrom (similarly), and
device_run hook or similar (taking host and target fn and target
uintptr_t address of the block with pointers)«.  So, the code should
probably be adjusted for that.


> > I think the function call in GOMP_target also should be replaced with
> > a call to plugin:
> > - fn ((void *) tgt->tgt_start);
> > + devicep->device_run_func (fn, (void *) tgt->tgt_start);

Yes.


> > Also I have a question (not related with this plugin): How will
> > libgomp work with multiple devices of the same type?  Probably it
> > should load the plugin once, query it for the number of available
> > devices, add received number of descriptors to the devices[] array, an
> > then pass devicep->id as an argument to all plugin's interfaces.
> 
> Or the devicep pointer.

To which extent to we want/have to expose non-trivial data types to
plugins, such as a devicep pointer as opposed to (void *) tgt->tgt_start?


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gomp4] libgomp: plugin for non-shared memory host execution
  2014-02-19 16:10     ` [gomp4] libgomp: plugin for non-shared memory host execution (was: libgomp.c/target-1.c failing in fn2's GOMP_target_update) Thomas Schwinge
  2014-02-19 17:49       ` Ilya Verbin
@ 2014-02-20 11:09       ` Thomas Schwinge
  2015-07-30 12:26       ` Thomas Schwinge
  2 siblings, 0 replies; 9+ messages in thread
From: Thomas Schwinge @ 2014-02-20 11:09 UTC (permalink / raw)
  To: gcc-patches
  Cc: michael.v.zolotukhin, jnorris, Jakub Jelinek, kirill.yukhin, iverbin

[-- Attachment #1: Type: text/plain, Size: 3014 bytes --]

Hi!

On Wed, 19 Feb 2014 17:10:15 +0100, I wrote:
>     $ gcc -m64 -Wall -Wextra -shared -o libgomp-plugin-host.so.1 [...]/libgomp/plugin-host.c -fPIC -O -DDEBUG
> 
> ..., and then set LIBGOMP_PLUGIN_PATH=$PWD in the environment.

If putting plugins for several architectures into the same directory (as
required for 32-bit as well as 64-bit x86 GNU/Linux testing,
»RUNTESTFLAGS='--target_board=unix\{,-m32\}'«), libgomp will crash when
loading the incompatible library; a bug that I introduced:

> commit 8495aab54fb244ef2643e43eb3e91a092ff0b14e
> Author: Thomas Schwinge <thomas@codesourcery.com>, James Norris <jnorris@codesourcery.com>
> Date:   Wed Feb 19 16:53:14 2014 +0100
> 
>     libgomp: plugin for non-shared memory host execution.

> --- libgomp/target.c
> +++ libgomp/target.c
> @@ -608,28 +618,43 @@ static bool
>  gomp_load_plugin_for_device (struct gomp_device_descr *device,
>  			     const char *plugin_name)
>  {
> -  if (!device || !plugin_name)
> -    return false;
> -
> -  device->plugin_handle = dlopen (plugin_name, RTLD_LAZY);
> -  if (!device->plugin_handle)
> -    return false;
> +  char *err = NULL;
>  
>    /* Clear any existing error.  */
>    dlerror ();
>  
> +  device->plugin_handle = dlopen (plugin_name, RTLD_LAZY);
> +  if (!device->plugin_handle)
> +    {
> +      err = dlerror ();
> +      goto out;

> + out:
> +  if (err != NULL)
>      {
> +      gomp_error ("while loading %s: %s", plugin_name, err);
>        dlclose (device->plugin_handle);
> -      return false;
>      }
> -
> -  return true;
> +  return err == NULL;

Fixed in r207940 as follows:

commit 4b51d1f28358bf60e96c4d6f3c78f1d7d52c4061
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Feb 20 11:03:13 2014 +0000

    libgomp: Avoid potential crash in plugin error handling.
    
    	* target.c (gomp_load_plugin_for_device): Don't call dlcose if
    	dlopen failed.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@207940 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index c764b17..3dffde4 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,4 +1,9 @@
 2014-02-20  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* target.c (gomp_load_plugin_for_device): Don't call dlcose if
+	dlopen failed.
+
+2014-02-20  Thomas Schwinge  <thomas@codesourcery.com>
 	    James Norris  <jnorris@codesourcery.com>
 
 	* plugin-host.c: New file.
diff --git libgomp/target.c libgomp/target.c
index 83fcbd2..a6a5505 100644
--- libgomp/target.c
+++ libgomp/target.c
@@ -647,7 +647,8 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device,
   if (err != NULL)
     {
       gomp_error ("while loading %s: %s", plugin_name, err);
-      dlclose (device->plugin_handle);
+      if (device->plugin_handle)
+	dlclose (device->plugin_handle);
     }
   return err == NULL;
 }


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* libgomp: plugin for non-shared memory host execution
  2014-02-19 16:10     ` [gomp4] libgomp: plugin for non-shared memory host execution (was: libgomp.c/target-1.c failing in fn2's GOMP_target_update) Thomas Schwinge
  2014-02-19 17:49       ` Ilya Verbin
  2014-02-20 11:09       ` Thomas Schwinge
@ 2015-07-30 12:26       ` Thomas Schwinge
  2015-07-30 12:31         ` Jakub Jelinek
  2 siblings, 1 reply; 9+ messages in thread
From: Thomas Schwinge @ 2015-07-30 12:26 UTC (permalink / raw)
  To: michael.v.zolotukhin, nathan, Jakub Jelinek, kirill.yukhin, iverbin
  Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2505 bytes --]

Hi!

While I still think that a generic libgomp plugin for non-shared memory
host execution is a good idea conceptually, for the following reasons:

On Wed, 19 Feb 2014 17:10:15 +0100, I wrote:
> On Thu, 12 Dec 2013 12:31:40 +0100, I wrote:
> > On Fri, 8 Nov 2013 16:40:00 +0100, Jakub Jelinek <jakub@redhat.com> wrote:
> > > [...], device 257 is just a temporary testing hack, [...]
> > 
> > > [...], once we have at least one supported offloading target,
> > > hopefully we'll nuke device 257.
> > 
> > Hmm, in contrast, I'd advocate to preserve that device, under a proper
> > ID, for two (similar) reasons: even if it's the same architecture, we'll
> > still want a generic non-shared-memory "offloading target" for GCC
> > testsuite usage.  We can't assume that any of the "real hardware"
> > acceleration devices to be available, but will still want to test the
> > non-shared-memory stuff.  And likewise, GCC users can use this for
> > testing their code for shared-memory host (fallback) execution vs.
> > non-shared-memory execution.  So basically, just like a user can decide
> > to use OpenMP/libgomp, but tie the runtime down to just one thread; but
> > that's still different from host fallback execution.  Makes sense?
> 
> Here is such a libgomp plugin plus the infrastructure for initial support
> of non-shared memory host execution.  [...]

... the libgomp plugin as it is currently implemented fails to adequately
provide such functionality: nobody so far has implemented support for
certain data mapping constructs; so it is not currently used for OpenMP
offloading testing, and also disabled for certain OpenACC offloading test
cases.  Its improper integration into the offloading compilation process,
<https://gcc.gnu.org/wiki/Offloading#Compilation_process>, is also
causing issues: we use the target compiler for compiling "device" code --
but it doesn't know that it's being used for that purpose, so cannot
properly handle some constructs, such as efficiently implement
acc_on_device with constant argument.

It has been useful for initial bring-up, to test-drive the libgomp plugin
interface, when the nvptx backend and libgomp nvptx plugin as well as the
intelmic plugin were not yet available, but it's now probably time to
retire this plugin, at least until somebody feels like working on
integrating and implementing it properly.  Unless there are any
objections, I'll later propose a patch to this effect.


Grüße,
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: libgomp: plugin for non-shared memory host execution
  2015-07-30 12:26       ` Thomas Schwinge
@ 2015-07-30 12:31         ` Jakub Jelinek
  2015-07-31 15:40           ` Thomas Schwinge
  0 siblings, 1 reply; 9+ messages in thread
From: Jakub Jelinek @ 2015-07-30 12:31 UTC (permalink / raw)
  To: Thomas Schwinge
  Cc: michael.v.zolotukhin, nathan, kirill.yukhin, iverbin, gcc-patches

On Thu, Jul 30, 2015 at 01:47:37PM +0200, Thomas Schwinge wrote:
> > Here is such a libgomp plugin plus the infrastructure for initial support
> > of non-shared memory host execution.  [...]
> 
> ... the libgomp plugin as it is currently implemented fails to adequately
> provide such functionality: nobody so far has implemented support for
> certain data mapping constructs; so it is not currently used for OpenMP
> offloading testing, and also disabled for certain OpenACC offloading test
> cases.  Its improper integration into the offloading compilation process,
> <https://gcc.gnu.org/wiki/Offloading#Compilation_process>, is also
> causing issues: we use the target compiler for compiling "device" code --
> but it doesn't know that it's being used for that purpose, so cannot
> properly handle some constructs, such as efficiently implement
> acc_on_device with constant argument.
> 
> It has been useful for initial bring-up, to test-drive the libgomp plugin
> interface, when the nvptx backend and libgomp nvptx plugin as well as the
> intelmic plugin were not yet available, but it's now probably time to
> retire this plugin, at least until somebody feels like working on
> integrating and implementing it properly.  Unless there are any
> objections, I'll later propose a patch to this effect.

I agree with the removal.  It would be nice if somebody could add OpenACC
support to the IntelMIC plugin, then you'd get a non-shared memory host
execution testing for free, as it has a reasonable emulation mode.

	Jakub

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: libgomp: plugin for non-shared memory host execution
  2015-07-30 12:31         ` Jakub Jelinek
@ 2015-07-31 15:40           ` Thomas Schwinge
  2015-08-10 16:51             ` Thomas Schwinge
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Schwinge @ 2015-07-31 15:40 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: michael.v.zolotukhin, nathan, kirill.yukhin, iverbin, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 53142 bytes --]

Hi!

On Thu, 30 Jul 2015 13:51:17 +0200, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Jul 30, 2015 at 01:47:37PM +0200, Thomas Schwinge wrote:
> > > Here is such a libgomp plugin plus the infrastructure for initial support
> > > of non-shared memory host execution.  [...]
> > 
> > ... the libgomp plugin as it is currently implemented fails to adequately
> > provide such functionality: nobody so far has implemented support for
> > certain data mapping constructs; so it is not currently used for OpenMP
> > offloading testing, and also disabled for certain OpenACC offloading test
> > cases.  Its improper integration into the offloading compilation process,
> > <https://gcc.gnu.org/wiki/Offloading#Compilation_process>, is also
> > causing issues: we use the target compiler for compiling "device" code --
> > but it doesn't know that it's being used for that purpose, so cannot
> > properly handle some constructs, such as efficiently implement
> > acc_on_device with constant argument.
> > 
> > It has been useful for initial bring-up, to test-drive the libgomp plugin
> > interface, when the nvptx backend and libgomp nvptx plugin as well as the
> > intelmic plugin were not yet available, but it's now probably time to
> > retire this plugin, at least until somebody feels like working on
> > integrating and implementing it properly.  Unless there are any
> > objections, I'll later propose a patch to this effect.
> 
> I agree with the removal.  It would be nice if somebody could add OpenACC
> support to the IntelMIC plugin, then you'd get a non-shared memory host
> execution testing for free, as it has a reasonable emulation mode.

I find the intelmic plugin, with all its emulation code, a bit
heavy-weight for this purpose.  But, let's leave that for later.  ;-)

Committed to gomp-4_0-branch in r226444; will address trunk later (next
week).

commit 0eefa17a15b9a58fff02239289fc9c40ed62634f
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Jul 31 14:13:59 2015 +0000

    [PR libgomp/65742, PR middle-end/66332] libgomp: Remove plugin for non-shared memory host execution
    
    	gcc/
    	* builtins.c (expand_builtin_acc_on_device) [ACCEL_COMPILER]: Emit
    	open-coded sequence.
    	gcc/testsuite/
    	* c-c++-common/goacc/acc_on_device-2.c: Remove XFAIL for C.
    	include/
    	* gomp-constants.c (GOMP_DEVICE_HOST_NONSHM): Remove.
    	libgomp/
    	* libgomp-plugin.h (enum offload_target_type): Remove
    	OFFLOAD_TARGET_TYPE_HOST_NONSHM.
    	* openacc.f90 (openacc_kinds): Remove acc_device_host_nonshm.
    	* openacc.h (enum acc_device_t): Likewise.
    	* openacc_lib.h: Likewise.
    	* oacc-parallel.c (GOACC_parallel_keyed): Don't handle it.
    	* oacc-init.c (name_of_acc_device_t): Likewise.
    	(acc_on_device): Just use __builtin_acc_on_device.
    	* testsuite/libgomp.oacc-c-c++-common/if-1.c: Don't forbit usage
    	of acc_on_device builtin.
    	* plugin/plugin-host.h: Remove file.
    	* plugin/plugin-host.c: Likewise, but salvage some content into...
    	* oacc-host.c: ... this file.
    	* plugin/Makefrag.am: Don't build libgomp-plugin-host_nonshm.la.
    	* plugin/configfrag.ac (offload_targets): Don't add host_nonshm.
    	* Makefile.in: Regenerate.
    	* configure: Likewise.
    	* testsuite/lib/libgomp.exp
    	(check_effective_target_openacc_host_nonshm_selected): Remove.
    	(libgomp_init): Don't handle ACC_DEVICE_TYPE=host_nonshm.
    	* testsuite/libgomp.oacc-c++/c++.exp: Likewise.
    	* testsuite/libgomp.oacc-c/c.exp: Likewise.
    	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/private-vars-local-gang-1.c:
    	Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/private-vars-par-gang-2.c:
    	Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/worker-single-6.c: Likewise.
    	* testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise.
    	* testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise.
    	* testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise.
    	* testsuite/libgomp.oacc-fortran/data-2.f90: Likewise.
    	* testsuite/libgomp.oacc-fortran/private-vars-par-gang-2.f90:
    	Likewise.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@226444 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog.gomp                                 |   7 +
 gcc/builtins.c                                     |  12 +-
 gcc/testsuite/ChangeLog.gomp                       |   6 +
 gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c |  10 +-
 include/ChangeLog.gomp                             |   4 +
 include/gomp-constants.h                           |   1 -
 libgomp/ChangeLog.gomp                             |  39 ++++
 libgomp/Makefile.in                                |  33 +--
 libgomp/configure                                  |   1 -
 libgomp/libgomp-plugin.h                           |   1 -
 libgomp/oacc-host.c                                | 227 +++++++++++++++---
 libgomp/oacc-init.c                                |  16 +-
 libgomp/oacc-parallel.c                            |   6 -
 libgomp/openacc.f90                                |   1 -
 libgomp/openacc.h                                  |   1 -
 libgomp/openacc_lib.h                              |   1 -
 libgomp/plugin/Makefrag.am                         |   9 -
 libgomp/plugin/configfrag.ac                       |   1 -
 libgomp/plugin/plugin-host.c                       | 256 ---------------------
 libgomp/plugin/plugin-host.h                       |  37 ---
 libgomp/testsuite/lib/libgomp.exp                  |  11 -
 libgomp/testsuite/libgomp.oacc-c++/c++.exp         |   3 -
 .../libgomp.oacc-c-c++-common/acc_on_device-1.c    |  11 -
 .../libgomp.oacc-c-c++-common/firstprivate-1.c     |   1 -
 libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c |   1 -
 .../private-vars-local-gang-1.c                    |   2 +-
 .../private-vars-par-gang-2.c                      |   2 +-
 .../libgomp.oacc-c-c++-common/worker-single-6.c    |   2 +-
 libgomp/testsuite/libgomp.oacc-c/c.exp             |   3 -
 .../libgomp.oacc-fortran/acc_on_device-1-1.f90     |   7 -
 .../libgomp.oacc-fortran/acc_on_device-1-2.f       |   7 -
 .../libgomp.oacc-fortran/acc_on_device-1-3.f       |   7 -
 libgomp/testsuite/libgomp.oacc-fortran/data-2.f90  |   2 +-
 libgomp/testsuite/libgomp.oacc-fortran/fortran.exp |   3 -
 .../private-vars-par-gang-2.f90                    |   3 +-
 35 files changed, 266 insertions(+), 468 deletions(-)

diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp
index 6d62ac3..30f582a 100644
--- gcc/ChangeLog.gomp
+++ gcc/ChangeLog.gomp
@@ -1,3 +1,10 @@
+2015-07-31  Thomas Schwinge  <thomas@codesourcery.com>
+
+	PR libgomp/65742
+	PR middle-end/66332
+	* builtins.c (expand_builtin_acc_on_device) [ACCEL_COMPILER]: Emit
+	open-coded sequence.
+
 2015-07-30  Nathan Sidwell  <nathan@codesourcery.com>
 
 	* config/nvptx/nvptx.md (UNSPECV_UNLOCK): New.
diff --git gcc/builtins.c gcc/builtins.c
index 8004dc8..73d8a3d 100644
--- gcc/builtins.c
+++ gcc/builtins.c
@@ -5887,10 +5887,8 @@ expand_stack_save (void)
    acceleration device (ACCEL_COMPILER conditional).  */
 
 static rtx
-expand_builtin_acc_on_device (tree exp ATTRIBUTE_UNUSED,
-			      rtx target ATTRIBUTE_UNUSED)
+expand_builtin_acc_on_device (tree exp, rtx target)
 {
-#ifdef ACCEL_COMPILER
   if (!validate_arglist (exp, INTEGER_TYPE, VOID_TYPE))
     return NULL_RTX;
 
@@ -5899,8 +5897,13 @@ expand_builtin_acc_on_device (tree exp ATTRIBUTE_UNUSED,
   /* Return (arg == v1 || arg == v2) ? 1 : 0.  */
   machine_mode v_mode = TYPE_MODE (TREE_TYPE (arg));
   rtx v = expand_normal (arg), v1, v2;
+#ifdef ACCEL_COMPILER
   v1 = GEN_INT (GOMP_DEVICE_NOT_HOST);
   v2 = GEN_INT (ACCEL_COMPILER_acc_device);
+#else
+  v1 = GEN_INT (GOMP_DEVICE_NONE);
+  v2 = GEN_INT (GOMP_DEVICE_HOST);
+#endif
   machine_mode target_mode = TYPE_MODE (integer_type_node);
   if (!target || !register_operand (target, target_mode))
     target = gen_reg_rtx (target_mode);
@@ -5914,9 +5917,6 @@ expand_builtin_acc_on_device (tree exp ATTRIBUTE_UNUSED,
   emit_label (done_label);
 
   return target;
-#else
-  return NULL;
-#endif
 }
 
 /* Expand a thread-id/thread-count builtin for OpenACC.  */
diff --git gcc/testsuite/ChangeLog.gomp gcc/testsuite/ChangeLog.gomp
index 56cb772..04286dd 100644
--- gcc/testsuite/ChangeLog.gomp
+++ gcc/testsuite/ChangeLog.gomp
@@ -1,3 +1,9 @@
+2015-07-31  Thomas Schwinge  <thomas@codesourcery.com>
+
+	PR libgomp/65742
+	PR middle-end/66332
+	* c-c++-common/goacc/acc_on_device-2.c: Remove XFAIL for C.
+
 2015-07-30  Nathan Sidwell  <nathan@codesourcery.com>
 
 	* gcc.target/nvptx/spinlock-1.c: New.
diff --git gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c
index 6e3d292..ef622a8 100644
--- gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c
+++ gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c
@@ -20,17 +20,9 @@ f (void)
 }
 
 /* With -fopenacc, we're expecting the builtin to be expanded, so no calls.
-
    TODO: in C++, even under extern "C", the use of enum for acc_device_t
    perturbs expansion as a builtin, which expects an int parameter.  It's fine
    when changing acc_device_t to plain int, but that's not what we're doing in
    <openacc.h>.
 
-   TODO: given that we can't expand acc_on_device in
-   gcc/builtins.c:expand_builtin_acc_on_device for in the !ACCEL_COMPILER case
-   (because at that point we don't know whether we're acc_device_host or
-   acc_device_host_nonshm), we'll (erroneously) get a library call in the host
-   code.
-
-   { dg-final { scan-rtl-dump-times "\\\(call \[^\\n\]* acc_on_device" 0 "expand" { xfail { c || c++ } } } } */
-
+   { dg-final { scan-rtl-dump-times "\\\(call \[^\\n\]* acc_on_device" 0 "expand" { xfail c++ } } } */
diff --git include/ChangeLog.gomp include/ChangeLog.gomp
index a5c04cd..5951c88 100644
--- include/ChangeLog.gomp
+++ include/ChangeLog.gomp
@@ -1,3 +1,7 @@
+2015-07-31  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* gomp-constants.h (GOMP_DEVICE_HOST_NONSHM): Remove.
+
 2015-07-29  Nathan Sidwell  <nathan@codesourcery.com>
 
 	* gomp-constants.h (GOMP_LAUNCH_ASYNC_WAIT): Replace with ...
diff --git include/gomp-constants.h include/gomp-constants.h
index fea8f2b..4048b8d 100644
--- include/gomp-constants.h
+++ include/gomp-constants.h
@@ -114,7 +114,6 @@ enum gomp_map_kind
 #define GOMP_DEVICE_NONE		0
 #define GOMP_DEVICE_DEFAULT		1
 #define GOMP_DEVICE_HOST		2
-#define GOMP_DEVICE_HOST_NONSHM		3
 #define GOMP_DEVICE_NOT_HOST		4
 #define GOMP_DEVICE_NVIDIA_PTX		5
 #define GOMP_DEVICE_INTEL_MIC		6
diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 1e2b3f5..6d988fc 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,3 +1,42 @@
+2015-07-31  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* libgomp-plugin.h (enum offload_target_type): Remove
+	OFFLOAD_TARGET_TYPE_HOST_NONSHM.
+	* openacc.f90 (openacc_kinds): Remove acc_device_host_nonshm.
+	* openacc.h (enum acc_device_t): Likewise.
+	* openacc_lib.h: Likewise.
+	* oacc-parallel.c (GOACC_parallel_keyed): Don't handle it.
+	* oacc-init.c (name_of_acc_device_t): Likewise.
+	(acc_on_device): Just use __builtin_acc_on_device.
+	* testsuite/libgomp.oacc-c-c++-common/if-1.c: Don't forbit usage
+	of acc_on_device builtin.
+	* plugin/plugin-host.h: Remove file.
+	* plugin/plugin-host.c: Likewise, but salvage some content into...
+	* oacc-host.c: ... this file.
+	* plugin/Makefrag.am: Don't build libgomp-plugin-host_nonshm.la.
+	* plugin/configfrag.ac (offload_targets): Don't add host_nonshm.
+	* Makefile.in: Regenerate.
+	* configure: Likewise.
+	* testsuite/lib/libgomp.exp
+	(check_effective_target_openacc_host_nonshm_selected): Remove.
+	(libgomp_init): Don't handle ACC_DEVICE_TYPE=host_nonshm.
+	* testsuite/libgomp.oacc-c++/c++.exp: Likewise.
+	* testsuite/libgomp.oacc-c/c.exp: Likewise.
+	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/private-vars-local-gang-1.c:
+	Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/private-vars-par-gang-2.c:
+	Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/worker-single-6.c: Likewise.
+	* testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise.
+	* testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise.
+	* testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise.
+	* testsuite/libgomp.oacc-fortran/data-2.f90: Likewise.
+	* testsuite/libgomp.oacc-fortran/private-vars-par-gang-2.f90:
+	Likewise.
+
 2015-07-29  Nathan Sidwell  <nathan@codesourcery.com>
 
 	* plugin/plugin-nvptx.c (struct targ_ptx_obj): New.
diff --git libgomp/Makefile.in libgomp/Makefile.in
index 9d07e8d..79745ce 100644
--- libgomp/Makefile.in
+++ libgomp/Makefile.in
@@ -146,15 +146,6 @@ am__installdirs = "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)" \
 	"$(DESTDIR)$(fincludedir)" "$(DESTDIR)$(libsubincludedir)" \
 	"$(DESTDIR)$(toolexeclibdir)"
 LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
-libgomp_plugin_host_nonshm_la_DEPENDENCIES = libgomp.la
-am_libgomp_plugin_host_nonshm_la_OBJECTS =  \
-	libgomp_plugin_host_nonshm_la-plugin-host.lo
-libgomp_plugin_host_nonshm_la_OBJECTS =  \
-	$(am_libgomp_plugin_host_nonshm_la_OBJECTS)
-libgomp_plugin_host_nonshm_la_LINK = $(LIBTOOL) --tag=CC \
-	$(libgomp_plugin_host_nonshm_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-	$(libgomp_plugin_host_nonshm_la_LDFLAGS) $(LDFLAGS) -o $@
 am__DEPENDENCIES_1 =
 @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_DEPENDENCIES = libgomp.la \
 @PLUGIN_NVPTX_TRUE@	$(am__DEPENDENCIES_1)
@@ -196,8 +187,7 @@ FCLD = $(FC)
 FCLINK = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libgomp_plugin_host_nonshm_la_SOURCES) \
-	$(libgomp_plugin_nvptx_la_SOURCES) $(libgomp_la_SOURCES)
+SOURCES = $(libgomp_plugin_nvptx_la_SOURCES) $(libgomp_la_SOURCES)
 MULTISRCTOP = 
 MULTIBUILDTOP = 
 MULTIDIRS = 
@@ -401,8 +391,7 @@ libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
 AM_CPPFLAGS = $(addprefix -I, $(search_path))
 AM_CFLAGS = $(XCFLAGS)
 AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
-toolexeclib_LTLIBRARIES = libgomp.la $(am__append_1) \
-	libgomp-plugin-host_nonshm.la
+toolexeclib_LTLIBRARIES = libgomp.la $(am__append_1)
 nodist_toolexeclib_HEADERS = libgomp.spec
 
 # -Wc is only a libtool option.
@@ -437,14 +426,6 @@ libgomp_la_SOURCES = alloc.c barrier.c critical.c env.c error.c iter.c \
 @PLUGIN_NVPTX_TRUE@	$(lt_host_flags) $(PLUGIN_NVPTX_LDFLAGS)
 @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_LIBADD = libgomp.la $(PLUGIN_NVPTX_LIBS)
 @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_LIBTOOLFLAGS = --tag=disable-static
-libgomp_plugin_host_nonshm_version_info = -version-info $(libtool_VERSION)
-libgomp_plugin_host_nonshm_la_SOURCES = plugin/plugin-host.c
-libgomp_plugin_host_nonshm_la_CPPFLAGS = $(AM_CPPFLAGS) -DHOST_NONSHM_PLUGIN
-libgomp_plugin_host_nonshm_la_LDFLAGS = \
-	$(libgomp_plugin_host_nonshm_version_info) $(lt_host_flags)
-
-libgomp_plugin_host_nonshm_la_LIBADD = libgomp.la
-libgomp_plugin_host_nonshm_la_LIBTOOLFLAGS = --tag=disable-static
 nodist_noinst_HEADERS = libgomp_f.h
 nodist_libsubinclude_HEADERS = omp.h openacc.h
 @USE_FORTRAN_TRUE@nodist_finclude_HEADERS = omp_lib.h omp_lib.f90 omp_lib.mod omp_lib_kinds.mod \
@@ -572,8 +553,6 @@ clean-toolexeclibLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libgomp-plugin-host_nonshm.la: $(libgomp_plugin_host_nonshm_la_OBJECTS) $(libgomp_plugin_host_nonshm_la_DEPENDENCIES) $(EXTRA_libgomp_plugin_host_nonshm_la_DEPENDENCIES) 
-	$(libgomp_plugin_host_nonshm_la_LINK) -rpath $(toolexeclibdir) $(libgomp_plugin_host_nonshm_la_OBJECTS) $(libgomp_plugin_host_nonshm_la_LIBADD) $(LIBS)
 libgomp-plugin-nvptx.la: $(libgomp_plugin_nvptx_la_OBJECTS) $(libgomp_plugin_nvptx_la_DEPENDENCIES) $(EXTRA_libgomp_plugin_nvptx_la_DEPENDENCIES) 
 	$(libgomp_plugin_nvptx_la_LINK) $(am_libgomp_plugin_nvptx_la_rpath) $(libgomp_plugin_nvptx_la_OBJECTS) $(libgomp_plugin_nvptx_la_LIBADD) $(LIBS)
 libgomp.la: $(libgomp_la_OBJECTS) $(libgomp_la_DEPENDENCIES) $(EXTRA_libgomp_la_DEPENDENCIES) 
@@ -596,7 +575,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iter.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iter_ull.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgomp-plugin.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgomp_plugin_host_nonshm_la-plugin-host.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgomp_plugin_nvptx_la-plugin-nvptx.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loop.Plo@am__quote@
@@ -644,13 +622,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
-libgomp_plugin_host_nonshm_la-plugin-host.lo: plugin/plugin-host.c
-@am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(libgomp_plugin_host_nonshm_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgomp_plugin_host_nonshm_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgomp_plugin_host_nonshm_la-plugin-host.lo -MD -MP -MF $(DEPDIR)/libgomp_plugin_host_nonshm_la-plugin-host.Tpo -c -o libgomp_plugin_host_nonshm_la-plugin-host.lo `test -f 'plugin/plugin-host.c' || echo '$(srcdir)/'`plugin/plugin-host.c
-@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgomp_plugin_host_nonshm_la-plugin-host.Tpo $(DEPDIR)/libgomp_plugin_host_nonshm_la-plugin-host.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='plugin/plugin-host.c' object='libgomp_plugin_host_nonshm_la-plugin-host.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(libgomp_plugin_host_nonshm_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgomp_plugin_host_nonshm_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgomp_plugin_host_nonshm_la-plugin-host.lo `test -f 'plugin/plugin-host.c' || echo '$(srcdir)/'`plugin/plugin-host.c
-
 libgomp_plugin_nvptx_la-plugin-nvptx.lo: plugin/plugin-nvptx.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(libgomp_plugin_nvptx_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgomp_plugin_nvptx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgomp_plugin_nvptx_la-plugin-nvptx.lo -MD -MP -MF $(DEPDIR)/libgomp_plugin_nvptx_la-plugin-nvptx.Tpo -c -o libgomp_plugin_nvptx_la-plugin-nvptx.lo `test -f 'plugin/plugin-nvptx.c' || echo '$(srcdir)/'`plugin/plugin-nvptx.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgomp_plugin_nvptx_la-plugin-nvptx.Tpo $(DEPDIR)/libgomp_plugin_nvptx_la-plugin-nvptx.Plo
diff --git libgomp/configure libgomp/configure
index f1a92ba..c79611f 100755
--- libgomp/configure
+++ libgomp/configure
@@ -15167,7 +15167,6 @@ if test x"$plugin_support" = xyes; then
 
 $as_echo "#define PLUGIN_SUPPORT 1" >>confdefs.h
 
-  offload_targets=host_nonshm
 elif test "x${enable_offload_targets-no}" != xno; then
   as_fn_error "Can't support offloading without support for plugins" "$LINENO" 5
 fi
diff --git libgomp/libgomp-plugin.h libgomp/libgomp-plugin.h
index 1072ae4..2a910df 100644
--- libgomp/libgomp-plugin.h
+++ libgomp/libgomp-plugin.h
@@ -46,7 +46,6 @@ extern "C" {
 enum offload_target_type
 {
   OFFLOAD_TARGET_TYPE_HOST = 2,
-  OFFLOAD_TARGET_TYPE_HOST_NONSHM = 3,
   OFFLOAD_TARGET_TYPE_NVIDIA_PTX = 5,
   OFFLOAD_TARGET_TYPE_INTEL_MIC = 6
 };
diff --git libgomp/oacc-host.c libgomp/oacc-host.c
index 8710e7c..3845df9 100644
--- libgomp/oacc-host.c
+++ libgomp/oacc-host.c
@@ -26,52 +26,213 @@
    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-/* This shares much of the implementation of the plugin-host.c "host_nonshm"
-   plugin.  */
-#include "plugin/plugin-host.c"
+#include "libgomp.h"
+#include "oacc-int.h"
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+static struct gomp_device_descr host_dispatch;
+
+static const char *
+host_get_name (void)
+{
+  return host_dispatch.name;
+}
+
+static unsigned int
+host_get_caps (void)
+{
+  return host_dispatch.capabilities;
+}
+
+static int
+host_get_type (void)
+{
+  return host_dispatch.type;
+}
+
+static int
+host_get_num_devices (void)
+{
+  return 1;
+}
+
+static void
+host_init_device (int n __attribute__ ((unused)))
+{
+}
+
+static void
+host_fini_device (int n __attribute__ ((unused)))
+{
+}
+
+static int
+host_load_image (int n __attribute__ ((unused)),
+		 const void *t __attribute__ ((unused)),
+		 struct addr_pair **r __attribute__ ((unused)))
+{
+  return 0;
+}
+
+static void
+host_unload_image (int n __attribute__ ((unused)),
+		   const void *t __attribute__ ((unused)))
+{
+}
+
+static void *
+host_alloc (int n __attribute__ ((unused)), size_t s)
+{
+  return gomp_malloc (s);
+}
+
+static void
+host_free (int n __attribute__ ((unused)), void *p)
+{
+  free (p);
+}
+
+static void *
+host_dev2host (int n __attribute__ ((unused)),
+	       void *h __attribute__ ((unused)),
+	       const void *d __attribute__ ((unused)),
+	       size_t s __attribute__ ((unused)))
+{
+  return NULL;
+}
+
+static void *
+host_host2dev (int n __attribute__ ((unused)),
+	       void *d __attribute__ ((unused)),
+	       const void *h __attribute__ ((unused)),
+	       size_t s __attribute__ ((unused)))
+{
+  return NULL;
+}
+
+static void
+host_run (int n __attribute__ ((unused)), void *fn_ptr, void *vars)
+{
+  void (*fn)(void *) = (void (*)(void *)) fn_ptr;
+
+  fn (vars);
+}
+
+static void
+host_openacc_exec (void (*fn) (void *),
+		   size_t mapnum __attribute__ ((unused)),
+		   void **hostaddrs,
+		   void **devaddrs __attribute__ ((unused)),
+		   size_t shared_size __attribute__ ((unused)),
+		   int async __attribute__ ((unused)),
+		   unsigned *dims __attribute__ ((unused)),
+		   void *targ_mem_desc __attribute__ ((unused)))
+{
+  fn (hostaddrs);
+}
+
+static void
+host_openacc_register_async_cleanup (void *targ_mem_desc __attribute__ ((unused)))
+{
+}
+
+static int
+host_openacc_async_test (int async __attribute__ ((unused)))
+{
+  return 1;
+}
+
+static int
+host_openacc_async_test_all (void)
+{
+  return 1;
+}
+
+static void
+host_openacc_async_wait (int async __attribute__ ((unused)))
+{
+}
+
+static void
+host_openacc_async_wait_async (int async1 __attribute__ ((unused)),
+			       int async2 __attribute__ ((unused)))
+{
+}
+
+static void
+host_openacc_async_wait_all (void)
+{
+}
+
+static void
+host_openacc_async_wait_all_async (int async __attribute__ ((unused)))
+{
+}
+
+static void
+host_openacc_async_set_async (int async __attribute__ ((unused)))
+{
+}
+
+static void *
+host_openacc_create_thread_data (int ord __attribute__ ((unused)))
+{
+  return NULL;
+}
+
+static void
+host_openacc_destroy_thread_data (void *tls_data __attribute__ ((unused)))
+{
+}
 
 static struct gomp_device_descr host_dispatch =
   {
     .name = "host",
-    .capabilities = (GOMP_OFFLOAD_CAP_OPENACC_200
+    .capabilities = (GOMP_OFFLOAD_CAP_SHARED_MEM
 		     | GOMP_OFFLOAD_CAP_NATIVE_EXEC
-		     | GOMP_OFFLOAD_CAP_SHARED_MEM),
+		     | GOMP_OFFLOAD_CAP_OPENACC_200),
     .target_id = 0,
     .type = OFFLOAD_TARGET_TYPE_HOST,
 
-    .get_name_func = GOMP_OFFLOAD_get_name,
-    .get_caps_func = GOMP_OFFLOAD_get_caps,
-    .get_type_func = GOMP_OFFLOAD_get_type,
-    .get_num_devices_func = GOMP_OFFLOAD_get_num_devices,
-    .init_device_func = GOMP_OFFLOAD_init_device,
-    .fini_device_func = GOMP_OFFLOAD_fini_device,
+    .get_name_func = host_get_name,
+    .get_caps_func = host_get_caps,
+    .get_type_func = host_get_type,
+    .get_num_devices_func = host_get_num_devices,
+    .init_device_func = host_init_device,
+    .fini_device_func = host_fini_device,
     .version_func = NULL,
-    .load_image = {.unver_func = GOMP_OFFLOAD_load_image},
-    .unload_image = {.unver_func = GOMP_OFFLOAD_unload_image},
-    .alloc_func = GOMP_OFFLOAD_alloc,
-    .free_func = GOMP_OFFLOAD_free,
-    .dev2host_func = GOMP_OFFLOAD_dev2host,
-    .host2dev_func = GOMP_OFFLOAD_host2dev,
-    .run_func = GOMP_OFFLOAD_run,
+    .load_image = {.unver_func = host_load_image},
+    .unload_image = {.unver_func = host_unload_image},
+    .alloc_func = host_alloc,
+    .free_func = host_free,
+    .dev2host_func = host_dev2host,
+    .host2dev_func = host_host2dev,
+    .run_func = host_run,
 
+    .mem_map = { NULL },
+    /* .lock initilized in goacc_host_init.  */
     .is_initialized = false,
 
     .openacc = {
-      .exec_func = GOMP_OFFLOAD_openacc_parallel,
+      .data_environ = NULL,
 
-      .register_async_cleanup_func
-        = GOMP_OFFLOAD_openacc_register_async_cleanup,
+      .exec_func = host_openacc_exec,
 
-      .async_set_async_func = GOMP_OFFLOAD_openacc_async_set_async,
-      .async_test_func = GOMP_OFFLOAD_openacc_async_test,
-      .async_test_all_func = GOMP_OFFLOAD_openacc_async_test_all,
-      .async_wait_func = GOMP_OFFLOAD_openacc_async_wait,
-      .async_wait_async_func = GOMP_OFFLOAD_openacc_async_wait_async,
-      .async_wait_all_func = GOMP_OFFLOAD_openacc_async_wait_all,
-      .async_wait_all_async_func = GOMP_OFFLOAD_openacc_async_wait_all_async,
+      .register_async_cleanup_func = host_openacc_register_async_cleanup,
 
-      .create_thread_data_func = GOMP_OFFLOAD_openacc_create_thread_data,
-      .destroy_thread_data_func = GOMP_OFFLOAD_openacc_destroy_thread_data,
+      .async_test_func = host_openacc_async_test,
+      .async_test_all_func = host_openacc_async_test_all,
+      .async_wait_func = host_openacc_async_wait,
+      .async_wait_async_func = host_openacc_async_wait_async,
+      .async_wait_all_func = host_openacc_async_wait_all,
+      .async_wait_all_async_func = host_openacc_async_wait_all_async,
+      .async_set_async_func = host_openacc_async_set_async,
+
+      .create_thread_data_func = host_openacc_create_thread_data,
+      .destroy_thread_data_func = host_openacc_destroy_thread_data,
 
       .cuda = {
 	.get_current_device_func = NULL,
@@ -82,9 +243,9 @@ static struct gomp_device_descr host_dispatch =
     }
   };
 
-/* Register this device type.  */
-static __attribute__ ((constructor))
-void goacc_host_init (void)
+/* Initialize and register this device type.  */
+static __attribute__ ((constructor)) void
+goacc_host_init (void)
 {
   gomp_mutex_init (&host_dispatch.lock);
   goacc_register (&host_dispatch);
diff --git libgomp/oacc-init.c libgomp/oacc-init.c
index f0d1df9..a3c559e 100644
--- libgomp/oacc-init.c
+++ libgomp/oacc-init.c
@@ -29,7 +29,6 @@
 #include "libgomp.h"
 #include "oacc-int.h"
 #include "openacc.h"
-#include "plugin/plugin-host.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <strings.h>
@@ -102,7 +101,6 @@ name_of_acc_device_t (enum acc_device_t type)
     case acc_device_none: return "none";
     case acc_device_default: return "default";
     case acc_device_host: return "host";
-    case acc_device_host_nonshm: return "host_nonshm";
     case acc_device_not_host: return "not_host";
     case acc_device_nvidia: return "nvidia";
     default: gomp_fatal ("unknown device type %u", (unsigned) type);
@@ -637,18 +635,8 @@ ialias (acc_set_device_num)
 int
 acc_on_device (acc_device_t dev)
 {
-  struct goacc_thread *thr = goacc_thread ();
-
-  /* We only want to appear to be the "host_nonshm" plugin from "offloaded"
-     code -- i.e. within a parallel region.  Test a flag set by the
-     openacc_parallel hook of the host_nonshm plugin to determine that.  */
-  if (acc_get_device_type () == acc_device_host_nonshm
-      && thr && thr->target_tls
-      && ((struct nonshm_thread *)thr->target_tls)->nonshm_exec)
-    return dev == acc_device_host_nonshm || dev == acc_device_not_host;
-
-  /* For OpenACC, libgomp is only built for the host, so this is sufficient.  */
-  return dev == acc_device_host || dev == acc_device_none;
+  /* Just rely on the compiler builtin.  */
+  return __builtin_acc_on_device (dev);
 }
 
 ialias (acc_on_device)
diff --git libgomp/oacc-parallel.c libgomp/oacc-parallel.c
index 5b727f8..8a3ca78 100644
--- libgomp/oacc-parallel.c
+++ libgomp/oacc-parallel.c
@@ -247,9 +247,6 @@ GOACC_parallel_keyed (int device, void (*fn) (void *), size_t mapnum,
       return;
     }
   
-  if (acc_device_type (acc_dev->type) == acc_device_host_nonshm)
-    alloc_host_shared_mem (shared_size);
-
   va_start (ap, shared_size);
   /* TODO: This will need amending when device_type is implemented.  */
   while (GOMP_LAUNCH_PACK (GOMP_LAUNCH_END, 0, 0)
@@ -334,9 +331,6 @@ GOACC_parallel_keyed (int device, void (*fn) (void *), size_t mapnum,
     }
 
   acc_dev->openacc.async_set_async_func (acc_async_sync);
-
-  if (acc_device_type (acc_dev->type) == acc_device_host_nonshm)
-    free_host_shared_mem ();
 }
 
 /* Legacy entry point.   */
diff --git libgomp/openacc.f90 libgomp/openacc.f90
index 04d8088..02ac3e0 100644
--- libgomp/openacc.f90
+++ libgomp/openacc.f90
@@ -43,7 +43,6 @@ module openacc_kinds
   integer (acc_device_kind), parameter :: acc_device_none = 0
   integer (acc_device_kind), parameter :: acc_device_default = 1
   integer (acc_device_kind), parameter :: acc_device_host = 2
-  integer (acc_device_kind), parameter :: acc_device_host_nonshm = 3
   integer (acc_device_kind), parameter :: acc_device_not_host = 4
   integer (acc_device_kind), parameter :: acc_device_nvidia = 5
 
diff --git libgomp/openacc.h libgomp/openacc.h
index 44a1526..c95a414 100644
--- libgomp/openacc.h
+++ libgomp/openacc.h
@@ -53,7 +53,6 @@ typedef enum acc_device_t
     acc_device_none = 0,
     acc_device_default = 1,
     acc_device_host = 2,
-    acc_device_host_nonshm = 3,
     acc_device_not_host = 4,
     acc_device_nvidia = 5,
     _ACC_device_hwm
diff --git libgomp/openacc_lib.h libgomp/openacc_lib.h
index 28659a1..0e36686 100644
--- libgomp/openacc_lib.h
+++ libgomp/openacc_lib.h
@@ -38,7 +38,6 @@
       integer (acc_device_kind), parameter :: acc_device_none = 0
       integer (acc_device_kind), parameter :: acc_device_default = 1
       integer (acc_device_kind), parameter :: acc_device_host = 2
-      integer (acc_device_kind), parameter :: acc_device_host_nonshm = 3
       integer (acc_device_kind), parameter :: acc_device_not_host = 4
       integer (acc_device_kind), parameter :: acc_device_nvidia = 5
 
diff --git libgomp/plugin/Makefrag.am libgomp/plugin/Makefrag.am
index 167485f..745becd 100644
--- libgomp/plugin/Makefrag.am
+++ libgomp/plugin/Makefrag.am
@@ -38,12 +38,3 @@ libgomp_plugin_nvptx_la_LDFLAGS += $(PLUGIN_NVPTX_LDFLAGS)
 libgomp_plugin_nvptx_la_LIBADD = libgomp.la $(PLUGIN_NVPTX_LIBS)
 libgomp_plugin_nvptx_la_LIBTOOLFLAGS = --tag=disable-static
 endif
-
-libgomp_plugin_host_nonshm_version_info = -version-info $(libtool_VERSION)
-toolexeclib_LTLIBRARIES += libgomp-plugin-host_nonshm.la
-libgomp_plugin_host_nonshm_la_SOURCES = plugin/plugin-host.c
-libgomp_plugin_host_nonshm_la_CPPFLAGS = $(AM_CPPFLAGS) -DHOST_NONSHM_PLUGIN
-libgomp_plugin_host_nonshm_la_LDFLAGS = \
-	$(libgomp_plugin_host_nonshm_version_info) $(lt_host_flags)
-libgomp_plugin_host_nonshm_la_LIBADD = libgomp.la
-libgomp_plugin_host_nonshm_la_LIBTOOLFLAGS = --tag=disable-static
diff --git libgomp/plugin/configfrag.ac libgomp/plugin/configfrag.ac
index 254c688..8c2a420 100644
--- libgomp/plugin/configfrag.ac
+++ libgomp/plugin/configfrag.ac
@@ -33,7 +33,6 @@ AC_CHECK_LIB(dl, dlsym, , [plugin_support=no])
 if test x"$plugin_support" = xyes; then
   AC_DEFINE(PLUGIN_SUPPORT, 1,
     [Define if all infrastructure, needed for plugins, is supported.])
-  offload_targets=host_nonshm
 elif test "x${enable_offload_targets-no}" != xno; then
   AC_MSG_ERROR([Can't support offloading without support for plugins])
 fi
diff --git libgomp/plugin/plugin-host.c libgomp/plugin/plugin-host.c
deleted file mode 100644
index d68e6fe..0000000
--- libgomp/plugin/plugin-host.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* OpenACC Runtime Library: acc_device_host, acc_device_host_nonshm.
-
-   Copyright (C) 2013-2015 Free Software Foundation, Inc.
-
-   Contributed by Mentor Embedded.
-
-   This file is part of the GNU Offloading and Multi Processing Library
-   (libgomp).
-
-   Libgomp is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
-   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-   more details.
-
-   Under Section 7 of GPL version 3, you are granted additional
-   permissions described in the GCC Runtime Library Exception, version
-   3.1, as published by the Free Software Foundation.
-
-   You should have received a copy of the GNU General Public License and
-   a copy of the GCC Runtime Library Exception along with this program;
-   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* Simple implementation of support routines for a shared-memory
-   acc_device_host, and a non-shared memory acc_device_host_nonshm, with the
-   latter built as a plugin.  */
-
-#include "openacc.h"
-#include "config.h"
-#ifdef HOST_NONSHM_PLUGIN
-#include "libgomp-plugin.h"
-#include "oacc-plugin.h"
-#else
-#include "libgomp.h"
-#include "oacc-int.h"
-#endif
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdbool.h>
-
-#ifdef HOST_NONSHM_PLUGIN
-#define STATIC
-#define GOMP(X) GOMP_PLUGIN_##X
-#define SELF "host_nonshm plugin: "
-#else
-#define STATIC static
-#define GOMP(X) gomp_##X
-#define SELF "host: "
-#endif
-
-#ifdef HOST_NONSHM_PLUGIN
-#include "plugin-host.h"
-#endif
-
-STATIC const char *
-GOMP_OFFLOAD_get_name (void)
-{
-#ifdef HOST_NONSHM_PLUGIN
-  return "host_nonshm";
-#else
-  return "host";
-#endif
-}
-
-STATIC unsigned int
-GOMP_OFFLOAD_get_caps (void)
-{
-  unsigned int caps = (GOMP_OFFLOAD_CAP_OPENACC_200
-		       | GOMP_OFFLOAD_CAP_NATIVE_EXEC);
-
-#ifndef HOST_NONSHM_PLUGIN
-  caps |= GOMP_OFFLOAD_CAP_SHARED_MEM;
-#endif
-
-  return caps;
-}
-
-STATIC int
-GOMP_OFFLOAD_get_type (void)
-{
-#ifdef HOST_NONSHM_PLUGIN
-  return OFFLOAD_TARGET_TYPE_HOST_NONSHM;
-#else
-  return OFFLOAD_TARGET_TYPE_HOST;
-#endif
-}
-
-STATIC int
-GOMP_OFFLOAD_get_num_devices (void)
-{
-  return 1;
-}
-
-STATIC void
-GOMP_OFFLOAD_init_device (int n __attribute__ ((unused)))
-{
-}
-
-STATIC void
-GOMP_OFFLOAD_fini_device (int n __attribute__ ((unused)))
-{
-}
-
-STATIC int
-GOMP_OFFLOAD_load_image (int n __attribute__ ((unused)),
-			 const void *t __attribute__ ((unused)),
-			 struct addr_pair **r __attribute__ ((unused)))
-{
-  return 0;
-}
-
-STATIC void
-GOMP_OFFLOAD_unload_image (int n __attribute__ ((unused)),
-			   const void *t __attribute__ ((unused)))
-{
-}
-
-STATIC void *
-GOMP_OFFLOAD_alloc (int n __attribute__ ((unused)), size_t s)
-{
-  return GOMP (malloc) (s);
-}
-
-STATIC void
-GOMP_OFFLOAD_free (int n __attribute__ ((unused)), void *p)
-{
-  free (p);
-}
-
-STATIC void *
-GOMP_OFFLOAD_host2dev (int n __attribute__ ((unused)), void *d, const void *h,
-		       size_t s)
-{
-#ifdef HOST_NONSHM_PLUGIN
-  memcpy (d, h, s);
-#endif
-
-  return 0;
-}
-
-STATIC void *
-GOMP_OFFLOAD_dev2host (int n __attribute__ ((unused)), void *h, const void *d,
-		       size_t s)
-{
-#ifdef HOST_NONSHM_PLUGIN
-  memcpy (h, d, s);
-#endif
-
-  return 0;
-}
-
-STATIC void
-GOMP_OFFLOAD_run (int n __attribute__ ((unused)), void *fn_ptr, void *vars)
-{
-  void (*fn)(void *) = (void (*)(void *)) fn_ptr;
-
-  fn (vars);
-}
-
-STATIC void
-GOMP_OFFLOAD_openacc_parallel (void (*fn) (void *),
-			       size_t mapnum __attribute__ ((unused)),
-			       void **hostaddrs __attribute__ ((unused)),
-			       void **devaddrs __attribute__ ((unused)),
-			       size_t shared_size __attribute__ ((unused)),
-			       int async __attribute__ ((unused)),
-			       unsigned *dims __attribute__ ((unused)),
-			       void *targ_mem_desc __attribute__ ((unused)))
-{
-#ifdef HOST_NONSHM_PLUGIN
-  struct nonshm_thread *thd = GOMP_PLUGIN_acc_thread ();
-  thd->nonshm_exec = true;
-  fn (devaddrs);
-  thd->nonshm_exec = false;
-#else
-  fn (hostaddrs);
-#endif
-}
-
-STATIC void
-GOMP_OFFLOAD_openacc_register_async_cleanup (void *targ_mem_desc)
-{
-#ifdef HOST_NONSHM_PLUGIN
-  /* "Asynchronous" launches are executed synchronously on the (non-SHM) host,
-     so there's no point in delaying host-side cleanup -- just do it now.  */
-  GOMP_PLUGIN_async_unmap_vars (targ_mem_desc);
-#endif
-}
-
-STATIC void
-GOMP_OFFLOAD_openacc_async_set_async (int async __attribute__ ((unused)))
-{
-}
-
-STATIC int
-GOMP_OFFLOAD_openacc_async_test (int async __attribute__ ((unused)))
-{
-  return 1;
-}
-
-STATIC int
-GOMP_OFFLOAD_openacc_async_test_all (void)
-{
-  return 1;
-}
-
-STATIC void
-GOMP_OFFLOAD_openacc_async_wait (int async __attribute__ ((unused)))
-{
-}
-
-STATIC void
-GOMP_OFFLOAD_openacc_async_wait_all (void)
-{
-}
-
-STATIC void
-GOMP_OFFLOAD_openacc_async_wait_async (int async1 __attribute__ ((unused)),
-				       int async2 __attribute__ ((unused)))
-{
-}
-
-STATIC void
-GOMP_OFFLOAD_openacc_async_wait_all_async (int async __attribute__ ((unused)))
-{
-}
-
-STATIC void *
-GOMP_OFFLOAD_openacc_create_thread_data (int ord
-					 __attribute__ ((unused)))
-{
-#ifdef HOST_NONSHM_PLUGIN
-  struct nonshm_thread *thd
-    = GOMP_PLUGIN_malloc (sizeof (struct nonshm_thread));
-  thd->nonshm_exec = false;
-  return thd;
-#else
-  return NULL;
-#endif
-}
-
-STATIC void
-GOMP_OFFLOAD_openacc_destroy_thread_data (void *tls_data)
-{
-#ifdef HOST_NONSHM_PLUGIN
-  free (tls_data);
-#endif
-}
diff --git libgomp/plugin/plugin-host.h libgomp/plugin/plugin-host.h
deleted file mode 100644
index 96955d1..0000000
--- libgomp/plugin/plugin-host.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* OpenACC Runtime Library: acc_device_host, acc_device_host_nonshm.
-
-   Copyright (C) 2015 Free Software Foundation, Inc.
-
-   Contributed by Mentor Embedded.
-
-   This file is part of the GNU Offloading and Multi Processing Library
-   (libgomp).
-
-   Libgomp is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
-   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-   more details.
-
-   Under Section 7 of GPL version 3, you are granted additional
-   permissions described in the GCC Runtime Library Exception, version
-   3.1, as published by the Free Software Foundation.
-
-   You should have received a copy of the GNU General Public License and
-   a copy of the GCC Runtime Library Exception along with this program;
-   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef PLUGIN_HOST_H
-#define PLUGIN_HOST_H
-
-struct nonshm_thread
-{
-  bool nonshm_exec;
-};
-
-#endif
diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp
index 6dba22b..33d1a54 100644
--- libgomp/testsuite/lib/libgomp.exp
+++ libgomp/testsuite/lib/libgomp.exp
@@ -243,7 +243,6 @@ proc libgomp_init { args } {
     set e_list [list \
 		    [list defaults DUMMY=dummy ] \
 		    [list ACC_DEVICE_TYPE-host ACC_DEVICE_TYPE=host ] \
-		    [list ACC_DEVICE_TYPE-host_nonshm ACC_DEVICE_TYPE=host_nonshm ] \
 		    [list ACC_DEVICE_TYPE-nvidia ACC_DEVICE_TYPE=nvidia ] ]
     foreach e $e_list {
 	set v [lindex $e 0]
@@ -412,13 +411,3 @@ proc check_effective_target_openacc_host_selected { } {
     }
     return 0;
 }
-
-# Return 1 if the host_nonshm target is selected for offloaded
-
-proc check_effective_target_openacc_host_nonshm_selected { } {
-    global offload_target_openacc
-    if { $offload_target_openacc == "host_nonshm" } {
-        return 1;
-    }
-    return 0;
-}
diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
index 3dbc917..e5c875c 100644
--- libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -114,9 +114,6 @@ if { $lang_test_file_found } {
 	    host {
 		set acc_mem_shared 1
 	    }
-	    host_nonshm {
-		set acc_mem_shared 0
-	    }
 	    nvidia {
 		if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		    # Don't bother; execution testing is going to FAIL.
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c
index 81ea476..8112745 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c
@@ -15,8 +15,6 @@ main (int argc, char *argv[])
       abort ();
     if (!acc_on_device (acc_device_host))
       abort ();
-    if (acc_on_device (acc_device_host_nonshm))
-      abort ();
     if (acc_on_device (acc_device_not_host))
       abort ();
     if (acc_on_device (acc_device_nvidia))
@@ -32,8 +30,6 @@ main (int argc, char *argv[])
       abort ();
     if (!acc_on_device (acc_device_host))
       abort ();
-    if (acc_on_device (acc_device_host_nonshm))
-      abort ();
     if (acc_on_device (acc_device_not_host))
       abort ();
     if (acc_on_device (acc_device_nvidia))
@@ -51,13 +47,6 @@ main (int argc, char *argv[])
       abort ();
     if (acc_on_device (acc_device_host))
       abort ();
-#if ACC_DEVICE_TYPE_host_nonshm
-    if (!acc_on_device (acc_device_host_nonshm))
-      abort ();
-#else
-    if (acc_on_device (acc_device_host_nonshm))
-      abort ();
-#endif
     if (!acc_on_device (acc_device_not_host))
       abort ();
 #if ACC_DEVICE_TYPE_nvidia
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c
index d6d1514..489d731 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c
@@ -1,6 +1,5 @@
 /* { dg-do run } */
 /* { dg-xfail-run-if "TODO" { openacc_host_selected } { "*" } { "" } } */
-/* { dg-xfail-run-if "TODO" { openacc_host_nonshm_selected } { "*" } { "" } } */
 
 #include <stdlib.h>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
index 5478bb6..2887f66f 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
@@ -1,5 +1,4 @@
 /* { dg-do run } */
-/* { dg-additional-options "-fno-builtin-acc_on_device" } */
 
 #include <openacc.h>
 #include <stdlib.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-gang-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-gang-1.c
index ada46d0..edf78be 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-gang-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-gang-1.c
@@ -3,7 +3,7 @@
 /* Test of gang-private variables declared in local scope with parallel
    directive.  */
 
-#if defined(ACC_DEVICE_TYPE_host) || defined(ACC_DEVICE_TYPE_host_nonshm)
+#if defined(ACC_DEVICE_TYPE_host)
 #define ACTUAL_GANGS 1
 #else
 #define ACTUAL_GANGS 32
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-par-gang-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-par-gang-2.c
index 8199186..3160181 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-par-gang-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-par-gang-2.c
@@ -2,7 +2,7 @@
 
 /* Test of gang-private variables declared on the parallel directive.  */
 
-#if defined(ACC_DEVICE_TYPE_host) || defined(ACC_DEVICE_TYPE_host_nonshm)
+#if defined(ACC_DEVICE_TYPE_host)
 #define ACTUAL_GANGS 1
 #else
 #define ACTUAL_GANGS 32
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/worker-single-6.c libgomp/testsuite/libgomp.oacc-c-c++-common/worker-single-6.c
index b96ae2a..cbc3e37 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/worker-single-6.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/worker-single-6.c
@@ -1,6 +1,6 @@
 #include <assert.h>
 
-#if defined(ACC_DEVICE_TYPE_host) || defined(ACC_DEVICE_TYPE_host_nonshm)
+#if defined(ACC_DEVICE_TYPE_host)
 #define ACTUAL_GANGS 1
 #else
 #define ACTUAL_GANGS 8
diff --git libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
index 988dfc6..c91a41b 100644
--- libgomp/testsuite/libgomp.oacc-c/c.exp
+++ libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -72,9 +72,6 @@ foreach offload_target_openacc $offload_targets_s_openacc {
 	host {
 	    set acc_mem_shared 1
 	}
-	host_nonshm {
-	    set acc_mem_shared 0
-	}
 	nvidia {
 	    if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		# Don't bother; execution testing is going to FAIL.
diff --git libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90 libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90
index 4488818..1a10f32 100644
--- libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90
+++ libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90
@@ -11,7 +11,6 @@ implicit none
 
 if (.not. acc_on_device (acc_device_none)) call abort
 if (.not. acc_on_device (acc_device_host)) call abort
-if (acc_on_device (acc_device_host_nonshm)) call abort
 if (acc_on_device (acc_device_not_host)) call abort
 if (acc_on_device (acc_device_nvidia)) call abort
 
@@ -21,7 +20,6 @@ if (acc_on_device (acc_device_nvidia)) call abort
 !$acc parallel if(.false.)
 if (.not. acc_on_device (acc_device_none)) call abort
 if (.not. acc_on_device (acc_device_host)) call abort
-if (acc_on_device (acc_device_host_nonshm)) call abort
 if (acc_on_device (acc_device_not_host)) call abort
 if (acc_on_device (acc_device_nvidia)) call abort
 !$acc end parallel
@@ -34,11 +32,6 @@ if (acc_on_device (acc_device_nvidia)) call abort
 !$acc parallel
 if (acc_on_device (acc_device_none)) call abort
 if (acc_on_device (acc_device_host)) call abort
-#if ACC_DEVICE_TYPE_host_nonshm
-if (.not. acc_on_device (acc_device_host_nonshm)) call abort
-#else
-if (acc_on_device (acc_device_host_nonshm)) call abort
-#endif
 if (.not. acc_on_device (acc_device_not_host)) call abort
 #if ACC_DEVICE_TYPE_nvidia
 if (.not. acc_on_device (acc_device_nvidia)) call abort
diff --git libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f
index 0047a19..a19045b 100644
--- libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f
+++ libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f
@@ -11,7 +11,6 @@
 
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
-      IF (ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
 
@@ -21,7 +20,6 @@
 !$ACC PARALLEL IF(.FALSE.)
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
-      IF (ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
 !$ACC END PARALLEL
@@ -34,11 +32,6 @@
 !$ACC PARALLEL
       IF (ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
-#if ACC_DEVICE_TYPE_host_nonshm
-      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
-#else
-      IF (ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
-#endif
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
 #if ACC_DEVICE_TYPE_nvidia
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
diff --git libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f
index 49d7a72..c391776 100644
--- libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f
+++ libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f
@@ -11,7 +11,6 @@
 
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
-      IF (ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
 
@@ -21,7 +20,6 @@
 !$ACC PARALLEL IF(.FALSE.)
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
-      IF (ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
 !$ACC END PARALLEL
@@ -34,11 +32,6 @@
 !$ACC PARALLEL
       IF (ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
-#if ACC_DEVICE_TYPE_host_nonshm
-      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
-#else
-      IF (ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
-#endif
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
 #if ACC_DEVICE_TYPE_nvidia
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
diff --git libgomp/testsuite/libgomp.oacc-fortran/data-2.f90 libgomp/testsuite/libgomp.oacc-fortran/data-2.f90
index 0d50dfc..2b7932e 100644
--- libgomp/testsuite/libgomp.oacc-fortran/data-2.f90
+++ libgomp/testsuite/libgomp.oacc-fortran/data-2.f90
@@ -79,7 +79,7 @@ program test
     if (d(i) .ne. 4.0) call abort
   end do
 
-#if !ACC_MEM_SHARED && !ACC_DEVICE_TYPE_host_nonshm
+#if !ACC_MEM_SHARED
 
   c(:) = 3.0
   d(:) = 0.0
diff --git libgomp/testsuite/libgomp.oacc-fortran/fortran.exp libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
index a02a9e8..df46004 100644
--- libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
+++ libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
@@ -87,9 +87,6 @@ if { $lang_test_file_found } {
 	    host {
 		set acc_mem_shared 1
 	    }
-	    host_nonshm {
-		set acc_mem_shared 0
-	    }
 	    nvidia {
 		if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		    # Don't bother; execution testing is going to FAIL.
diff --git libgomp/testsuite/libgomp.oacc-fortran/private-vars-par-gang-2.f90 libgomp/testsuite/libgomp.oacc-fortran/private-vars-par-gang-2.f90
index bb0891c..bdc97d9 100644
--- libgomp/testsuite/libgomp.oacc-fortran/private-vars-par-gang-2.f90
+++ libgomp/testsuite/libgomp.oacc-fortran/private-vars-par-gang-2.f90
@@ -1,9 +1,8 @@
-
 ! { dg-additional-options "-cpp" }
 
 ! Test of gang-private variables declared on the parallel directive.
 
-#if defined(ACC_DEVICE_TYPE_host) || defined(ACC_DEVICE_TYPE_host_nonshm)
+#if defined(ACC_DEVICE_TYPE_host)
 #define ACTUAL_GANGS 1
 #else
 #define ACTUAL_GANGS 32


Grüße,
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: libgomp: plugin for non-shared memory host execution
  2015-07-31 15:40           ` Thomas Schwinge
@ 2015-08-10 16:51             ` Thomas Schwinge
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Schwinge @ 2015-08-10 16:51 UTC (permalink / raw)
  To: gcc-patches
  Cc: Jakub Jelinek, michael.v.zolotukhin, nathan, kirill.yukhin, iverbin

[-- Attachment #1: Type: text/plain, Size: 49565 bytes --]

Hi!

On Fri, 31 Jul 2015 16:16:59 +0200, I wrote:
> On Thu, 30 Jul 2015 13:51:17 +0200, Jakub Jelinek <jakub@redhat.com> wrote:
> > On Thu, Jul 30, 2015 at 01:47:37PM +0200, Thomas Schwinge wrote:
> > > > Here is such a libgomp plugin plus the infrastructure for initial support
> > > > of non-shared memory host execution.  [...]
> > > 
> > > ... the libgomp plugin as it is currently implemented fails to adequately
> > > provide such functionality: nobody so far has implemented support for
> > > certain data mapping constructs; so it is not currently used for OpenMP
> > > offloading testing, and also disabled for certain OpenACC offloading test
> > > cases.  Its improper integration into the offloading compilation process,
> > > <https://gcc.gnu.org/wiki/Offloading#Compilation_process>, is also
> > > causing issues: we use the target compiler for compiling "device" code --
> > > but it doesn't know that it's being used for that purpose, so cannot
> > > properly handle some constructs, such as efficiently implement
> > > acc_on_device with constant argument.
> > > 
> > > It has been useful for initial bring-up, to test-drive the libgomp plugin
> > > interface, when the nvptx backend and libgomp nvptx plugin as well as the
> > > intelmic plugin were not yet available, but it's now probably time to
> > > retire this plugin, at least until somebody feels like working on
> > > integrating and implementing it properly.  Unless there are any
> > > objections, I'll later propose a patch to this effect.
> > 
> > I agree with the removal.  It would be nice if somebody could add OpenACC
> > support to the IntelMIC plugin, then you'd get a non-shared memory host
> > execution testing for free, as it has a reasonable emulation mode.
> 
> I find the intelmic plugin, with all its emulation code, a bit
> heavy-weight for this purpose.  But, let's leave that for later.  ;-)
> 
> Committed to gomp-4_0-branch in r226444; will address trunk later (next
> week).
> 
> commit 0eefa17a15b9a58fff02239289fc9c40ed62634f
> Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
> Date:   Fri Jul 31 14:13:59 2015 +0000
> 
>     [PR libgomp/65742, PR middle-end/66332] libgomp: Remove plugin for non-shared memory host execution

Committed to trunk in r226763:

commit f212338e41d10436a48f04ea499f63dce5bf50ef
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Aug 10 16:48:26 2015 +0000

    [PR libgomp/65742, PR middle-end/66332] libgomp: Remove plugin for non-shared memory host execution
    
    	gcc/
    	* builtins.c (expand_builtin_acc_on_device) [ACCEL_COMPILER]: Emit
    	open-coded sequence.
    	* omp-low.c (oacc_process_reduction_data): Remove handline of
    	GOMP_DEVICE_HOST_NONSHM.
    	gcc/testsuite/
    	* c-c++-common/goacc/acc_on_device-2.c: Remove XFAIL for C.
    	include/
    	* gomp-constants.c (GOMP_DEVICE_HOST_NONSHM): Remove.
    	libgomp/
    	* libgomp-plugin.h (enum offload_target_type): Remove
    	OFFLOAD_TARGET_TYPE_HOST_NONSHM.
    	* openacc.f90 (openacc_kinds): Remove acc_device_host_nonshm.
    	* openacc.h (enum acc_device_t): Likewise.
    	* openacc_lib.h: Likewise.
    	* oacc-init.c (name_of_acc_device_t): Don't handle it.
    	(acc_on_device): Just use __builtin_acc_on_device.
    	* testsuite/libgomp.oacc-c-c++-common/if-1.c: Don't forbid usage
    	of acc_on_device builtin.
    	* plugin/plugin-host.h: Remove file.
    	* plugin/plugin-host.c: Likewise, but salvage some content into...
    	* oacc-host.c: ... this file.
    	* plugin/Makefrag.am: Don't build libgomp-plugin-host_nonshm.la.
    	* plugin/configfrag.ac (offload_targets): Don't add host_nonshm.
    	* Makefile.in: Regenerate.
    	* configure: Likewise.
    	* testsuite/lib/libgomp.exp
    	(check_effective_target_openacc_host_nonshm_selected): Remove.
    	* testsuite/libgomp.oacc-c++/c++.exp: Don't handle
    	ACC_DEVICE_TYPE=host_nonshm.
    	* testsuite/libgomp.oacc-c/c.exp: Likewise.
    	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise.
    	* testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise.
    	* testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise.
    	* testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226763 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog                                      |    7 +
 gcc/builtins.c                                     |   12 +-
 gcc/omp-low.c                                      |   18 --
 gcc/testsuite/ChangeLog                            |    6 +
 gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c |   10 +-
 include/ChangeLog                                  |    4 +
 include/gomp-constants.h                           |    4 +-
 libgomp/ChangeLog                                  |   29 +++
 libgomp/Makefile.in                                |   33 +--
 libgomp/configure                                  |    1 -
 libgomp/libgomp-plugin.h                           |    2 +-
 libgomp/oacc-host.c                                |  230 ++++++++++++++---
 libgomp/oacc-init.c                                |   16 +-
 libgomp/openacc.f90                                |    2 +-
 libgomp/openacc.h                                  |    2 +-
 libgomp/openacc_lib.h                              |    3 +-
 libgomp/plugin/Makefrag.am                         |    9 -
 libgomp/plugin/configfrag.ac                       |    1 -
 libgomp/plugin/plugin-host.c                       |  259 --------------------
 libgomp/plugin/plugin-host.h                       |   37 ---
 libgomp/testsuite/lib/libgomp.exp                  |   10 -
 libgomp/testsuite/libgomp.oacc-c++/c++.exp         |    3 -
 .../libgomp.oacc-c-c++-common/acc_on_device-1.c    |   11 -
 libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c |    1 -
 libgomp/testsuite/libgomp.oacc-c/c.exp             |    3 -
 .../libgomp.oacc-fortran/acc_on_device-1-1.f90     |    7 -
 .../libgomp.oacc-fortran/acc_on_device-1-2.f       |    7 -
 .../libgomp.oacc-fortran/acc_on_device-1-3.f       |    7 -
 libgomp/testsuite/libgomp.oacc-fortran/fortran.exp |    3 -
 29 files changed, 261 insertions(+), 476 deletions(-)

diff --git gcc/ChangeLog gcc/ChangeLog
index f547931..efc177c 100644
--- gcc/ChangeLog
+++ gcc/ChangeLog
@@ -1,5 +1,12 @@
 2015-08-10  Thomas Schwinge  <thomas@codesourcery.com>
 
+	PR libgomp/65742
+	PR middle-end/66332
+	* builtins.c (expand_builtin_acc_on_device) [ACCEL_COMPILER]: Emit
+	open-coded sequence.
+	* omp-low.c (oacc_process_reduction_data): Remove handline of
+	GOMP_DEVICE_HOST_NONSHM.
+
 	* lto-streamer-in.c (lto_input_mode_table): Adjust to
 	GET_MODE_INNER changes.
 
diff --git gcc/builtins.c gcc/builtins.c
index eb7b7b2..82229a5 100644
--- gcc/builtins.c
+++ gcc/builtins.c
@@ -5879,10 +5879,8 @@ expand_stack_save (void)
    acceleration device (ACCEL_COMPILER conditional).  */
 
 static rtx
-expand_builtin_acc_on_device (tree exp ATTRIBUTE_UNUSED,
-			      rtx target ATTRIBUTE_UNUSED)
+expand_builtin_acc_on_device (tree exp, rtx target)
 {
-#ifdef ACCEL_COMPILER
   if (!validate_arglist (exp, INTEGER_TYPE, VOID_TYPE))
     return NULL_RTX;
 
@@ -5891,8 +5889,13 @@ expand_builtin_acc_on_device (tree exp ATTRIBUTE_UNUSED,
   /* Return (arg == v1 || arg == v2) ? 1 : 0.  */
   machine_mode v_mode = TYPE_MODE (TREE_TYPE (arg));
   rtx v = expand_normal (arg), v1, v2;
+#ifdef ACCEL_COMPILER
   v1 = GEN_INT (GOMP_DEVICE_NOT_HOST);
   v2 = GEN_INT (ACCEL_COMPILER_acc_device);
+#else
+  v1 = GEN_INT (GOMP_DEVICE_NONE);
+  v2 = GEN_INT (GOMP_DEVICE_HOST);
+#endif
   machine_mode target_mode = TYPE_MODE (integer_type_node);
   if (!target || !register_operand (target, target_mode))
     target = gen_reg_rtx (target_mode);
@@ -5906,9 +5909,6 @@ expand_builtin_acc_on_device (tree exp ATTRIBUTE_UNUSED,
   emit_label (done_label);
 
   return target;
-#else
-  return NULL;
-#endif
 }
 
 
diff --git gcc/omp-low.c gcc/omp-low.c
index 0f5c0f1..c1dc919 100644
--- gcc/omp-low.c
+++ gcc/omp-low.c
@@ -9975,24 +9975,6 @@ oacc_process_reduction_data (gimple_seq *body, gimple_seq *in_stmt_seqp,
 			   in_stmt_seqp);
 	  gimple_seq_add_stmt (in_stmt_seqp, gimple_build_label (exit));
 
-	  /* Also, set nthreads = 1 for ACC_DEVICE_TYPE=host_nonshm.  */
-	  gimplify_assign (acc_device_host,
-			   build_int_cst (integer_type_node,
-					  GOMP_DEVICE_HOST_NONSHM),
-			   in_stmt_seqp);
-
-	  enter = create_artificial_label (UNKNOWN_LOCATION);
-	  exit = create_artificial_label (UNKNOWN_LOCATION);
-
-	  stmt = gimple_build_cond (EQ_EXPR, acc_device, acc_device_host,
-				    enter, exit);
-	  gimple_seq_add_stmt (in_stmt_seqp, stmt);
-	  gimple_seq_add_stmt (in_stmt_seqp, gimple_build_label (enter));
-	  gimplify_assign (nthreads, fold_build1 (NOP_EXPR, sizetype,
-						  integer_one_node),
-			   in_stmt_seqp);
-	  gimple_seq_add_stmt (in_stmt_seqp, gimple_build_label (exit));
-
 	  oacc_initialize_reduction_data (clauses, nthreads, in_stmt_seqp,
 					  ctx);
 	  oacc_finalize_reduction_data (clauses, nthreads, out_stmt_seqp, ctx);
diff --git gcc/testsuite/ChangeLog gcc/testsuite/ChangeLog
index 0e707eb..bf858e2 100644
--- gcc/testsuite/ChangeLog
+++ gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2015-08-10  Thomas Schwinge  <thomas@codesourcery.com>
+
+	PR libgomp/65742
+	PR middle-end/66332
+	* c-c++-common/goacc/acc_on_device-2.c: Remove XFAIL for C.
+
 2015-08-10  Uros Bizjak  <ubizjak@gmail.com>
 
 	PR fortran/64022
diff --git gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c
index 6e3d292..ef622a8 100644
--- gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c
+++ gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c
@@ -20,17 +20,9 @@ f (void)
 }
 
 /* With -fopenacc, we're expecting the builtin to be expanded, so no calls.
-
    TODO: in C++, even under extern "C", the use of enum for acc_device_t
    perturbs expansion as a builtin, which expects an int parameter.  It's fine
    when changing acc_device_t to plain int, but that's not what we're doing in
    <openacc.h>.
 
-   TODO: given that we can't expand acc_on_device in
-   gcc/builtins.c:expand_builtin_acc_on_device for in the !ACCEL_COMPILER case
-   (because at that point we don't know whether we're acc_device_host or
-   acc_device_host_nonshm), we'll (erroneously) get a library call in the host
-   code.
-
-   { dg-final { scan-rtl-dump-times "\\\(call \[^\\n\]* acc_on_device" 0 "expand" { xfail { c || c++ } } } } */
-
+   { dg-final { scan-rtl-dump-times "\\\(call \[^\\n\]* acc_on_device" 0 "expand" { xfail c++ } } } */
diff --git include/ChangeLog include/ChangeLog
index 4a18ed8..7e2e499 100644
--- include/ChangeLog
+++ include/ChangeLog
@@ -1,3 +1,7 @@
+2015-08-10  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* gomp-constants.c (GOMP_DEVICE_HOST_NONSHM): Remove.
+
 2015-05-22  Yunlian Jiang  <yunlian@google.com>
 
 	* libiberty.h (asprintf): Don't declare if HAVE_DECL_ASPRINTF is
diff --git include/gomp-constants.h include/gomp-constants.h
index e3d2820..807e672 100644
--- include/gomp-constants.h
+++ include/gomp-constants.h
@@ -101,11 +101,11 @@ enum gomp_map_kind
 
 /* Device codes.  Keep in sync with
    libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_device_t as well as
-   libgomp/libgomp_target.h.  */
+   libgomp/libgomp-plugin.h.  */
 #define GOMP_DEVICE_NONE		0
 #define GOMP_DEVICE_DEFAULT		1
 #define GOMP_DEVICE_HOST		2
-#define GOMP_DEVICE_HOST_NONSHM		3
+/* #define GOMP_DEVICE_HOST_NONSHM	3 removed.  */
 #define GOMP_DEVICE_NOT_HOST		4
 #define GOMP_DEVICE_NVIDIA_PTX		5
 #define GOMP_DEVICE_INTEL_MIC		6
diff --git libgomp/ChangeLog libgomp/ChangeLog
index 084aabd..1d265b6 100644
--- libgomp/ChangeLog
+++ libgomp/ChangeLog
@@ -1,4 +1,33 @@
 2015-08-10  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* libgomp-plugin.h (enum offload_target_type): Remove
+	OFFLOAD_TARGET_TYPE_HOST_NONSHM.
+	* openacc.f90 (openacc_kinds): Remove acc_device_host_nonshm.
+	* openacc.h (enum acc_device_t): Likewise.
+	* openacc_lib.h: Likewise.
+	* oacc-init.c (name_of_acc_device_t): Don't handle it.
+	(acc_on_device): Just use __builtin_acc_on_device.
+	* testsuite/libgomp.oacc-c-c++-common/if-1.c: Don't forbid usage
+	of acc_on_device builtin.
+	* plugin/plugin-host.h: Remove file.
+	* plugin/plugin-host.c: Likewise, but salvage some content into...
+	* oacc-host.c: ... this file.
+	* plugin/Makefrag.am: Don't build libgomp-plugin-host_nonshm.la.
+	* plugin/configfrag.ac (offload_targets): Don't add host_nonshm.
+	* Makefile.in: Regenerate.
+	* configure: Likewise.
+	* testsuite/lib/libgomp.exp
+	(check_effective_target_openacc_host_nonshm_selected): Remove.
+	* testsuite/libgomp.oacc-c++/c++.exp: Don't handle
+	ACC_DEVICE_TYPE=host_nonshm.
+	* testsuite/libgomp.oacc-c/c.exp: Likewise.
+	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise.
+	* testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise.
+	* testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise.
+	* testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise.
+
+2015-08-10  Thomas Schwinge  <thomas@codesourcery.com>
 	    Jakub Jelinek  <jakub@redhat.com>
 
 	* config/nvptx/affinity.c: New file.
diff --git libgomp/Makefile.in libgomp/Makefile.in
index 9d07e8d..79745ce 100644
--- libgomp/Makefile.in
+++ libgomp/Makefile.in
@@ -146,15 +146,6 @@ am__installdirs = "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)" \
 	"$(DESTDIR)$(fincludedir)" "$(DESTDIR)$(libsubincludedir)" \
 	"$(DESTDIR)$(toolexeclibdir)"
 LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
-libgomp_plugin_host_nonshm_la_DEPENDENCIES = libgomp.la
-am_libgomp_plugin_host_nonshm_la_OBJECTS =  \
-	libgomp_plugin_host_nonshm_la-plugin-host.lo
-libgomp_plugin_host_nonshm_la_OBJECTS =  \
-	$(am_libgomp_plugin_host_nonshm_la_OBJECTS)
-libgomp_plugin_host_nonshm_la_LINK = $(LIBTOOL) --tag=CC \
-	$(libgomp_plugin_host_nonshm_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-	$(libgomp_plugin_host_nonshm_la_LDFLAGS) $(LDFLAGS) -o $@
 am__DEPENDENCIES_1 =
 @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_DEPENDENCIES = libgomp.la \
 @PLUGIN_NVPTX_TRUE@	$(am__DEPENDENCIES_1)
@@ -196,8 +187,7 @@ FCLD = $(FC)
 FCLINK = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libgomp_plugin_host_nonshm_la_SOURCES) \
-	$(libgomp_plugin_nvptx_la_SOURCES) $(libgomp_la_SOURCES)
+SOURCES = $(libgomp_plugin_nvptx_la_SOURCES) $(libgomp_la_SOURCES)
 MULTISRCTOP = 
 MULTIBUILDTOP = 
 MULTIDIRS = 
@@ -401,8 +391,7 @@ libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
 AM_CPPFLAGS = $(addprefix -I, $(search_path))
 AM_CFLAGS = $(XCFLAGS)
 AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
-toolexeclib_LTLIBRARIES = libgomp.la $(am__append_1) \
-	libgomp-plugin-host_nonshm.la
+toolexeclib_LTLIBRARIES = libgomp.la $(am__append_1)
 nodist_toolexeclib_HEADERS = libgomp.spec
 
 # -Wc is only a libtool option.
@@ -437,14 +426,6 @@ libgomp_la_SOURCES = alloc.c barrier.c critical.c env.c error.c iter.c \
 @PLUGIN_NVPTX_TRUE@	$(lt_host_flags) $(PLUGIN_NVPTX_LDFLAGS)
 @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_LIBADD = libgomp.la $(PLUGIN_NVPTX_LIBS)
 @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_LIBTOOLFLAGS = --tag=disable-static
-libgomp_plugin_host_nonshm_version_info = -version-info $(libtool_VERSION)
-libgomp_plugin_host_nonshm_la_SOURCES = plugin/plugin-host.c
-libgomp_plugin_host_nonshm_la_CPPFLAGS = $(AM_CPPFLAGS) -DHOST_NONSHM_PLUGIN
-libgomp_plugin_host_nonshm_la_LDFLAGS = \
-	$(libgomp_plugin_host_nonshm_version_info) $(lt_host_flags)
-
-libgomp_plugin_host_nonshm_la_LIBADD = libgomp.la
-libgomp_plugin_host_nonshm_la_LIBTOOLFLAGS = --tag=disable-static
 nodist_noinst_HEADERS = libgomp_f.h
 nodist_libsubinclude_HEADERS = omp.h openacc.h
 @USE_FORTRAN_TRUE@nodist_finclude_HEADERS = omp_lib.h omp_lib.f90 omp_lib.mod omp_lib_kinds.mod \
@@ -572,8 +553,6 @@ clean-toolexeclibLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libgomp-plugin-host_nonshm.la: $(libgomp_plugin_host_nonshm_la_OBJECTS) $(libgomp_plugin_host_nonshm_la_DEPENDENCIES) $(EXTRA_libgomp_plugin_host_nonshm_la_DEPENDENCIES) 
-	$(libgomp_plugin_host_nonshm_la_LINK) -rpath $(toolexeclibdir) $(libgomp_plugin_host_nonshm_la_OBJECTS) $(libgomp_plugin_host_nonshm_la_LIBADD) $(LIBS)
 libgomp-plugin-nvptx.la: $(libgomp_plugin_nvptx_la_OBJECTS) $(libgomp_plugin_nvptx_la_DEPENDENCIES) $(EXTRA_libgomp_plugin_nvptx_la_DEPENDENCIES) 
 	$(libgomp_plugin_nvptx_la_LINK) $(am_libgomp_plugin_nvptx_la_rpath) $(libgomp_plugin_nvptx_la_OBJECTS) $(libgomp_plugin_nvptx_la_LIBADD) $(LIBS)
 libgomp.la: $(libgomp_la_OBJECTS) $(libgomp_la_DEPENDENCIES) $(EXTRA_libgomp_la_DEPENDENCIES) 
@@ -596,7 +575,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iter.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iter_ull.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgomp-plugin.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgomp_plugin_host_nonshm_la-plugin-host.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgomp_plugin_nvptx_la-plugin-nvptx.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loop.Plo@am__quote@
@@ -644,13 +622,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
-libgomp_plugin_host_nonshm_la-plugin-host.lo: plugin/plugin-host.c
-@am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(libgomp_plugin_host_nonshm_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgomp_plugin_host_nonshm_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgomp_plugin_host_nonshm_la-plugin-host.lo -MD -MP -MF $(DEPDIR)/libgomp_plugin_host_nonshm_la-plugin-host.Tpo -c -o libgomp_plugin_host_nonshm_la-plugin-host.lo `test -f 'plugin/plugin-host.c' || echo '$(srcdir)/'`plugin/plugin-host.c
-@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgomp_plugin_host_nonshm_la-plugin-host.Tpo $(DEPDIR)/libgomp_plugin_host_nonshm_la-plugin-host.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='plugin/plugin-host.c' object='libgomp_plugin_host_nonshm_la-plugin-host.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(libgomp_plugin_host_nonshm_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgomp_plugin_host_nonshm_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgomp_plugin_host_nonshm_la-plugin-host.lo `test -f 'plugin/plugin-host.c' || echo '$(srcdir)/'`plugin/plugin-host.c
-
 libgomp_plugin_nvptx_la-plugin-nvptx.lo: plugin/plugin-nvptx.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(libgomp_plugin_nvptx_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgomp_plugin_nvptx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgomp_plugin_nvptx_la-plugin-nvptx.lo -MD -MP -MF $(DEPDIR)/libgomp_plugin_nvptx_la-plugin-nvptx.Tpo -c -o libgomp_plugin_nvptx_la-plugin-nvptx.lo `test -f 'plugin/plugin-nvptx.c' || echo '$(srcdir)/'`plugin/plugin-nvptx.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgomp_plugin_nvptx_la-plugin-nvptx.Tpo $(DEPDIR)/libgomp_plugin_nvptx_la-plugin-nvptx.Plo
diff --git libgomp/configure libgomp/configure
index 867ce40..c93e877 100755
--- libgomp/configure
+++ libgomp/configure
@@ -15170,7 +15170,6 @@ if test x"$plugin_support" = xyes; then
 
 $as_echo "#define PLUGIN_SUPPORT 1" >>confdefs.h
 
-  offload_targets=host_nonshm
 elif test "x${enable_offload_targets-no}" != xno; then
   as_fn_error "Can't support offloading without support for plugins" "$LINENO" 5
 fi
diff --git libgomp/libgomp-plugin.h libgomp/libgomp-plugin.h
index 1072ae4..24fbb94 100644
--- libgomp/libgomp-plugin.h
+++ libgomp/libgomp-plugin.h
@@ -46,7 +46,7 @@ extern "C" {
 enum offload_target_type
 {
   OFFLOAD_TARGET_TYPE_HOST = 2,
-  OFFLOAD_TARGET_TYPE_HOST_NONSHM = 3,
+  /* OFFLOAD_TARGET_TYPE_HOST_NONSHM = 3 removed.  */
   OFFLOAD_TARGET_TYPE_NVIDIA_PTX = 5,
   OFFLOAD_TARGET_TYPE_INTEL_MIC = 6
 };
diff --git libgomp/oacc-host.c libgomp/oacc-host.c
index 6dcdbf3..17a5102 100644
--- libgomp/oacc-host.c
+++ libgomp/oacc-host.c
@@ -26,51 +26,215 @@
    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-/* This shares much of the implementation of the plugin-host.c "host_nonshm"
-   plugin.  */
-#include "plugin/plugin-host.c"
+#include "libgomp.h"
+#include "oacc-int.h"
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+static struct gomp_device_descr host_dispatch;
+
+static const char *
+host_get_name (void)
+{
+  return host_dispatch.name;
+}
+
+static unsigned int
+host_get_caps (void)
+{
+  return host_dispatch.capabilities;
+}
+
+static int
+host_get_type (void)
+{
+  return host_dispatch.type;
+}
+
+static int
+host_get_num_devices (void)
+{
+  return 1;
+}
+
+static void
+host_init_device (int n __attribute__ ((unused)))
+{
+}
+
+static void
+host_fini_device (int n __attribute__ ((unused)))
+{
+}
+
+static int
+host_load_image (int n __attribute__ ((unused)),
+		 const void *t __attribute__ ((unused)),
+		 struct addr_pair **r __attribute__ ((unused)))
+{
+  return 0;
+}
+
+static void
+host_unload_image (int n __attribute__ ((unused)),
+		   const void *t __attribute__ ((unused)))
+{
+}
+
+static void *
+host_alloc (int n __attribute__ ((unused)), size_t s)
+{
+  return gomp_malloc (s);
+}
+
+static void
+host_free (int n __attribute__ ((unused)), void *p)
+{
+  free (p);
+}
+
+static void *
+host_dev2host (int n __attribute__ ((unused)),
+	       void *h __attribute__ ((unused)),
+	       const void *d __attribute__ ((unused)),
+	       size_t s __attribute__ ((unused)))
+{
+  return NULL;
+}
+
+static void *
+host_host2dev (int n __attribute__ ((unused)),
+	       void *d __attribute__ ((unused)),
+	       const void *h __attribute__ ((unused)),
+	       size_t s __attribute__ ((unused)))
+{
+  return NULL;
+}
+
+static void
+host_run (int n __attribute__ ((unused)), void *fn_ptr, void *vars)
+{
+  void (*fn)(void *) = (void (*)(void *)) fn_ptr;
+
+  fn (vars);
+}
+
+static void
+host_openacc_exec (void (*fn) (void *),
+		   size_t mapnum __attribute__ ((unused)),
+		   void **hostaddrs,
+		   void **devaddrs __attribute__ ((unused)),
+		   size_t *sizes __attribute__ ((unused)),
+		   unsigned short *kinds __attribute__ ((unused)),
+		   int num_gangs __attribute__ ((unused)),
+		   int num_workers __attribute__ ((unused)),
+		   int vector_length __attribute__ ((unused)),
+		   int async __attribute__ ((unused)),
+		   void *targ_mem_desc __attribute__ ((unused)))
+{
+  fn (hostaddrs);
+}
+
+static void
+host_openacc_register_async_cleanup (void *targ_mem_desc __attribute__ ((unused)))
+{
+}
+
+static int
+host_openacc_async_test (int async __attribute__ ((unused)))
+{
+  return 1;
+}
+
+static int
+host_openacc_async_test_all (void)
+{
+  return 1;
+}
+
+static void
+host_openacc_async_wait (int async __attribute__ ((unused)))
+{
+}
+
+static void
+host_openacc_async_wait_async (int async1 __attribute__ ((unused)),
+			       int async2 __attribute__ ((unused)))
+{
+}
+
+static void
+host_openacc_async_wait_all (void)
+{
+}
+
+static void
+host_openacc_async_wait_all_async (int async __attribute__ ((unused)))
+{
+}
+
+static void
+host_openacc_async_set_async (int async __attribute__ ((unused)))
+{
+}
+
+static void *
+host_openacc_create_thread_data (int ord __attribute__ ((unused)))
+{
+  return NULL;
+}
+
+static void
+host_openacc_destroy_thread_data (void *tls_data __attribute__ ((unused)))
+{
+}
 
 static struct gomp_device_descr host_dispatch =
   {
     .name = "host",
-    .capabilities = (GOMP_OFFLOAD_CAP_OPENACC_200
+    .capabilities = (GOMP_OFFLOAD_CAP_SHARED_MEM
 		     | GOMP_OFFLOAD_CAP_NATIVE_EXEC
-		     | GOMP_OFFLOAD_CAP_SHARED_MEM),
+		     | GOMP_OFFLOAD_CAP_OPENACC_200),
     .target_id = 0,
     .type = OFFLOAD_TARGET_TYPE_HOST,
 
-    .get_name_func = GOMP_OFFLOAD_get_name,
-    .get_caps_func = GOMP_OFFLOAD_get_caps,
-    .get_type_func = GOMP_OFFLOAD_get_type,
-    .get_num_devices_func = GOMP_OFFLOAD_get_num_devices,
-    .init_device_func = GOMP_OFFLOAD_init_device,
-    .fini_device_func = GOMP_OFFLOAD_fini_device,
-    .load_image_func = GOMP_OFFLOAD_load_image,
-    .unload_image_func = GOMP_OFFLOAD_unload_image,
-    .alloc_func = GOMP_OFFLOAD_alloc,
-    .free_func = GOMP_OFFLOAD_free,
-    .dev2host_func = GOMP_OFFLOAD_dev2host,
-    .host2dev_func = GOMP_OFFLOAD_host2dev,
-    .run_func = GOMP_OFFLOAD_run,
+    .get_name_func = host_get_name,
+    .get_caps_func = host_get_caps,
+    .get_type_func = host_get_type,
+    .get_num_devices_func = host_get_num_devices,
+    .init_device_func = host_init_device,
+    .fini_device_func = host_fini_device,
+    .load_image_func = host_load_image,
+    .unload_image_func = host_unload_image,
+    .alloc_func = host_alloc,
+    .free_func = host_free,
+    .dev2host_func = host_dev2host,
+    .host2dev_func = host_host2dev,
+    .run_func = host_run,
 
+    .mem_map = { NULL },
+    /* .lock initilized in goacc_host_init.  */
     .is_initialized = false,
 
     .openacc = {
-      .exec_func = GOMP_OFFLOAD_openacc_parallel,
+      .data_environ = NULL,
 
-      .register_async_cleanup_func
-        = GOMP_OFFLOAD_openacc_register_async_cleanup,
+      .exec_func = host_openacc_exec,
 
-      .async_set_async_func = GOMP_OFFLOAD_openacc_async_set_async,
-      .async_test_func = GOMP_OFFLOAD_openacc_async_test,
-      .async_test_all_func = GOMP_OFFLOAD_openacc_async_test_all,
-      .async_wait_func = GOMP_OFFLOAD_openacc_async_wait,
-      .async_wait_async_func = GOMP_OFFLOAD_openacc_async_wait_async,
-      .async_wait_all_func = GOMP_OFFLOAD_openacc_async_wait_all,
-      .async_wait_all_async_func = GOMP_OFFLOAD_openacc_async_wait_all_async,
+      .register_async_cleanup_func = host_openacc_register_async_cleanup,
 
-      .create_thread_data_func = GOMP_OFFLOAD_openacc_create_thread_data,
-      .destroy_thread_data_func = GOMP_OFFLOAD_openacc_destroy_thread_data,
+      .async_test_func = host_openacc_async_test,
+      .async_test_all_func = host_openacc_async_test_all,
+      .async_wait_func = host_openacc_async_wait,
+      .async_wait_async_func = host_openacc_async_wait_async,
+      .async_wait_all_func = host_openacc_async_wait_all,
+      .async_wait_all_async_func = host_openacc_async_wait_all_async,
+      .async_set_async_func = host_openacc_async_set_async,
+
+      .create_thread_data_func = host_openacc_create_thread_data,
+      .destroy_thread_data_func = host_openacc_destroy_thread_data,
 
       .cuda = {
 	.get_current_device_func = NULL,
@@ -81,9 +245,9 @@ static struct gomp_device_descr host_dispatch =
     }
   };
 
-/* Register this device type.  */
-static __attribute__ ((constructor))
-void goacc_host_init (void)
+/* Initialize and register this device type.  */
+static __attribute__ ((constructor)) void
+goacc_host_init (void)
 {
   gomp_mutex_init (&host_dispatch.lock);
   goacc_register (&host_dispatch);
diff --git libgomp/oacc-init.c libgomp/oacc-init.c
index 105d9dc..c12f8ad 100644
--- libgomp/oacc-init.c
+++ libgomp/oacc-init.c
@@ -29,7 +29,6 @@
 #include "libgomp.h"
 #include "oacc-int.h"
 #include "openacc.h"
-#include "plugin/plugin-host.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <strings.h>
@@ -102,7 +101,6 @@ name_of_acc_device_t (enum acc_device_t type)
     case acc_device_none: return "none";
     case acc_device_default: return "default";
     case acc_device_host: return "host";
-    case acc_device_host_nonshm: return "host_nonshm";
     case acc_device_not_host: return "not_host";
     case acc_device_nvidia: return "nvidia";
     default: gomp_fatal ("unknown device type %u", (unsigned) type);
@@ -625,18 +623,8 @@ ialias (acc_set_device_num)
 int
 acc_on_device (acc_device_t dev)
 {
-  struct goacc_thread *thr = goacc_thread ();
-
-  /* We only want to appear to be the "host_nonshm" plugin from "offloaded"
-     code -- i.e. within a parallel region.  Test a flag set by the
-     openacc_parallel hook of the host_nonshm plugin to determine that.  */
-  if (acc_get_device_type () == acc_device_host_nonshm
-      && thr && thr->target_tls
-      && ((struct nonshm_thread *)thr->target_tls)->nonshm_exec)
-    return dev == acc_device_host_nonshm || dev == acc_device_not_host;
-
-  /* For OpenACC, libgomp is only built for the host, so this is sufficient.  */
-  return dev == acc_device_host || dev == acc_device_none;
+  /* Just rely on the compiler builtin.  */
+  return __builtin_acc_on_device (dev);
 }
 
 ialias (acc_on_device)
diff --git libgomp/openacc.f90 libgomp/openacc.f90
index 04d8088..fbd63c6 100644
--- libgomp/openacc.f90
+++ libgomp/openacc.f90
@@ -43,7 +43,7 @@ module openacc_kinds
   integer (acc_device_kind), parameter :: acc_device_none = 0
   integer (acc_device_kind), parameter :: acc_device_default = 1
   integer (acc_device_kind), parameter :: acc_device_host = 2
-  integer (acc_device_kind), parameter :: acc_device_host_nonshm = 3
+  ! integer (acc_device_kind), parameter :: acc_device_host_nonshm = 3 removed.
   integer (acc_device_kind), parameter :: acc_device_not_host = 4
   integer (acc_device_kind), parameter :: acc_device_nvidia = 5
 
diff --git libgomp/openacc.h libgomp/openacc.h
index 44a1526..fc353e1 100644
--- libgomp/openacc.h
+++ libgomp/openacc.h
@@ -53,7 +53,7 @@ typedef enum acc_device_t
     acc_device_none = 0,
     acc_device_default = 1,
     acc_device_host = 2,
-    acc_device_host_nonshm = 3,
+    /* acc_device_host_nonshm = 3 removed.  */
     acc_device_not_host = 4,
     acc_device_nvidia = 5,
     _ACC_device_hwm
diff --git libgomp/openacc_lib.h libgomp/openacc_lib.h
index 28659a1..e9c503e 100644
--- libgomp/openacc_lib.h
+++ libgomp/openacc_lib.h
@@ -38,7 +38,8 @@
       integer (acc_device_kind), parameter :: acc_device_none = 0
       integer (acc_device_kind), parameter :: acc_device_default = 1
       integer (acc_device_kind), parameter :: acc_device_host = 2
-      integer (acc_device_kind), parameter :: acc_device_host_nonshm = 3
+!     integer (acc_device_kind), parameter :: acc_device_host_nonshm = 3
+!     removed.
       integer (acc_device_kind), parameter :: acc_device_not_host = 4
       integer (acc_device_kind), parameter :: acc_device_nvidia = 5
 
diff --git libgomp/plugin/Makefrag.am libgomp/plugin/Makefrag.am
index 167485f..745becd 100644
--- libgomp/plugin/Makefrag.am
+++ libgomp/plugin/Makefrag.am
@@ -38,12 +38,3 @@ libgomp_plugin_nvptx_la_LDFLAGS += $(PLUGIN_NVPTX_LDFLAGS)
 libgomp_plugin_nvptx_la_LIBADD = libgomp.la $(PLUGIN_NVPTX_LIBS)
 libgomp_plugin_nvptx_la_LIBTOOLFLAGS = --tag=disable-static
 endif
-
-libgomp_plugin_host_nonshm_version_info = -version-info $(libtool_VERSION)
-toolexeclib_LTLIBRARIES += libgomp-plugin-host_nonshm.la
-libgomp_plugin_host_nonshm_la_SOURCES = plugin/plugin-host.c
-libgomp_plugin_host_nonshm_la_CPPFLAGS = $(AM_CPPFLAGS) -DHOST_NONSHM_PLUGIN
-libgomp_plugin_host_nonshm_la_LDFLAGS = \
-	$(libgomp_plugin_host_nonshm_version_info) $(lt_host_flags)
-libgomp_plugin_host_nonshm_la_LIBADD = libgomp.la
-libgomp_plugin_host_nonshm_la_LIBTOOLFLAGS = --tag=disable-static
diff --git libgomp/plugin/configfrag.ac libgomp/plugin/configfrag.ac
index 254c688..8c2a420 100644
--- libgomp/plugin/configfrag.ac
+++ libgomp/plugin/configfrag.ac
@@ -33,7 +33,6 @@ AC_CHECK_LIB(dl, dlsym, , [plugin_support=no])
 if test x"$plugin_support" = xyes; then
   AC_DEFINE(PLUGIN_SUPPORT, 1,
     [Define if all infrastructure, needed for plugins, is supported.])
-  offload_targets=host_nonshm
 elif test "x${enable_offload_targets-no}" != xno; then
   AC_MSG_ERROR([Can't support offloading without support for plugins])
 fi
diff --git libgomp/plugin/plugin-host.c libgomp/plugin/plugin-host.c
deleted file mode 100644
index da3c5f4..0000000
--- libgomp/plugin/plugin-host.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/* OpenACC Runtime Library: acc_device_host, acc_device_host_nonshm.
-
-   Copyright (C) 2013-2015 Free Software Foundation, Inc.
-
-   Contributed by Mentor Embedded.
-
-   This file is part of the GNU Offloading and Multi Processing Library
-   (libgomp).
-
-   Libgomp is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
-   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-   more details.
-
-   Under Section 7 of GPL version 3, you are granted additional
-   permissions described in the GCC Runtime Library Exception, version
-   3.1, as published by the Free Software Foundation.
-
-   You should have received a copy of the GNU General Public License and
-   a copy of the GCC Runtime Library Exception along with this program;
-   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* Simple implementation of support routines for a shared-memory
-   acc_device_host, and a non-shared memory acc_device_host_nonshm, with the
-   latter built as a plugin.  */
-
-#include "openacc.h"
-#include "config.h"
-#ifdef HOST_NONSHM_PLUGIN
-#include "libgomp-plugin.h"
-#include "oacc-plugin.h"
-#else
-#include "libgomp.h"
-#include "oacc-int.h"
-#endif
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdbool.h>
-
-#ifdef HOST_NONSHM_PLUGIN
-#define STATIC
-#define GOMP(X) GOMP_PLUGIN_##X
-#define SELF "host_nonshm plugin: "
-#else
-#define STATIC static
-#define GOMP(X) gomp_##X
-#define SELF "host: "
-#endif
-
-#ifdef HOST_NONSHM_PLUGIN
-#include "plugin-host.h"
-#endif
-
-STATIC const char *
-GOMP_OFFLOAD_get_name (void)
-{
-#ifdef HOST_NONSHM_PLUGIN
-  return "host_nonshm";
-#else
-  return "host";
-#endif
-}
-
-STATIC unsigned int
-GOMP_OFFLOAD_get_caps (void)
-{
-  unsigned int caps = (GOMP_OFFLOAD_CAP_OPENACC_200
-		       | GOMP_OFFLOAD_CAP_NATIVE_EXEC);
-
-#ifndef HOST_NONSHM_PLUGIN
-  caps |= GOMP_OFFLOAD_CAP_SHARED_MEM;
-#endif
-
-  return caps;
-}
-
-STATIC int
-GOMP_OFFLOAD_get_type (void)
-{
-#ifdef HOST_NONSHM_PLUGIN
-  return OFFLOAD_TARGET_TYPE_HOST_NONSHM;
-#else
-  return OFFLOAD_TARGET_TYPE_HOST;
-#endif
-}
-
-STATIC int
-GOMP_OFFLOAD_get_num_devices (void)
-{
-  return 1;
-}
-
-STATIC void
-GOMP_OFFLOAD_init_device (int n __attribute__ ((unused)))
-{
-}
-
-STATIC void
-GOMP_OFFLOAD_fini_device (int n __attribute__ ((unused)))
-{
-}
-
-STATIC int
-GOMP_OFFLOAD_load_image (int n __attribute__ ((unused)),
-			 const void *t __attribute__ ((unused)),
-			 struct addr_pair **r __attribute__ ((unused)))
-{
-  return 0;
-}
-
-STATIC void
-GOMP_OFFLOAD_unload_image (int n __attribute__ ((unused)),
-			   const void *t __attribute__ ((unused)))
-{
-}
-
-STATIC void *
-GOMP_OFFLOAD_alloc (int n __attribute__ ((unused)), size_t s)
-{
-  return GOMP (malloc) (s);
-}
-
-STATIC void
-GOMP_OFFLOAD_free (int n __attribute__ ((unused)), void *p)
-{
-  free (p);
-}
-
-STATIC void *
-GOMP_OFFLOAD_host2dev (int n __attribute__ ((unused)), void *d, const void *h,
-		       size_t s)
-{
-#ifdef HOST_NONSHM_PLUGIN
-  memcpy (d, h, s);
-#endif
-
-  return 0;
-}
-
-STATIC void *
-GOMP_OFFLOAD_dev2host (int n __attribute__ ((unused)), void *h, const void *d,
-		       size_t s)
-{
-#ifdef HOST_NONSHM_PLUGIN
-  memcpy (h, d, s);
-#endif
-
-  return 0;
-}
-
-STATIC void
-GOMP_OFFLOAD_run (int n __attribute__ ((unused)), void *fn_ptr, void *vars)
-{
-  void (*fn)(void *) = (void (*)(void *)) fn_ptr;
-
-  fn (vars);
-}
-
-STATIC void
-GOMP_OFFLOAD_openacc_parallel (void (*fn) (void *),
-			       size_t mapnum __attribute__ ((unused)),
-			       void **hostaddrs __attribute__ ((unused)),
-			       void **devaddrs __attribute__ ((unused)),
-			       size_t *sizes __attribute__ ((unused)),
-			       unsigned short *kinds __attribute__ ((unused)),
-			       int num_gangs __attribute__ ((unused)),
-			       int num_workers __attribute__ ((unused)),
-			       int vector_length __attribute__ ((unused)),
-			       int async __attribute__ ((unused)),
-			       void *targ_mem_desc __attribute__ ((unused)))
-{
-#ifdef HOST_NONSHM_PLUGIN
-  struct nonshm_thread *thd = GOMP_PLUGIN_acc_thread ();
-  thd->nonshm_exec = true;
-  fn (devaddrs);
-  thd->nonshm_exec = false;
-#else
-  fn (hostaddrs);
-#endif
-}
-
-STATIC void
-GOMP_OFFLOAD_openacc_register_async_cleanup (void *targ_mem_desc)
-{
-#ifdef HOST_NONSHM_PLUGIN
-  /* "Asynchronous" launches are executed synchronously on the (non-SHM) host,
-     so there's no point in delaying host-side cleanup -- just do it now.  */
-  GOMP_PLUGIN_async_unmap_vars (targ_mem_desc);
-#endif
-}
-
-STATIC void
-GOMP_OFFLOAD_openacc_async_set_async (int async __attribute__ ((unused)))
-{
-}
-
-STATIC int
-GOMP_OFFLOAD_openacc_async_test (int async __attribute__ ((unused)))
-{
-  return 1;
-}
-
-STATIC int
-GOMP_OFFLOAD_openacc_async_test_all (void)
-{
-  return 1;
-}
-
-STATIC void
-GOMP_OFFLOAD_openacc_async_wait (int async __attribute__ ((unused)))
-{
-}
-
-STATIC void
-GOMP_OFFLOAD_openacc_async_wait_all (void)
-{
-}
-
-STATIC void
-GOMP_OFFLOAD_openacc_async_wait_async (int async1 __attribute__ ((unused)),
-				       int async2 __attribute__ ((unused)))
-{
-}
-
-STATIC void
-GOMP_OFFLOAD_openacc_async_wait_all_async (int async __attribute__ ((unused)))
-{
-}
-
-STATIC void *
-GOMP_OFFLOAD_openacc_create_thread_data (int ord
-					 __attribute__ ((unused)))
-{
-#ifdef HOST_NONSHM_PLUGIN
-  struct nonshm_thread *thd
-    = GOMP_PLUGIN_malloc (sizeof (struct nonshm_thread));
-  thd->nonshm_exec = false;
-  return thd;
-#else
-  return NULL;
-#endif
-}
-
-STATIC void
-GOMP_OFFLOAD_openacc_destroy_thread_data (void *tls_data)
-{
-#ifdef HOST_NONSHM_PLUGIN
-  free (tls_data);
-#endif
-}
diff --git libgomp/plugin/plugin-host.h libgomp/plugin/plugin-host.h
deleted file mode 100644
index 96955d1..0000000
--- libgomp/plugin/plugin-host.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* OpenACC Runtime Library: acc_device_host, acc_device_host_nonshm.
-
-   Copyright (C) 2015 Free Software Foundation, Inc.
-
-   Contributed by Mentor Embedded.
-
-   This file is part of the GNU Offloading and Multi Processing Library
-   (libgomp).
-
-   Libgomp is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
-   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-   more details.
-
-   Under Section 7 of GPL version 3, you are granted additional
-   permissions described in the GCC Runtime Library Exception, version
-   3.1, as published by the Free Software Foundation.
-
-   You should have received a copy of the GNU General Public License and
-   a copy of the GCC Runtime Library Exception along with this program;
-   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef PLUGIN_HOST_H
-#define PLUGIN_HOST_H
-
-struct nonshm_thread
-{
-  bool nonshm_exec;
-};
-
-#endif
diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp
index 438777f..f04b163 100644
--- libgomp/testsuite/lib/libgomp.exp
+++ libgomp/testsuite/lib/libgomp.exp
@@ -355,13 +355,3 @@ proc check_effective_target_openacc_host_selected { } {
     }
     return 0;
 }
-
-# Return 1 if the host_nonshm target is selected for offloaded
-
-proc check_effective_target_openacc_host_nonshm_selected { } {
-    global offload_target_openacc
-    if { $offload_target_openacc == "host_nonshm" } {
-        return 1;
-    }
-    return 0;
-}
diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
index 3b97024..88b0269 100644
--- libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -81,9 +81,6 @@ if { $lang_test_file_found } {
 	    host {
 		set acc_mem_shared 1
 	    }
-	    host_nonshm {
-		set acc_mem_shared 0
-	    }
 	    nvidia {
 		if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		    # Don't bother; execution testing is going to FAIL.
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c
index 81ea476..8112745 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c
@@ -15,8 +15,6 @@ main (int argc, char *argv[])
       abort ();
     if (!acc_on_device (acc_device_host))
       abort ();
-    if (acc_on_device (acc_device_host_nonshm))
-      abort ();
     if (acc_on_device (acc_device_not_host))
       abort ();
     if (acc_on_device (acc_device_nvidia))
@@ -32,8 +30,6 @@ main (int argc, char *argv[])
       abort ();
     if (!acc_on_device (acc_device_host))
       abort ();
-    if (acc_on_device (acc_device_host_nonshm))
-      abort ();
     if (acc_on_device (acc_device_not_host))
       abort ();
     if (acc_on_device (acc_device_nvidia))
@@ -51,13 +47,6 @@ main (int argc, char *argv[])
       abort ();
     if (acc_on_device (acc_device_host))
       abort ();
-#if ACC_DEVICE_TYPE_host_nonshm
-    if (!acc_on_device (acc_device_host_nonshm))
-      abort ();
-#else
-    if (acc_on_device (acc_device_host_nonshm))
-      abort ();
-#endif
     if (!acc_on_device (acc_device_not_host))
       abort ();
 #if ACC_DEVICE_TYPE_nvidia
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
index 184b355..6aa3bb7 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
@@ -1,5 +1,4 @@
 /* { dg-do run } */
-/* { dg-additional-options "-fno-builtin-acc_on_device" } */
 
 #include <openacc.h>
 #include <stdlib.h>
diff --git libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
index 326b988..5020e6a 100644
--- libgomp/testsuite/libgomp.oacc-c/c.exp
+++ libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -44,9 +44,6 @@ foreach offload_target_openacc $offload_targets_s_openacc {
 	host {
 	    set acc_mem_shared 1
 	}
-	host_nonshm {
-	    set acc_mem_shared 0
-	}
 	nvidia {
 	    if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		# Don't bother; execution testing is going to FAIL.
diff --git libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90 libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90
index 4488818..1a10f32 100644
--- libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90
+++ libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90
@@ -11,7 +11,6 @@ implicit none
 
 if (.not. acc_on_device (acc_device_none)) call abort
 if (.not. acc_on_device (acc_device_host)) call abort
-if (acc_on_device (acc_device_host_nonshm)) call abort
 if (acc_on_device (acc_device_not_host)) call abort
 if (acc_on_device (acc_device_nvidia)) call abort
 
@@ -21,7 +20,6 @@ if (acc_on_device (acc_device_nvidia)) call abort
 !$acc parallel if(.false.)
 if (.not. acc_on_device (acc_device_none)) call abort
 if (.not. acc_on_device (acc_device_host)) call abort
-if (acc_on_device (acc_device_host_nonshm)) call abort
 if (acc_on_device (acc_device_not_host)) call abort
 if (acc_on_device (acc_device_nvidia)) call abort
 !$acc end parallel
@@ -34,11 +32,6 @@ if (acc_on_device (acc_device_nvidia)) call abort
 !$acc parallel
 if (acc_on_device (acc_device_none)) call abort
 if (acc_on_device (acc_device_host)) call abort
-#if ACC_DEVICE_TYPE_host_nonshm
-if (.not. acc_on_device (acc_device_host_nonshm)) call abort
-#else
-if (acc_on_device (acc_device_host_nonshm)) call abort
-#endif
 if (.not. acc_on_device (acc_device_not_host)) call abort
 #if ACC_DEVICE_TYPE_nvidia
 if (.not. acc_on_device (acc_device_nvidia)) call abort
diff --git libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f
index 0047a19..a19045b 100644
--- libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f
+++ libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f
@@ -11,7 +11,6 @@
 
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
-      IF (ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
 
@@ -21,7 +20,6 @@
 !$ACC PARALLEL IF(.FALSE.)
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
-      IF (ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
 !$ACC END PARALLEL
@@ -34,11 +32,6 @@
 !$ACC PARALLEL
       IF (ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
-#if ACC_DEVICE_TYPE_host_nonshm
-      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
-#else
-      IF (ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
-#endif
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
 #if ACC_DEVICE_TYPE_nvidia
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
diff --git libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f
index 49d7a72..c391776 100644
--- libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f
+++ libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f
@@ -11,7 +11,6 @@
 
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
-      IF (ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
 
@@ -21,7 +20,6 @@
 !$ACC PARALLEL IF(.FALSE.)
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
-      IF (ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
 !$ACC END PARALLEL
@@ -34,11 +32,6 @@
 !$ACC PARALLEL
       IF (ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
       IF (ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
-#if ACC_DEVICE_TYPE_host_nonshm
-      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
-#else
-      IF (ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
-#endif
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
 #if ACC_DEVICE_TYPE_nvidia
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
diff --git libgomp/testsuite/libgomp.oacc-fortran/fortran.exp libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
index a8aaff0..2d6b647 100644
--- libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
+++ libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
@@ -73,9 +73,6 @@ if { $lang_test_file_found } {
 	    host {
 		set acc_mem_shared 1
 	    }
-	    host_nonshm {
-		set acc_mem_shared 0
-	    }
 	    nvidia {
 		if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		    # Don't bother; execution testing is going to FAIL.


Grüße,
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-08-10 16:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87zjpehpz4.fsf@schwinge.name>
     [not found] ` <20131108154000.GP27813@tucnak.zalov.cz>
     [not found]   ` <87lhzqs3tv.fsf@kepler.schwinge.homeip.net>
2014-02-19 16:10     ` [gomp4] libgomp: plugin for non-shared memory host execution (was: libgomp.c/target-1.c failing in fn2's GOMP_target_update) Thomas Schwinge
2014-02-19 17:49       ` Ilya Verbin
2014-02-19 18:07         ` Jakub Jelinek
2014-02-20  9:59           ` [gomp4] libgomp: plugin for non-shared memory host execution Thomas Schwinge
2014-02-20 11:09       ` Thomas Schwinge
2015-07-30 12:26       ` Thomas Schwinge
2015-07-30 12:31         ` Jakub Jelinek
2015-07-31 15:40           ` Thomas Schwinge
2015-08-10 16:51             ` Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).