From patchwork Mon Dec 22 18:14:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 423473 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 072891400B7 for ; Tue, 23 Dec 2014 05:15:04 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=TQksKTLlL00E2XKd WTxTPw9Z6e1Zcit9mcrl+ywoqdaNjIiw8DwZM6elwkkPg9Bor7smdaFKeLYMe7se XKq9+55OYqkgtMfTrQ/s5qophilACfMRxdweVocRHqxM7IUDJ75nKNSCHBSl1IUs FqbejwqTKNXe8289uhwtszqzcS4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=15kMFw4IM6gBrdcvnqd6uq cQXQE=; b=eG4LEvd3VCDB2L+ly3RGHbQSgoPhe+mn7+GY45IlTd+wtafjfHDjVn nm7LKiqlXVuUHmDPK4oAksE6FnlgXLIheoiEcNmaGmOp4pd4BC6OB/t32YShVgXP c18qcoylbr+Pyi+cs0Lmq6n+J+KlhmgTUWthqXsjVKBnW/XKU5yVM= Received: (qmail 20775 invoked by alias); 22 Dec 2014 18:14:57 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 20766 invoked by uid 89); 22 Dec 2014 18:14:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 Dec 2014 18:14:55 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Y37VK-0000Y4-Vj from Thomas_Schwinge@mentor.com ; Mon, 22 Dec 2014 10:14:51 -0800 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.181.6; Mon, 22 Dec 2014 18:14:49 +0000 From: Thomas Schwinge To: , Jakub Jelinek CC: Julian Brown Subject: Re: [PATCH 1/5] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin (repost) In-Reply-To: <20141111135323.29e0f27b@octopus> References: <20140923191931.2177e60f@octopus> <20141111135323.29e0f27b@octopus> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) Date: Mon, 22 Dec 2014 19:14:44 +0100 Message-ID: <87mw6fy2jv.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Hi! On Tue, 11 Nov 2014 13:53:23 +0000, Julian Brown wrote: > On Tue, 23 Sep 2014 19:19:31 +0100 > Julian Brown 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 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(-) Grüße, Thomas 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 + * 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;