From: Jakub Jelinek <jakub@redhat.com>
To: Ilya Verbin <iverbin@gmail.com>
Cc: Thomas Schwinge <thomas@codesourcery.com>,
gcc-patches@gcc.gnu.org,
Kirill Yukhin <kirill.yukhin@gmail.com>
Subject: Re: [gomp4.1] Initial support for some OpenMP 4.1 construct parsing
Date: Mon, 20 Jul 2015 18:31:00 -0000 [thread overview]
Message-ID: <20150720181041.GE1780@tucnak.redhat.com> (raw)
In-Reply-To: <20150720161422.GC1780@tucnak.redhat.com>
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
next prev parent reply other threads:[~2015-07-20 18:10 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-29 11:44 Jakub Jelinek
2015-04-29 11:55 ` Thomas Schwinge
2015-04-29 12:31 ` Jakub Jelinek
2015-04-29 15:20 ` Thomas Schwinge
2015-06-09 18:39 ` Ilya Verbin
2015-06-09 20:25 ` Jakub Jelinek
2015-06-25 19:47 ` Ilya Verbin
2015-06-25 20:31 ` Jakub Jelinek
2015-07-17 16:47 ` Ilya Verbin
2015-07-17 16:54 ` Jakub Jelinek
2015-07-20 16:18 ` Jakub Jelinek
2015-07-20 18:31 ` Jakub Jelinek [this message]
2015-07-23 0:50 ` Jakub Jelinek
2015-07-24 20:33 ` Jakub Jelinek
2015-07-29 17:30 ` [gomp4.1] Various accelerator updates from OpenMP 4.1 Jakub Jelinek
2015-09-04 18:17 ` Ilya Verbin
2015-09-04 18:25 ` Jakub Jelinek
2015-09-07 12:48 ` Jakub Jelinek
2015-07-20 19:40 ` [gomp4.1] Initial support for some OpenMP 4.1 construct parsing Ilya Verbin
2015-08-24 12:38 ` Jakub Jelinek
2015-08-24 19:10 ` Ilya Verbin
2015-06-11 12:52 ` [gomp4.1] map clause parsing improvements Jakub Jelinek
2015-10-19 10:34 ` Thomas Schwinge
2015-10-19 10:46 ` Jakub Jelinek
2015-10-19 15:14 ` Thomas Schwinge
2015-10-20 10:10 ` Jakub Jelinek
2015-10-26 13:04 ` Ilya Verbin
2015-10-26 13:17 ` Jakub Jelinek
2015-10-26 14:16 ` Ilya Verbin
2016-03-17 14:34 ` Thomas Schwinge
2016-03-17 14:37 ` Jakub Jelinek
2016-03-17 14:55 ` Jakub Jelinek
2016-03-17 15:13 ` Rename GOMP_MAP_FORCE_DEALLOC to GOMP_MAP_DELETE (was: [gomp4.1] map clause parsing improvements) Thomas Schwinge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150720181041.GE1780@tucnak.redhat.com \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=iverbin@gmail.com \
--cc=kirill.yukhin@gmail.com \
--cc=thomas@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).