From: Thomas Schwinge <thomas@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>, Jakub Jelinek <jakub@redhat.com>
Cc: Julian Brown <julian@codesourcery.com>,
James Norris <jnorris@codesourcery.com>
Subject: Re: [gomp4] [1/3] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin
Date: Mon, 22 Dec 2014 17:33:00 -0000 [thread overview]
Message-ID: <877fxjzjxs.fsf@kepler.schwinge.homeip.net> (raw)
In-Reply-To: <20141014171118.6cec6fb4@octopus>
[-- Attachment #1: Type: text/plain, Size: 11473 bytes --]
Hi!
We had committed to gomp-4_0-branch code to handle TO_PSET memory mapping
(used with Fortran allocatable arrays). It turns out that is not
actually useful; committed to gomp-4_0-branch in r219022:
commit b2c3a33803b074052c5178fb1b6cabbd834cfa72
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon Dec 22 17:12:40 2014 +0000
libgomp: Remove the GOMP_MAP_TO_PSET handling code that we once added.
libgomp/
* target.c (gomp_map_vars) <GOMP_MAP_TO_PSET>: Revert earlier
changes.
With Intel MIC offloading (emulation), this fixes:
FAIL: libgomp.fortran/examples-4/e.55.2.f90 -O0 execution test
FAIL: libgomp.fortran/examples-4/e.55.2.f90 -O1 execution test
FAIL: libgomp.fortran/examples-4/e.55.2.f90 -O2 execution test
FAIL: libgomp.fortran/examples-4/e.55.2.f90 -O3 -fomit-frame-pointer execution test
FAIL: libgomp.fortran/examples-4/e.55.2.f90 -O3 -fomit-frame-pointer -funroll-loops execution test
FAIL: libgomp.fortran/examples-4/e.55.2.f90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions execution test
FAIL: libgomp.fortran/examples-4/e.55.2.f90 -O3 -g execution test
FAIL: libgomp.fortran/examples-4/e.55.2.f90 -Os execution test
FAIL: libgomp.fortran/target3.f90 -O0 execution test
FAIL: libgomp.fortran/target3.f90 -O1 execution test
FAIL: libgomp.fortran/target3.f90 -O2 execution test
FAIL: libgomp.fortran/target3.f90 -O3 -fomit-frame-pointer execution test
FAIL: libgomp.fortran/target3.f90 -O3 -fomit-frame-pointer -funroll-loops execution test
FAIL: libgomp.fortran/target3.f90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions execution test
FAIL: libgomp.fortran/target3.f90 -O3 -g execution test
FAIL: libgomp.fortran/target3.f90 -Os execution test
... for which Valgrind had reported:
==21161== Conditional jump or move depends on uninitialised value(s)
==21161== at 0x547233D: gomp_map_vars (target.c:267)
==21161== by 0x54743C3: GOMP_target_data (target.c:934)
==21161== by 0x400E6F: vec_mult_ (e.55.2.f90:38)
==21161== by 0x4011C9: MAIN__ (e.55.2.f90:55)
==21161== by 0x401200: main (e.55.2.f90:56)
*** Error in `/tmp/offload_aCxI50/offload_target_main': corrupted double-linked list: 0x0000000000c8b9e0 ***
The OpenACC PSET test cases still work.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219022 138bc75d-0d04-0410-961f-82ee72b054a4
---
libgomp/ChangeLog.gomp | 3 +
libgomp/target.c | 214 ++++++++++++++++---------------------------------
2 files changed, 72 insertions(+), 145 deletions(-)
diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 898040d..26fdfe6 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,8 @@
2014-12-22 Thomas Schwinge <thomas@codesourcery.com>
+ * target.c (gomp_map_vars) <GOMP_MAP_TO_PSET>: Revert earlier
+ changes.
+
* libgomp.h (TARGET_CAP_SHARED_MEM, TARGET_CAP_NATIVE_EXEC)
(TARGET_CAP_OPENMP_400, TARGET_CAP_OPENACC_200): Remove, and
instead...
diff --git libgomp/target.c libgomp/target.c
index dadcc03..423bbee 100644
--- libgomp/target.c
+++ libgomp/target.c
@@ -154,27 +154,6 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
tgt->device_descr = devicep;
tgt->mem_map = mm;
- /* From gcc/fortran/trans-types.c */
- struct descriptor_dimension
- {
- long stride;
- long lbound;
- long ubound;
- };
-
- struct gfc_array_descriptor
- {
- void *data;
- long offset;
- long dtype;
- struct descriptor_dimension dimension[];
- };
-
-#define GFC_DTYPE_RANK_MASK 0x07
-#define GFC_DTYPE_TYPE_MASK 0x38
-#define GFC_DTYPE_TYPE_SHIFT 3
-#define GFC_DTYPE_SIZE_SHIFT 6
-
if (mapnum == 0)
return tgt;
@@ -210,45 +189,6 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
{
tgt->list[i] = NULL;
- if ((kind & typemask) == GOMP_MAP_TO_PSET)
- {
- struct gfc_array_descriptor *gad;
- size_t rank;
- int j;
- bool alloc_arrays = true;
-
- for (j = i - 1; j >= 0; j--)
- {
- if (hostaddrs[j] == *(void**)hostaddrs[i])
- {
- alloc_arrays = false;
- break;
- }
- }
-
- gad = (struct gfc_array_descriptor *) cur_node.host_start;
- rank = gad->dtype & GFC_DTYPE_RANK_MASK;
-
- cur_node.host_start = (uintptr_t)gad->data;
- cur_node.host_end = cur_node.host_start +
- sizeof (struct gfc_array_descriptor) +
- (sizeof (struct descriptor_dimension) * rank);
-
- if (alloc_arrays)
- {
- size_t tsize;
-
- tsize = gad->dtype >> GFC_DTYPE_SIZE_SHIFT;
-
- for (j = 0; j < rank; j++)
- {
- cur_node.host_end += tsize *
- (gad->dimension[j].ubound -
- gad->dimension[j].lbound + 1);
- }
- }
- }
-
size_t align = (size_t) 1 << (kind >> rshift);
not_found_cnt++;
if (tgt_align < align)
@@ -419,92 +359,81 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
sizeof (void *));
break;
case GOMP_MAP_TO_PSET:
- {
- /* Copy from host to device memory. */
- /* FIXME: see above FIXME comment. */
- devicep->host2dev_func (devicep->target_id,
- (void *) (tgt->tgt_start
- + k->tgt_offset),
- (void *) k->host_start,
- (k->host_end - k->host_start));
- devicep->host2dev_func (devicep->target_id,
- (void *) (tgt->tgt_start
- + k->tgt_offset),
- (void *) &tgt->tgt_start,
- sizeof (void *));
+ /* Copy from host to device memory. */
+ /* FIXME: see above FIXME comment. */
+ devicep->host2dev_func (devicep->target_id,
+ (void *) (tgt->tgt_start
+ + k->tgt_offset),
+ (void *) k->host_start,
+ k->host_end - k->host_start);
- for (j = i + 1; j < mapnum; j++)
- if (!GOMP_MAP_POINTER_P (get_kind (is_openacc, kinds, j)
- & typemask))
- break;
- else if ((uintptr_t) hostaddrs[j] < k->host_start
- || ((uintptr_t) hostaddrs[j] + sizeof (void *)
- > k->host_end))
- break;
- else
- {
- tgt->list[j] = k;
- k->refcount++;
- cur_node.host_start
- = (uintptr_t) *(void **) hostaddrs[j];
- if (cur_node.host_start == (uintptr_t) NULL)
- {
- cur_node.tgt_offset = (uintptr_t) NULL;
- /* Copy from host to device memory. */
- /* FIXME: see above FIXME comment. */
- devicep->host2dev_func (devicep->target_id,
- (void *) (tgt->tgt_start
- + k->tgt_offset
- + ((uintptr_t) hostaddrs[j]
- - k->host_start)),
- (void *) &cur_node.tgt_offset,
- sizeof (void *));
- i++;
- continue;
- }
- /* Add bias to the pointer value. */
- cur_node.host_start += sizes[j];
- cur_node.host_end = cur_node.host_start + 1;
- n = splay_tree_lookup (&mm->splay_tree, &cur_node);
- if (n == NULL)
- {
- /* Could be possibly zero size array
- section. */
- cur_node.host_end--;
- n = splay_tree_lookup (&mm->splay_tree,
+ for (j = i + 1; j < mapnum; j++)
+ if (!GOMP_MAP_POINTER_P (get_kind (is_openacc, kinds, j)
+ & typemask))
+ break;
+ else if ((uintptr_t) hostaddrs[j] < k->host_start
+ || ((uintptr_t) hostaddrs[j] + sizeof (void *)
+ > k->host_end))
+ break;
+ else
+ {
+ tgt->list[j] = k;
+ k->refcount++;
+ cur_node.host_start
+ = (uintptr_t) *(void **) hostaddrs[j];
+ if (cur_node.host_start == (uintptr_t) NULL)
+ {
+ cur_node.tgt_offset = (uintptr_t) NULL;
+ /* Copy from host to device memory. */
+ /* FIXME: see above FIXME comment. */
+ devicep->host2dev_func (devicep->target_id,
+ (void *) (tgt->tgt_start + k->tgt_offset
+ + ((uintptr_t) hostaddrs[j]
+ - k->host_start)),
+ (void *) &cur_node.tgt_offset,
+ sizeof (void *));
+ i++;
+ continue;
+ }
+ /* Add bias to the pointer value. */
+ cur_node.host_start += sizes[j];
+ cur_node.host_end = cur_node.host_start + 1;
+ n = splay_tree_lookup (&mm->splay_tree, &cur_node);
+ if (n == NULL)
+ {
+ /* Could be possibly zero size array section. */
+ cur_node.host_end--;
+ n = splay_tree_lookup (&mm->splay_tree,
&cur_node);
- if (n == NULL)
- {
- cur_node.host_start--;
- n = splay_tree_lookup (&mm->splay_tree,
+ if (n == NULL)
+ {
+ cur_node.host_start--;
+ n = splay_tree_lookup (&mm->splay_tree,
&cur_node);
- cur_node.host_start++;
- }
- }
- if (n == NULL)
- gomp_fatal ("Pointer target of array section "
+ cur_node.host_start++;
+ }
+ }
+ if (n == NULL)
+ gomp_fatal ("Pointer target of array section "
"wasn't mapped");
- cur_node.host_start -= n->host_start;
- cur_node.tgt_offset = n->tgt->tgt_start
+ cur_node.host_start -= n->host_start;
+ cur_node.tgt_offset = n->tgt->tgt_start
+ n->tgt_offset
+ cur_node.host_start;
- /* At this point tgt_offset is target address of the
- array section. Now subtract bias to get what we
- want to initialize the pointer with. */
- cur_node.tgt_offset -= sizes[j];
- /* Copy from host to device memory. */
- /* FIXME: see above FIXME comment. */
-
- devicep->host2dev_func (devicep->target_id,
- (void *) (tgt->tgt_start
- + k->tgt_offset
- + ((uintptr_t) hostaddrs[j]
- - k->host_start)),
- (void *) &cur_node.tgt_offset,
- sizeof (void *));
- i++;
- }
- }
+ /* At this point tgt_offset is target address of the
+ array section. Now subtract bias to get what we
+ want to initialize the pointer with. */
+ cur_node.tgt_offset -= sizes[j];
+ /* Copy from host to device memory. */
+ /* FIXME: see above FIXME comment. */
+ devicep->host2dev_func (devicep->target_id,
+ (void *) (tgt->tgt_start + k->tgt_offset
+ + ((uintptr_t) hostaddrs[j]
+ - k->host_start)),
+ (void *) &cur_node.tgt_offset,
+ sizeof (void *));
+ i++;
+ }
break;
case GOMP_MAP_FORCE_PRESENT:
{
@@ -534,11 +463,6 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
}
}
-#undef GFC_DTYPE_RANK_MASK
-#undef GFC_DTYPE_TYPE_MASK
-#undef GFC_DTYPE_TYPE_SHIFT
-#undef GFC_DTYPE_SIZE_SHIFT
-
if (is_target)
{
for (i = 0; i < mapnum; i++)
Grüße,
Thomas
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
prev parent reply other threads:[~2014-12-22 17:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-14 16:12 Julian Brown
2014-10-14 16:33 ` [gomp4] [2/3] OpenACC 2.0 support for libgomp - new tests Julian Brown
2014-10-14 16:12 ` [gomp] [3/3] OpenACC 2.0 support for libgomp - documentation Julian Brown
2014-10-16 17:06 ` [gomp4] [1/3] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin Thomas Schwinge
2014-11-05 16:13 ` [gomp4] OpenACC documentation updates Thomas Schwinge
2014-10-28 16:07 ` [gomp4] [2/3] OpenACC 2.0 support for libgomp - new tests Thomas Schwinge
2014-10-29 19:54 ` [gomp4] libgomp: Also consider --with-cuda-driver flags for build-tree testing (was: [2/3] OpenACC 2.0 support for libgomp - new tests) Thomas Schwinge
2014-11-05 16:17 ` [gomp4] libgomp testsuite: OpenACC C++ " Thomas Schwinge
2014-11-13 13:32 ` [gomp4] [2/3] OpenACC 2.0 support for libgomp - new tests Thomas Schwinge
2014-10-28 16:15 ` [gomp4] [1/3] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin Thomas Schwinge
2014-10-28 19:42 ` [gomp4] Synchronous mode? (was: [1/3] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin) Thomas Schwinge
[not found] ` <541877C3.6080507@mentor.com>
2014-12-22 17:33 ` Thomas Schwinge [this message]
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=877fxjzjxs.fsf@kepler.schwinge.homeip.net \
--to=thomas@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jnorris@codesourcery.com \
--cc=julian@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).