Hi!

On 2019-12-17T22:03:47-0800, Julian Brown <jul...@codesourcery.com> wrote:
> This part contains the libgomp runtime support for the GOMP_MAP_ATTACH and
> GOMP_MAP_DETACH mapping kinds (etc.), as introduced by the front-end
> patches following in this series.

This (r279625) regressed the same OpenMP 'omp declare target link'
functionality/test case that I previously discussed in
<http://mid.mail-archive.com/87pniuuhkj.fsf@euler.schwinge.homeip.net>,
and/or
<http://mid.mail-archive.com/87k18vu1zr.fsf@euler.schwinge.homeip.net>:

    PASS: libgomp.c/target-link-1.c (test for excess errors)
    [-PASS:-]{+FAIL:+} libgomp.c/target-link-1.c execution test

(With nvptx offloading configured, as mentioned before, this test case
doesn't even build -- <https://gcc.gnu.org/PR81689> -- so, yes, this is
clearly insufficient test coverage of the 'omp declare target link'
functionality, but still we shouldn't regress it.)

What's causing the regression is:

> --- a/libgomp/target.c
> +++ b/libgomp/target.c
> @@ -1247,10 +1281,12 @@ gomp_map_vars_internal (struct gomp_device_descr 
> *devicep,

|               k->aux = NULL;
|               if (n && n->refcount == REFCOUNT_LINK)
|                 {
|                   /* Replace target address of the pointer with target address
|                      of mapped object in the splay tree.  */
|                   splay_tree_remove (mem_map, n);
|                   k->aux
|                     = gomp_malloc_cleared (sizeof (struct splay_tree_aux));
|                   k->aux->link_key = n;
|                 }
|               size_t align = (size_t) 1 << (kind >> rshift);
|               tgt->list[i].key = k;
|               k->tgt = tgt;
|               if (field_tgt_clear != FIELD_TGT_EMPTY)
|                 {
|                   k->tgt_offset = k->host_start - field_tgt_base
|                                   + field_tgt_offset;
|                   if (i == field_tgt_clear)
|                     field_tgt_clear = FIELD_TGT_EMPTY;
|                 }
|               else
|                 {
|                   tgt_size = (tgt_size + align - 1) & ~(align - 1);
|                   k->tgt_offset = tgt_size;
|                   tgt_size += k->host_end - k->host_start;
|                 }
>               tgt->list[i].copy_from = GOMP_MAP_COPY_FROM_P (kind & typemask);
>               tgt->list[i].always_copy_from
>                 = GOMP_MAP_ALWAYS_FROM_P (kind & typemask);
> +             tgt->list[i].do_detach = false;
>               tgt->list[i].offset = 0;
>               tgt->list[i].length = k->host_end - k->host_start;
>               k->refcount = 1;
>               k->virtual_refcount = 0;
> +             k->aux = NULL;
>               tgt->refcount++;
>               array->left = NULL;
>               array->right = NULL;

... that latter 'k->aux = NULL' assignment, which invalidates what the
'REFCOUNT_LINK' handling earlier set up.

I had intentionally left out this assignment in my "In
'libgomp/target.c', 'struct splay_tree_key_s', use 'struct
splay_tree_aux' for infrequently-used or API-specific data" patch,
<87k16uykb7.fsf@euler.schwinge.homeip.net">http://mid.mail-archive.com/87k16uykb7.fsf@euler.schwinge.homeip.net>,
and you also don't have that assignment in your r279620 "Use aux struct
in libgomp for infrequently-used/API-specific data" commit,
<80e0dba326a4414fd2dbe8401dbd8d8f08445129.1576648001.git.julian@codesourcery.com">http://mid.mail-archive.com/80e0dba326a4414fd2dbe8401dbd8d8f08445129.1576648001.git.julian@codesourcery.com>,
so curious why it now appears here -- hopefully just an oversight.

See attached "[OMP] Restore 'omp declare target link' handling";
committed to trunk in r279701.


Grüße
 Thomas


From dc669e8f45a5b1e61e746b6d2c6a23480fdd904f Mon Sep 17 00:00:00 2001
From: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Sat, 21 Dec 2019 22:58:43 +0000
Subject: [PATCH] [OMP] Restore 'omp declare target link' handling

    PASS: libgomp.c/target-link-1.c (test for excess errors)
    [-PASS:-]{+FAIL:+} libgomp.c/target-link-1.c execution test

We need to revert one line of code change from r279625.

	libgomp/
	* target.c (gomp_map_vars_internal): Restore 'omp declare target
	link' handling.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@279701 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog | 5 +++++
 libgomp/target.c  | 1 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 81b9d6788a1..7bc7d41da42 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-21  Thomas Schwinge  <tho...@codesourcery.com>
+
+	* target.c (gomp_map_vars_internal): Restore 'omp declare target
+	link' handling.
+
 2019-12-19  Julian Brown  <jul...@codesourcery.com>
 
 	* testsuite/libgomp.oacc-fortran/class-ptr-param.f95: New test.
diff --git a/libgomp/target.c b/libgomp/target.c
index 50a9c2b1df3..bf30716cd85 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -1129,7 +1129,6 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep,
 		tgt->list[i].length = k->host_end - k->host_start;
 		k->refcount = 1;
 		k->virtual_refcount = 0;
-		k->aux = NULL;
 		tgt->refcount++;
 		array->left = NULL;
 		array->right = NULL;
-- 
2.17.1

Attachment: signature.asc
Description: PGP signature

Reply via email to