[PATCH 1/4] [og8] Allow NULL for update directives in OpenACC 2.6
Thomas Schwinge
thomas@codesourcery.com
Thu Jan 31 17:17:00 GMT 2019
Hi Kwok!
On Wed, 30 Jan 2019 22:18:43 +0000, Kwok Cheung Yeung <kcy@codesourcery.com> wrote:
> A non-present passed-by-reference Fortran optional argument is
> represented by a null pointer. When passed to an update directive, it
> should be ignored as variable mappings are not created for null
> pointers. This should be safe as it is not possible to change a
> non-present argument into a present one (or vice-versa) in Fortran.
>
> libgomp/
> * oacc-mem.c (update_dev_host): Return early if the host address
> is NULL.
>
> Reviewed-by: Julian Brown <julian@codesourcery.com>
> Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
As I'd mentioned a few weeks ago internally, this change:
> --- a/libgomp/oacc-mem.c
> +++ b/libgomp/oacc-mem.c
> @@ -819,6 +819,12 @@ update_dev_host (int is_dev, void *h, size_t s, int
> async)
> if (acc_dev->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM)
> return;
>
> + /* Fortran optional arguments that are non-present result in a
> + null host address here. This can safely be ignored as it is
> + not possible to 'update' a non-present optional argument. */
> + if (h == NULL)
> + return;
... doesn't just affect the Fortran "update" directive but also the C/C++
one, and the "acc_update_device", "acc_update_self" runtime library
functions, and thus invalidates the C/C++
"libgomp.oacc-c-c++-common/lib-43.c", and
"libgomp.oacc-c-c++-common/lib-47.c" test cases, so these will have to be
adjusted (that is, removed). I pushed the attached to
openacc-gcc-8-branch in commit 745d3a19c63ec9c1de3f44e0dd5ee3ff126e2828
"Remove libgomp.oacc-c-c++-common/lib-43.c,
libgomp.oacc-c-c++-common/lib-47.c".
For avoidance of doubt: I'm not objecting to your code change. On
contrary, I do have an issue open to verify whether a host-NULL should
actually be accepted in even more places, as a no-op. But we'll have to
review/adjust/test all the code, not just "update_dev_host". (That's for
later, of course.)
A (very) quick check with the PGI compiler shows that they're also
handling such NULL pointers as no-ops.
Grüße
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Remove-libgomp.oacc-c-c-common-lib-43.c-libgomp.oacc.patch
Type: text/x-diff
Size: 3674 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190131/2c92887e/attachment.bin>
More information about the Gcc-patches
mailing list