Hi!

On Mon, 19 Oct 2015 18:24:35 +0200, I wrote:
> Chung-Lin, would you please have a look at the following (on
> gomp-4_0-branch)?  Also, anyone else got any ideas off-hand?

Ilya, Jakub, thanks for your comments!

> On Tue, 23 Jun 2015 13:51:39 +0200, Jakub Jelinek <ja...@redhat.com> wrote:
> > On Tue, Jun 23, 2015 at 02:40:43PM +0300, Ilya Verbin wrote:
> > > On Sat, Jun 20, 2015 at 00:35:14 +0300, Ilya Verbin wrote:
> > > > Given that a mapped variable in 4.1 can have different kinds across 
> > > > nested data
> > > > regions, we need to store map-type not only for each var, but also for 
> > > > each
> > > > structured mapping.  Here is my WIP patch, is it sane? :)
> > > > Attached testcase works OK on the device with non-shared memory.
> > > 
> > > A bit updated version with a fix for GOMP_MAP_TO_PSET.
> > > make check-target-libgomp passed.
> > 
> > Ok, thanks.
> > 
> > > include/gcc/
> > >   * gomp-constants.h (GOMP_MAP_ALWAYS_TO_P,
> > >   GOMP_MAP_ALWAYS_FROM_P): Define.
> > > libgomp/
> > >   * libgomp.h (struct target_var_desc): New.
> > >   (struct target_mem_desc): Replace array of splay_tree_key with array of
> > >   target_var_desc.
> > >   (struct splay_tree_key_s): Move copy_from to target_var_desc.
> > >   * oacc-mem.c (gomp_acc_remove_pointer): Use copy_from from
> > >   target_var_desc.
> > >   * oacc-parallel.c (GOACC_parallel): Use copy_from from target_var_desc.
> > >   * target.c (gomp_map_vars_existing): Copy data to device if map-type is
> > >   'always to' or 'always tofrom'.
> > >   (gomp_map_vars): Use key from target_var_desc.  Set copy_from and
> > >   always_copy_from.
> > >   (gomp_copy_from_async): Use key and copy_from from target_var_desc.
> > >   (gomp_unmap_vars): Copy data from device if always_copy_from is set.
> > >   (gomp_offload_image_to_device): Do not use copy_from.
> > >   * testsuite/libgomp.c/target-11.c: New test.
> 
> (That's gomp-4_1-branch r224838.  The attached
> gomp-4_1-branch-r224838.patch is a variant that applies on top of
> gomp-4_0-branch r228972.)  This change introduces regressions in OpenACC
> async clause handling.

> Testing on gomp-4_0-branch r228972 plus the attached
> gomp-4_1-branch-r224838.patch:
> 
>     PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/asyncwait-1.c 
> -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none (test for 
> excess errors)
>     [-PASS:-]{+FAIL:+} 
> libgomp.oacc-c/../libgomp.oacc-c-c++-common/asyncwait-1.c 
> -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none execution 
> test
> 
> Same for C++.

With an XFAIL added (Chung-Lin, please remove that one once you come up
with a fix), and merge conflicts resolved as follows, I have now merged
gomp-4_1-branch r224838 in gomp-4_0-branch r229178:

commit cbef8ef8e3b6bf7ea3705b1fae5462be9e619a56
Merge: 3596aeb a568354
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Oct 22 17:50:08 2015 +0000

    svn merge -r 224607:224838 
svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_1-branch
    
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@229178 
138bc75d-0d04-0410-961f-82ee72b054a4

 include/ChangeLog.gomp41                           |   5 +
 include/gomp-constants.h                           |   6 ++
 libgomp/ChangeLog.gomp41                           |  18 ++++
 libgomp/libgomp.h                                  |  15 ++-
 libgomp/oacc-mem.c                                 |   2 +-
 libgomp/oacc-parallel.c                            |   6 +-
 libgomp/target.c                                   | 106 +++++++++++++--------
 libgomp/testsuite/libgomp.c/target-11.c            |  51 ++++++++++
 .../libgomp.oacc-c-c++-common/asyncwait-1.c        |   2 +
 9 files changed, 162 insertions(+), 49 deletions(-)

diff --cc libgomp/oacc-mem.c
index 7fcf199,c0fcb07..a90c912
--- libgomp/oacc-mem.c
+++ libgomp/oacc-mem.c
@@@ -685,7 -650,8 +685,7 @@@ gomp_acc_remove_pointer (void *h, bool 
        }
      }
  
-   t->list[0]->copy_from = force_copyfrom ? 1 : 0;
 -  if (force_copyfrom)
 -    t->list[0].copy_from = 1;
++  t->list[0].copy_from = force_copyfrom ? 1 : 0;
  
    gomp_mutex_unlock (&acc_dev->lock);
  
diff --cc libgomp/oacc-parallel.c
index 2b90c9f,8ea3dd1..e4ecc87
--- libgomp/oacc-parallel.c
+++ libgomp/oacc-parallel.c
@@@ -261,16 -135,12 +261,16 @@@ GOACC_parallel_keyed (int device, void 
  
    devaddrs = gomp_alloca (sizeof (void *) * mapnum);
    for (i = 0; i < mapnum; i++)
 -    devaddrs[i] = (void *) (tgt->list[i].key->tgt->tgt_start
 -                          + tgt->list[i].key->tgt_offset);
 +    {
-       if (tgt->list[i] != NULL)
-       devaddrs[i] = (void *) (tgt->list[i]->tgt->tgt_start
-                               + tgt->list[i]->tgt_offset);
++      if (tgt->list[i].key != NULL)
++      devaddrs[i] = (void *) (tgt->list[i].key->tgt->tgt_start
++                              + tgt->list[i].key->tgt_offset);
 +      else
 +      devaddrs[i] = NULL;
 +    }
  
 -  acc_dev->openacc.exec_func (tgt_fn, mapnum, hostaddrs, devaddrs, sizes, 
kinds,
 -                            num_gangs, num_workers, vector_length, async,
 -                            tgt);
 +  acc_dev->openacc.exec_func (tgt_fn, mapnum, hostaddrs, devaddrs,
 +                            async, dims, tgt);
  
    /* If running synchronously, unmap immediately.  */
    if (async < acc_async_noval)
diff --cc libgomp/target.c
index 4587361,05c9b71..c2e1996
--- libgomp/target.c
+++ libgomp/target.c
@@@ -714,9 -721,6 +740,8 @@@ gomp_load_image_to_device (struct gomp_
        k->tgt_offset = target_table[i].start;
        k->refcount = 1;
        k->async_refcount = 0;
-       k->copy_from = false;
-       tgt->list[i] = k;
++      tgt->list[i].key = k;
 +      tgt->refcount++;
        array->left = NULL;
        array->right = NULL;
        splay_tree_insert (&devicep->mem_map, array);
@@@ -742,9 -746,6 +767,8 @@@
        k->tgt_offset = target_var->start;
        k->refcount = 1;
        k->async_refcount = 0;
-       k->copy_from = false;
-       tgt->list[i] = k;
++      tgt->list[i].key = k;
 +      tgt->refcount++;
        array->left = NULL;
        array->right = NULL;
        splay_tree_insert (&devicep->mem_map, array);
diff --cc libgomp/testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c
index d478ce2,22cef6d..f3b490a
--- libgomp/testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c
@@@ -1,4 -1,4 +1,6 @@@
  /* { dg-do run { target openacc_nvidia_accel_selected } } */
++/* 
<http://news.gmane.org/find-root.php?message_id=%3C87pp0aaksc.fsf%40kepler.schwinge.homeip.net%3E>.
++   { dg-xfail-run-if "TODO" { *-*-* } } */
  /* { dg-additional-options "-lcuda" } */
  
  #include <openacc.h>


Grüße
 Thomas

Attachment: signature.asc
Description: PGP signature

Reply via email to