From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75583 invoked by alias); 20 Jul 2015 18:10:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 75574 invoked by uid 89); 20 Jul 2015 18:10:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 20 Jul 2015 18:10:49 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id A4B1EA1702; Mon, 20 Jul 2015 18:10:47 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-51.ams2.redhat.com [10.36.116.51]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6KIAjjJ005259 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Jul 2015 14:10:46 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.9/8.14.9) with ESMTP id t6KIAhih026957; Mon, 20 Jul 2015 20:10:44 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.9/8.14.9/Submit) id t6KIAgCc026956; Mon, 20 Jul 2015 20:10:42 +0200 Date: Mon, 20 Jul 2015 18:31:00 -0000 From: Jakub Jelinek To: Ilya Verbin Cc: Thomas Schwinge , gcc-patches@gcc.gnu.org, Kirill Yukhin Subject: Re: [gomp4.1] Initial support for some OpenMP 4.1 construct parsing Message-ID: <20150720181041.GE1780@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20150429111406.GE1751@tucnak.redhat.com> <874mnzrw1z.fsf@schwinge.name> <20150429120644.GG1751@tucnak.redhat.com> <20150609183608.GA47936@msticlxl57.ims.intel.com> <20150609202426.GG10247@tucnak.redhat.com> <20150625194529.GB33078@msticlxl57.ims.intel.com> <20150625201058.GK10247@tucnak.redhat.com> <20150717163136.GB15252@msticlxl57.ims.intel.com> <20150717164306.GT1780@tucnak.redhat.com> <20150720161422.GC1780@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150720161422.GC1780@tucnak.redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg01683.txt.bz2 Hi! And here is untested incremental libgomp side of the proposed GOMP_MAP_FIRSTPRIVATE_POINTER. I'll probably tweak it so that if GOMP_MAP_FIRSTPRIVATE is followed by one or more GOMP_MAP_FIRSTPRIVATE_POINTER where the pointers fall into the extents of the firstprivate object, it will make the whole object firstprivate and then overwrite the pointers in it (somewhat similar to GOMP_MAP_TO_PSET). --- include/gomp-constants.h.jj 2015-07-20 12:27:58.000000000 +0200 +++ include/gomp-constants.h 2015-07-20 19:43:47.734326985 +0200 @@ -74,6 +74,8 @@ enum gomp_map_kind GOMP_MAP_FORCE_DEVICEPTR = (GOMP_MAP_FLAG_SPECIAL_1 | 0), /* Do not map, copy bits for firstprivate instead. */ GOMP_MAP_FIRSTPRIVATE = (GOMP_MAP_FLAG_SPECIAL | 0), + /* Do not map, but pointer assign a pointer instead. */ + GOMP_MAP_FIRSTPRIVATE_POINTER = (GOMP_MAP_FLAG_SPECIAL | 1), /* Allocate. */ GOMP_MAP_FORCE_ALLOC = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC), /* ..., and copy to device. */ --- libgomp/target.c.jj 2015-07-20 16:03:20.000000000 +0200 +++ libgomp/target.c 2015-07-20 19:57:38.735556137 +0200 @@ -276,12 +276,8 @@ gomp_map_vars (struct gomp_device_descr tgt->list[i].key = NULL; continue; } - cur_node.host_start = (uintptr_t) hostaddrs[i]; - if (!GOMP_MAP_POINTER_P (kind & typemask)) - cur_node.host_end = cur_node.host_start + sizes[i]; - else - cur_node.host_end = cur_node.host_start + sizeof (void *); - if ((kind & typemask) == GOMP_MAP_FIRSTPRIVATE) + if ((kind & typemask) == GOMP_MAP_FIRSTPRIVATE + || (kind & typemask) == GOMP_MAP_FIRSTPRIVATE_POINTER) { tgt->list[i].key = NULL; @@ -289,10 +285,18 @@ gomp_map_vars (struct gomp_device_descr if (tgt_align < align) tgt_align = align; tgt_size = (tgt_size + align - 1) & ~(align - 1); - tgt_size += cur_node.host_end - cur_node.host_start; + if ((kind & typemask) == GOMP_MAP_FIRSTPRIVATE_POINTER) + tgt_size += sizeof (void *); + else + tgt_size += sizes[i]; has_firstprivate = true; continue; } + cur_node.host_start = (uintptr_t) hostaddrs[i]; + if (!GOMP_MAP_POINTER_P (kind & typemask)) + cur_node.host_end = cur_node.host_start + sizes[i]; + else + cur_node.host_end = cur_node.host_start + sizeof (void *); splay_tree_key n = splay_tree_lookup (mem_map, &cur_node); if (n) gomp_map_vars_existing (devicep, n, &cur_node, &tgt->list[i], @@ -374,15 +378,28 @@ gomp_map_vars (struct gomp_device_descr int kind = get_kind (short_mapkind, kinds, i); if (hostaddrs[i] == NULL) continue; - if ((kind & typemask) == GOMP_MAP_FIRSTPRIVATE) + if ((kind & typemask) == GOMP_MAP_FIRSTPRIVATE + || (kind & typemask) == GOMP_MAP_FIRSTPRIVATE_POINTER) { size_t align = (size_t) 1 << (kind >> rshift); tgt_size = (tgt_size + align - 1) & ~(align - 1); tgt->list[i].offset = tgt_size; - size_t len = sizes[i]; - devicep->host2dev_func (devicep->target_id, - (void *) (tgt->tgt_start + tgt_size), - (void *) hostaddrs[i], len); + size_t len; + if ((kind & typemask) == GOMP_MAP_FIRSTPRIVATE_POINTER) + { + len = sizeof (void *); + gomp_map_pointer (tgt, (uintptr_t) + *(void **) (hostaddrs[i]), + tgt_size, sizes[i]); + } + else + { + len = sizes[i]; + devicep->host2dev_func (devicep->target_id, + (void *) (tgt->tgt_start + + tgt_size), + (void *) hostaddrs[i], len); + } tgt_size += len; continue; } Jakub