[PATCH 07/13] OpenACC 2.6 deep copy: libgomp parts

Thomas Schwinge thomas@codesourcery.com
Thu Jun 4 18:53:49 GMT 2020


Hi!

On 2019-12-17T22:03:47-0800, Julian Brown <julian@codesourcery.com> wrote:
> This part contains the libgomp runtime support for the GOMP_MAP_ATTACH and
> GOMP_MAP_DETACH mapping kinds (etc.)

> --- a/libgomp/oacc-mem.c
> +++ b/libgomp/oacc-mem.c

> @@ -1075,6 +1119,39 @@ goacc_exit_data_internal (struct gomp_device_descr *acc_dev, size_t mapnum,

> +     case GOMP_MAP_STRUCT:
> +       {
> +         int elems = sizes[i];
> +         for (int j = 1; j <= elems; j++)
> +           {
> +             struct splay_tree_key_s k;
> +             k.host_start = (uintptr_t) hostaddrs[i + j];
> +             k.host_end = k.host_start + sizes[i + j];
> +             splay_tree_key str;
> +             str = splay_tree_lookup (&acc_dev->mem_map, &k);
> +             if (str)
> +               {
> +                 if (finalize)
> +                   {
> +                     str->refcount -= str->virtual_refcount;
> +                     str->virtual_refcount = 0;
> +                   }
> +                 if (str->virtual_refcount > 0)
> +                   {
> +                     str->refcount--;
> +                     str->virtual_refcount--;
> +                   }
> +                 else if (str->refcount > 0)
> +                   str->refcount--;
> +                 if (str->refcount == 0)
> +                   gomp_remove_var_async (acc_dev, str, aq);
> +               }
> +           }
> +         i += elems;
> +       }
> +       break;

I'm aware that this 'GOMP_MAP_STRUCT' special handling shouldn't have
been there to begin with, and is now scheduled to go away (yay!), but
while testing a few things while reviewing (reverse-engineering the
intentions of) these fix-up patches, I quickly ran into cases where
OpenACC code that I understand to be valid failed, exactly here.  I've
pushed "[OpenACC 'exit data'] Evaluate 'finalize' individually for
'GOMP_MAP_STRUCT' entries" to master branch in commit
a02f1adbfe619ab19cf142438e0a02950d3594da, and releases/gcc-10 branch in
commit 5a1b479aedd83d0362f870f480a24a011e703de4, and then "[OpenACC 'exit
data'] Evaluate 'copyfrom' individually for 'GOMP_MAP_STRUCT' entries" to
master branch in commit 2c838a3e4ea06c69c856d074ae5b0400e08ae3c2, and
releases/gcc-10 branch in commit
4664ca1bc40318dbe60591cfe6d31c3d36d439c3, see attached.


Grüße
 Thomas


-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-OpenACC-exit-data-Evaluate-finalize-individually-for.patch
Type: text/x-diff
Size: 6251 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200604/ad912110/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-OpenACC-exit-data-Evaluate-finalize-individually.g10.patch
Type: text/x-diff
Size: 6321 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200604/ad912110/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-OpenACC-exit-data-Evaluate-copyfrom-individually-for.patch
Type: text/x-diff
Size: 7004 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200604/ad912110/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-OpenACC-exit-data-Evaluate-copyfrom-individually.g10.patch
Type: text/x-diff
Size: 7074 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200604/ad912110/attachment-0007.bin>


More information about the Gcc-patches mailing list