[Patch] OpenMP: Add iterator support to Fortran's depend; add affinity clause
Tobias Burnus
tobias@codesourcery.com
Tue Apr 27 13:36:38 GMT 2021
OpenMP 5's iterator can be used for
- depend clause
- affinity clause
- mapping (unsupported and not touched)
(a) This patch add the iterator support to the Fortran FE
and adds support for it to the depend clause.
(b) It also adds a conforming stub implementation (parse & ignore in ME)
for 'affinity' (Fortran, C, C++)
(c) Fortran's taskwait did not handle the depend clause, now it does.
The way the iterator is stored in Fortran is a bit convoluted,
but should be fine:
new namespace (such that symbols can be overridden and resolution works),
using symbol->value for the iteration (begin:end:step) as array constructor,
and abusing the ns->proc_name + its '->tlink' to generate an linked list,
which avoids walking the ns->sym_root tree and has the user's order in
the dump instead of the tree-walking order.
The ME implementation also seems to require a very special way the
variables are stored. – It seems as if it works correctly for depend;
hence, I hope I did correctly read the dump and tree sharing is correctly
handled.
NOTE: The iterator Fortran patch includes one change from the post-OpenMP-5.0 spec:
The '::' after the typespec in order to avoid Fortran free-form source issues with:
'iterator(integer i=1:10)' – namely: is this the integer 'i' or the variable
'integeri' (as spaces are ignored in fixed-form Fortran)?
NOTE 2: The way it is implemented, the 'begin:end:step' expression is evaluated
multiple times - once per list item; I think this matches C, but I am not completely
sure nor whether that is a problem. (Unlikely a real-world problem.)
NOTE 3: I did have some trouble reading the spec with regards to what in C is permitted
for 'affinity' ('locator-list); the code now mostly follows what is permitted for 'depend'.
OK?
Tobias
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: omp-iterator-affinity.diff
Type: text/x-patch
Size: 90048 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210427/855aeb42/attachment-0001.bin>
More information about the Gcc-patches
mailing list