[Patch, v2] OpenMP/Fortran: Fix handling of 'declare target' with 'link' clause [PR11555]
Tobias Burnus
tburnus@baylibre.com
Fri Jul 26 18:34:18 GMT 2024
Updated patch - only change is to the testcase:
* With the just posted patch for PR116107, array sections with offset
work for 'link', hence, I updated the testcase.
* For 'arr2', I added ref to the associated PR.
I intent to commit it once PR116107 has been committed.
Tobias
Tobias Burnus wrote:
> Hi all,
>
> it turned out that 'declare target' with 'link' clause was broken in multiple ways.
>
> The main fix is the attached patch, i.e. namely pushing the variables already to
> the offload-vars list already in the FE.
>
> When implementing it, I noticed:
> * C has a similar issue when using nested functions, which is
> a GNU extension →https://gcc.gnu.org/115574
>
> * When doing partial mapping of arrays (which is one of the reasons for 'link'),
> offsets are mishandled in Fortran (not tested in C), see FIXME in the patch)
> There: arr2(10) should print 10 but with map(arr2(10:)) it prints 19.
> (I will file a PR about this).
>
> * It might happen that linked variables do not get linked. I have not investigated
> why, but 'arr2' gives link errors – while 'arr' works.
> See FIXME in the patch. (I will file a PR about this)
>
> * For COMMON blocks, map(/common/) is rejected,https://gcc.gnu.org/PR115577
>
> * When then mapping map(a,b,c) which is identical for 'common /mycom/ a,b,c',
> it fails to link the device side as the 'mycom_' symbol cannot be found on the
> device side. (I will file a PR about this)
>
> As COMMON as issues, an alternative would be to defer the trans-common.cc
> changes to a later patch.
>
> Comments, questions, concerns?
>
> Tobias
>
> PS: Tested with nvptx offloading with a page-migration supporting system with
> nvptx and GCN offloading configured and no new fails observed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20240726/7ac8e3c8/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: omp-declare-tgt-link-v3.diff
Type: text/x-patch
Size: 12179 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20240726/7ac8e3c8/attachment.bin>
More information about the Fortran
mailing list