public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [gomp4] Remove more gang local bits
@ 2015-09-10 17:54 Nathan Sidwell
  2015-09-18  9:13 ` Thomas Schwinge
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Sidwell @ 2015-09-10 17:54 UTC (permalink / raw)
  To: GCC Patches

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

I've committed this to gomp4 branch.  It removes more now-obsolete bits of gang 
local handling.

nathan

[-- Attachment #2: gomp4-ganglocal.patch --]
[-- Type: text/x-patch, Size: 4366 bytes --]

2015-09-10  Nathan Sidwell  <nathan@codesourcery.com>

	include/
	* gomp-constants.h (GOMP_MAP_FLAG_GANGLOCAL): Delete.
	(enum gomp_map_kind): Remove GOMP_MAP_GANGLOCAL,
	GOMP_MAP_FORCE_TO_GANGLOCAL).

	libgomp/
	* oacc-parallel.c (alloc_ganglocal_addrs): Delete.
	(GOACC_parallel_keyed): Do not call it.
	(GOACC_update): Remove GOMP_MAP_FORCE_TO_GANGLOCAL case.
	* target.c (gomp_map_vars): Remove GOMP_MAP_FORCE_TO_GANGLOCAL
	handling.

Index: libgomp/oacc-parallel.c
===================================================================
--- libgomp/oacc-parallel.c	(revision 227633)
+++ libgomp/oacc-parallel.c	(working copy)
@@ -57,33 +57,6 @@ find_pointer (int pos, size_t mapnum, un
   return 0;
 }
 
-static void
-alloc_ganglocal_addrs (size_t mapnum, void **hostaddrs, size_t *sizes,
-		       unsigned short *kinds)
-{
-  int i;
-  const int typemask = 0xff;
-  void *t;
-
-  for (i = 0; i < mapnum; i++)
-    {
-      if ((kinds[i] & typemask) == GOMP_MAP_FORCE_TO_GANGLOCAL)
-	{
-	  t = malloc (sizes[i]);
-	  memcpy (t, hostaddrs[i], sizes[i]);
-	  hostaddrs[i] = t;
-
-	  if (i + 1 < mapnum && GOMP_MAP_POINTER_P (kinds[i+1] & typemask))
-	    {
-	      size_t *ptr = (size_t *) malloc (sizeof (size_t *));
-	      *ptr = (size_t)t;
-	      hostaddrs[i+1] = ptr;
-	      i++;
-	    }
-	}
-    }
-}
-
 static struct oacc_static
 {
   void *addr;
@@ -176,8 +149,6 @@ GOACC_parallel_keyed (int device, void (
 	      __FUNCTION__, (unsigned long) mapnum, hostaddrs, sizes, kinds);
 #endif
 
-  alloc_ganglocal_addrs (mapnum, hostaddrs, sizes, kinds);
-
   goacc_lazy_initialize ();
 
   thr = goacc_thread ();
@@ -617,7 +588,6 @@ GOACC_update (int device, size_t mapnum,
 	  break;
 
 	case GOMP_MAP_FORCE_TO:
-	case GOMP_MAP_FORCE_TO_GANGLOCAL:
 	  acc_update_device (hostaddrs[i], sizes[i]);
 	  break;
 
Index: libgomp/target.c
===================================================================
--- libgomp/target.c	(revision 227633)
+++ libgomp/target.c	(working copy)
@@ -373,12 +373,7 @@ gomp_map_vars (struct gomp_device_descr
 		k->tgt_offset = tgt_size;
 		tgt_size += k->host_end - k->host_start;
 		k->copy_from = GOMP_MAP_COPY_FROM_P (kind & typemask);
-		k->dealloc_host = (kind & typemask)
-		  == GOMP_MAP_FORCE_TO_GANGLOCAL;
-		if (GOMP_MAP_POINTER_P (kind & typemask) && i < 0 &&
-		    (get_kind (is_openacc, kinds, i-1) & typemask)
-		    == GOMP_MAP_FORCE_TO_GANGLOCAL)
-		  k->dealloc_host = true;
+		k->dealloc_host = false;
 		k->refcount = 1;
 		k->async_refcount = 0;
 		tgt->refcount++;
@@ -395,7 +390,6 @@ gomp_map_vars (struct gomp_device_descr
 		  case GOMP_MAP_TO:
 		  case GOMP_MAP_TOFROM:
 		  case GOMP_MAP_FORCE_TO:
-		  case GOMP_MAP_FORCE_TO_GANGLOCAL:
 		  case GOMP_MAP_FORCE_TOFROM:
 		    /* FIXME: Perhaps add some smarts, like if copying
 		       several adjacent fields from host to target, use some
Index: include/gomp-constants.h
===================================================================
--- include/gomp-constants.h	(revision 227633)
+++ include/gomp-constants.h	(working copy)
@@ -36,7 +36,6 @@
 
 #define GOMP_MAP_FLAG_TO		(1 << 0)
 #define GOMP_MAP_FLAG_FROM		(1 << 1)
-#define GOMP_MAP_FLAG_GANGLOCAL		(1 << 4)
 /* Special map kinds, enumerated starting here.  */
 #define GOMP_MAP_FLAG_SPECIAL_0		(1 << 2)
 #define GOMP_MAP_FLAG_SPECIAL_1		(1 << 3)
@@ -55,8 +54,6 @@ enum gomp_map_kind
     GOMP_MAP_FROM =			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM),
     /* ..., and copy to and from device.  */
     GOMP_MAP_TOFROM =			(GOMP_MAP_TO | GOMP_MAP_FROM),
-    /* OpenACC Gang-local.  */
-    GOMP_MAP_GANGLOCAL =		(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_GANGLOCAL),
     /* The following kind is an internal only map kind, used for pointer based
        array sections.  OMP_CLAUSE_SIZE for these is not the pointer size,
        which is implicitly POINTER_SIZE_UNITS, but the bias.  */
@@ -84,9 +81,7 @@ enum gomp_map_kind
     /* ..., and copy from device.  */
     GOMP_MAP_FORCE_FROM =		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM),
     /* ..., and copy to and from device.  */
-    GOMP_MAP_FORCE_TOFROM =		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM),
-    /* Flag to allocate, copy to device and also make gang-local.  */
-    GOMP_MAP_FORCE_TO_GANGLOCAL =	(GOMP_MAP_FORCE_TO | GOMP_MAP_GANGLOCAL)
+    GOMP_MAP_FORCE_TOFROM =		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM)
   };
 
 #define GOMP_MAP_COPY_TO_P(X) \

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

* Re: [gomp4] Remove more gang local bits
  2015-09-10 17:54 [gomp4] Remove more gang local bits Nathan Sidwell
@ 2015-09-18  9:13 ` Thomas Schwinge
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Schwinge @ 2015-09-18  9:13 UTC (permalink / raw)
  To: GCC Patches; +Cc: Nathan Sidwell

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

Hi!

On Thu, 10 Sep 2015 13:48:56 -0400, Nathan Sidwell <nathan@acm.org> wrote:
> I've committed this to gomp4 branch.  It removes more now-obsolete bits of gang 
> local handling.

> --- libgomp/target.c	(revision 227633)
> +++ libgomp/target.c	(working copy)
> @@ -373,12 +373,7 @@ gomp_map_vars (struct gomp_device_descr
>  		k->tgt_offset = tgt_size;
>  		tgt_size += k->host_end - k->host_start;
>  		k->copy_from = GOMP_MAP_COPY_FROM_P (kind & typemask);
> -		k->dealloc_host = (kind & typemask)
> -		  == GOMP_MAP_FORCE_TO_GANGLOCAL;
> -		if (GOMP_MAP_POINTER_P (kind & typemask) && i < 0 &&
> -		    (get_kind (is_openacc, kinds, i-1) & typemask)
> -		    == GOMP_MAP_FORCE_TO_GANGLOCAL)
> -		  k->dealloc_host = true;
> +		k->dealloc_host = false;
>  		k->refcount = 1;
>  		k->async_refcount = 0;
>  		tgt->refcount++;

The dealloc_host flag had only been used in the "ganglocal"
implementation, which is now gone, so this can now also go; committed to
gomp-4_0-branch in r227900:

commit 108d67ade49b25931ba14788e39d6fd91259c37d
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Sep 18 09:11:54 2015 +0000

    libgomp: Remove dealloc_host member of struct splay_tree_key_s
    
    	libgomp/
    	* libgomp.h (struct splay_tree_key_s): Remove dealloc_host member.
    	Adjust all users.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@227900 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp |    3 +++
 libgomp/libgomp.h      |    2 --
 libgomp/target.c       |    5 -----
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 0c0e697..12cf8aa 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,8 @@
 2015-09-18  Thomas Schwinge  <thomas@codesourcery.com>
 
+	* libgomp.h (struct splay_tree_key_s): Remove dealloc_host member.
+	Adjust all users.
+
 	* testsuite/libgomp.oacc-fortran/reduction-5.f90: Extend.  XFAIL
 	execution test for -O0.
 
diff --git libgomp/libgomp.h libgomp/libgomp.h
index e976850..d51b08b 100644
--- libgomp/libgomp.h
+++ libgomp/libgomp.h
@@ -678,8 +678,6 @@ struct splay_tree_key_s {
   uintptr_t async_refcount;
   /* True if data should be copied from device to host at the end.  */
   bool copy_from;
-  /* True if data should be freed on the host, e.g. for ganglocal vars.  */
-  bool dealloc_host;
 };
 
 #include "splay-tree.h"
diff --git libgomp/target.c libgomp/target.c
index 5b77f3c..6ca80ad 100644
--- libgomp/target.c
+++ libgomp/target.c
@@ -373,7 +373,6 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
 		k->tgt_offset = tgt_size;
 		tgt_size += k->host_end - k->host_start;
 		k->copy_from = GOMP_MAP_COPY_FROM_P (kind & typemask);
-		k->dealloc_host = false;
 		k->refcount = 1;
 		k->async_refcount = 0;
 		tgt->refcount++;
@@ -569,8 +568,6 @@ gomp_unmap_vars (struct target_mem_desc *tgt, bool do_copyfrom)
 	  devicep->dev2host_func (devicep->target_id, (void *) k->host_start,
 				  (void *) (k->tgt->tgt_start + k->tgt_offset),
 				  k->host_end - k->host_start);
-	if (k->dealloc_host)
-	  free ((void *)k->host_start);
 	splay_tree_remove (&devicep->mem_map, k);
 	if (k->tgt->refcount > 1)
 	  k->tgt->refcount--;
@@ -712,7 +709,6 @@ gomp_load_image_to_device (struct gomp_device_descr *devicep, unsigned version,
       k->refcount = 1;
       k->async_refcount = 0;
       k->copy_from = false;
-      k->dealloc_host = false;
       tgt->list[i] = k;
       tgt->refcount++;
       array->left = NULL;
@@ -741,7 +737,6 @@ gomp_load_image_to_device (struct gomp_device_descr *devicep, unsigned version,
       k->refcount = 1;
       k->async_refcount = 0;
       k->copy_from = false;
-      k->dealloc_host = false;
       tgt->list[i] = k;
       tgt->refcount++;
       array->left = NULL;


Grüße,
 Thomas

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

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

end of thread, other threads:[~2015-09-18  9:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-10 17:54 [gomp4] Remove more gang local bits Nathan Sidwell
2015-09-18  9:13 ` 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).