[gomp4] [1/3] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin
Thomas Schwinge
thomas@codesourcery.com
Mon Dec 22 17:33:00 GMT 2014
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20141222/f790d28a/attachment.sig>
More information about the Gcc-patches
mailing list