This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/5] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin (repost)


Hi!

On Tue, 11 Nov 2014 13:53:23 +0000, Julian Brown <julian@codesourcery.com> wrote:
> On Tue, 23 Sep 2014 19:19:31 +0100
> Julian Brown <julian@codesourcery.com> wrote:
> 
> > This patch contains the bulk of the OpenACC 2.0 runtime support,
> > building around, or on top of, the OpenMP 4.0 support (as previously
> > posted or already extant upstream) where we could. [...]
> 
> Here is a new version of the OpenACC support patch for libgomp, [...]

Committed to gomp-4_0-branch in r219026:

commit 9a4509c31bcb89a4eb78d70dba4eb3d1b4709c8b
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Dec 22 18:14:16 2014 +0000

    libgomp: Remove dubious "const casting".
    
    This may be re-instantiated later on, but then "more completely".
    
    	libgomp/
    	* libgomp.h (gomp_init_tables): Remove const qualifier from struct
    	gomp_device_descr.  Change all users.
    	* oacc-int.h (base_dev, goacc_register): Likewise.
    	* oacc-init.c (dispatchers, resolve_device, acc_init_1)
    	(lazy_init): Likewise.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219026 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp |  6 ++++++
 libgomp/libgomp.h      |  2 +-
 libgomp/oacc-init.c    | 24 ++++++++++++------------
 libgomp/oacc-int.h     |  4 ++--
 libgomp/oacc-mem.c     |  2 +-
 libgomp/target.c       |  4 ++--
 6 files changed, 24 insertions(+), 18 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 383993d..3439797 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,11 @@
 2014-12-22  Thomas Schwinge  <thomas@codesourcery.com>
 
+	* libgomp.h (gomp_init_tables): Remove const qualifier from struct
+	gomp_device_descr.  Change all users.
+	* oacc-int.h (base_dev, goacc_register): Likewise.
+	* oacc-init.c (dispatchers, resolve_device, acc_init_1)
+	(lazy_init): Likewise.
+
 	* libgomp.h (gomp_free_memmap): Take a pointer to a struct
 	gomp_memory_mapping instead of a pointer to a struct
 	gomp_device_descr.  Change all users.
diff --git libgomp/libgomp.h libgomp/libgomp.h
index 5897d8f..440bfce 100644
--- libgomp/libgomp.h
+++ libgomp/libgomp.h
@@ -787,7 +787,7 @@ extern void gomp_unmap_vars (struct target_mem_desc *, bool);
 
 extern void gomp_init_device (struct gomp_device_descr *);
 
-extern void gomp_init_tables (const struct gomp_device_descr *,
+extern void gomp_init_tables (struct gomp_device_descr *,
 			      struct gomp_memory_mapping *);
 
 extern void gomp_free_memmap (struct gomp_memory_mapping *);
diff --git libgomp/oacc-init.c libgomp/oacc-init.c
index 3867ca7..d10b974 100644
--- libgomp/oacc-init.c
+++ libgomp/oacc-init.c
@@ -46,7 +46,7 @@ static gomp_mutex_t acc_device_lock;
    for overall initialisation/shutdown, and other instances -- not necessarily
    including this one -- may be opened and closed once the base device has
    been initialized.  */
-struct gomp_device_descr const *base_dev;
+struct gomp_device_descr *base_dev;
 
 #if defined HAVE_TLS || defined USE_EMUTLS
 __thread struct goacc_thread *goacc_tls_data;
@@ -65,10 +65,10 @@ static gomp_mutex_t goacc_thread_lock;
    only references "base" devices, and other instances of the same type are
    found by simply indexing from each such device (which are stored linearly,
    grouped by device in target.c:devices).  */
-static struct gomp_device_descr const *dispatchers[_ACC_device_hwm] = { 0 };
+static struct gomp_device_descr *dispatchers[_ACC_device_hwm] = { 0 };
 
 attribute_hidden void
-goacc_register (struct gomp_device_descr const *disp)
+goacc_register (struct gomp_device_descr *disp)
 {
   /* Only register the 0th device here.  */
   if (disp->target_id != 0)
@@ -96,7 +96,7 @@ get_openacc_name (const char *name)
     return name;
 }
 
-static struct gomp_device_descr const *
+static struct gomp_device_descr *
 resolve_device (acc_device_t d)
 {
   acc_device_t d_arg = d;
@@ -158,10 +158,10 @@ resolve_device (acc_device_t d)
    (indirectly) the target's device_init hook.  Calling multiple times without
    an intervening acc_shutdown_1 call is an error.  */
 
-static struct gomp_device_descr const *
+static struct gomp_device_descr *
 acc_init_1 (acc_device_t d)
 {
-  struct gomp_device_descr const *acc_dev;
+  struct gomp_device_descr *acc_dev;
 
   acc_dev = resolve_device (d);
 
@@ -174,7 +174,7 @@ acc_init_1 (acc_device_t d)
   /* We need to remember what we were intialized as, to check shutdown etc.  */
   init_key = d;  
 
-  gomp_init_device ((struct gomp_device_descr *) acc_dev);
+  gomp_init_device (acc_dev);
 
   return acc_dev;
 }
@@ -272,7 +272,7 @@ lazy_open (int ord)
   if (!thr)
     thr = goacc_new_thread ();
 
-  acc_dev = thr->dev = (struct gomp_device_descr *) &base_dev[ord];
+  acc_dev = thr->dev = &base_dev[ord];
 
   assert (acc_dev->target_id == ord);
 
@@ -358,7 +358,7 @@ acc_shutdown_1 (acc_device_t d)
 
   gomp_mutex_unlock (&goacc_thread_lock);
 
-  gomp_fini_device ((struct gomp_device_descr *) base_dev);
+  gomp_fini_device (base_dev);
 
   base_dev = NULL;
 }
@@ -382,7 +382,7 @@ ialias (acc_shutdown)
    current base device, else shut the old device down and re-initialize with
    the new device type.  */
 
-static struct gomp_device_descr const *
+static struct gomp_device_descr *
 lazy_init (acc_device_t d)
 {
   if (base_dev)
@@ -421,7 +421,7 @@ int
 acc_get_num_devices (acc_device_t d)
 {
   int n = 0;
-  struct gomp_device_descr const *acc_dev;
+  const struct gomp_device_descr *acc_dev;
 
   if (d == acc_device_none)
     return 0;
@@ -595,7 +595,7 @@ goacc_save_and_set_bind (acc_device_t d)
   assert (!thr->saved_bound_dev);
 
   thr->saved_bound_dev = thr->dev;
-  thr->dev = (struct gomp_device_descr *) dispatchers[d];
+  thr->dev = dispatchers[d];
 }
 
 attribute_hidden void
diff --git libgomp/oacc-int.h libgomp/oacc-int.h
index 3c2c37f..e03cd8d 100644
--- libgomp/oacc-int.h
+++ libgomp/oacc-int.h
@@ -90,10 +90,10 @@ goacc_thread (void)
 
 struct gomp_device_descr;
 
-void goacc_register (struct gomp_device_descr const *) __GOACC_NOTHROW;
+void goacc_register (struct gomp_device_descr *) __GOACC_NOTHROW;
 
 /* Current dispatcher.  */
-extern struct gomp_device_descr const *base_dev;
+extern struct gomp_device_descr *base_dev;
 
 void goacc_runtime_initialize (void);
 void goacc_save_and_set_bind (acc_device_t);
diff --git libgomp/oacc-mem.c libgomp/oacc-mem.c
index 8f7868e..60c4e8b 100644
--- libgomp/oacc-mem.c
+++ libgomp/oacc-mem.c
@@ -519,7 +519,7 @@ gomp_acc_insert_pointer (size_t mapnum, void **hostaddrs, size_t *sizes,
   struct gomp_device_descr *acc_dev = thr->dev;
 
   gomp_debug (0, "  %s: prepare mappings\n", __FUNCTION__);
-  tgt = gomp_map_vars ((struct gomp_device_descr *) acc_dev, mapnum, hostaddrs,
+  tgt = gomp_map_vars (acc_dev, mapnum, hostaddrs,
 		       NULL, sizes, kinds, true, false);
   gomp_debug (0, "  %s: mappings prepared\n", __FUNCTION__);
   tgt->prev = acc_dev->openacc.data_environ;
diff --git libgomp/target.c libgomp/target.c
index 788d9fb..d823045 100644
--- libgomp/target.c
+++ libgomp/target.c
@@ -678,7 +678,7 @@ gomp_init_device (struct gomp_device_descr *devicep)
 }
 
 attribute_hidden void
-gomp_init_tables (const struct gomp_device_descr *devicep,
+gomp_init_tables (struct gomp_device_descr *devicep,
 		  struct gomp_memory_mapping *mm)
 {
   /* Get address mapping table for device.  */
@@ -695,7 +695,7 @@ gomp_init_tables (const struct gomp_device_descr *devicep,
       tgt->tgt_end = table[i].tgt_end;
       tgt->to_free = NULL;
       tgt->list_count = 0;
-      tgt->device_descr = (struct gomp_device_descr *) devicep;
+      tgt->device_descr = devicep;
       splay_tree_node node = tgt->array;
       splay_tree_key k = &node->key;
       k->host_start = table[i].host_start;


GrÃÃe,
 Thomas

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]