On 2019-12-04, 10:29:04, Thomas Schwinge wrote:
--- gcc/ada/gcc-interface/trans.c
+++ gcc/ada/gcc-interface/trans.c
@@ -1309,6 +1533,274 @@ Pragma_to_gnu (Node_Id gnat_node)
+             case Name_Copy:
+               map_kind = GOMP_MAP_FORCE_TOFROM;
+               gnu_clauses = Iterate_Acc_Clause_Arg (gnat_expr, gnu_clauses,
+                                                     Acc_Data_to_gnu,
+                                                     &map_kind);
+               break;
+
+             case Name_Copy_In:
+               map_kind = GOMP_MAP_FORCE_TO;
+               gnu_clauses = Iterate_Acc_Clause_Arg (gnat_expr, gnu_clauses,
+                                                     Acc_Data_to_gnu,
+                                                     &map_kind);
+               break;
+
+             case Name_Copy_Out:
+               map_kind = GOMP_MAP_FORCE_FROM;
+               gnu_clauses = Iterate_Acc_Clause_Arg (gnat_expr, gnu_clauses,
+                                                     Acc_Data_to_gnu,
+                                                     &map_kind);
+               break;

+             case Name_Create:
+               map_kind = GOMP_MAP_FORCE_ALLOC;
+               gnu_clauses = Iterate_Acc_Clause_Arg (gnat_expr, gnu_clauses,
+                                                     Acc_Data_to_gnu,
+                                                     &map_kind);
+               break;

What's the rationale for using here the 'FORCE' mapping kind variants
instead of 'GOMP_MAP_TOFROM', 'GOMP_MAP_TO', 'GOMP_MAP_FROM',
'GOMP_MAP_ALLOC', as demanded starting with the OpenACC 2.5 revision
(default 'present_or_*' behavior)?

Hello Thomas. I wrote this code a year and half ago so I don't remember
exactly. From what I found in my notes, it seems like when I started
working on this, the GCC version I worked with only supported OpenACC
2.0, which might explain why I used 'FORCE' here (this is corroborated
by the OpenACC wiki page that mentions that GCC 7/8 only supported
OpenAcc 2.0: https://gcc.gnu.org/wiki/OpenACC ).

I haven't worked on this since then so that's probably why this hasn't
been updated to support newer map kinds.

It's also entirely possible that I simply made a mistake, I inferred
most of what I know about supporting OpenACC in the GNAT frontend by
reading what gcc's C and Fortran frontends did. Perhaps I didn't look at
the right piece of code/was looking at an old piece of code.

Thanks for taking a look at GNAT's OpenACC implementation and feel free
to ask more questions :).

Reply via email to