diff mbox

[Fortran-caf,committed] Prepare for remote-get support

Message ID 534450EA.5090204@net-b.de
State New
Headers show

Commit Message

Tobias Burnus April 8, 2014, 7:41 p.m. UTC
This is the first step for support coindexed variables on the RHS / in 
expressions. While the committed patch only defines some variables, I 
have a draft patch which handles the communication for scalars. Together 
with the existing support for coarrays on the LHS (scalars and arrays), 
the current support should already quite useful.

Committed as Rev. 209226.

Tobias
diff mbox

Patch

 gcc/fortran/ChangeLog.fortran-caf |    6 ++++++
 gcc/fortran/trans-decl.c          |   14 ++++++++++----
 gcc/fortran/trans.h               |    1 +
 libgfortran/ChangeLog.fortran-caf |    5 +++++
 libgfortran/caf/libcaf.h          |    2 ++
 libgfortran/caf/single.c          |   13 +++++++++++++
 6 files changed, 37 insertions(+), 4 deletions(-)

Index: libgfortran/ChangeLog.fortran-caf
===================================================================
--- libgfortran/ChangeLog.fortran-caf	(Revision 209209)
+++ libgfortran/ChangeLog.fortran-caf	(Arbeitskopie)
@@ -1,3 +1,8 @@ 
+2014-04-08  Tobias Burnus  <burnus@net-b.de>
+
+	* caf/libcaf.h (_gfortran_caf_get): New.
+	* caf/single.c (_gfortran_caf_get): New.
+
 2014-04-06  Tobias Burnus  <burnus@net-b.de>
 
 	* caf/libcaf.h (_gfortran_caf_send_desc,
Index: libgfortran/caf/libcaf.h
===================================================================
--- libgfortran/caf/libcaf.h	(Revision 209209)
+++ libgfortran/caf/libcaf.h	(Arbeitskopie)
@@ -108,6 +108,8 @@  void *_gfortran_caf_register (size_t, caf_register
 			      char *, int);
 void _gfortran_caf_deregister (caf_token_t *, int *, char *, int);
 
+void _gfortran_caf_get (caf_token_t, size_t, int, void *, size_t, bool);
+
 void _gfortran_caf_send (caf_token_t, size_t, int, void *, size_t, bool);
 void _gfortran_caf_send_desc (caf_token_t, size_t, int, gfc_descriptor_t*,
 			      gfc_descriptor_t*, bool);
Index: libgfortran/caf/single.c
===================================================================
--- libgfortran/caf/single.c	(Revision 209209)
+++ libgfortran/caf/single.c	(Arbeitskopie)
@@ -149,6 +149,19 @@  _gfortran_caf_deregister (caf_token_t *token, int
     *stat = 0;
 }
 
+
+/* Get a scalar (or contiguous) data from remote image into a buffer.  */
+
+void
+_gfortran_caf_get (caf_token_t token, size_t offset,
+		   int image_id __attribute__ ((unused)),
+		   void *buffer, size_t size, bool async __attribute__ ((unused)))
+{
+    void *src = (void *) ((char *) TOKEN (token) + offset);
+    memmove (buffer, src, size);
+}
+
+
 /* Send scalar (or contiguous) data from buffer to a remote image.  */
 
 void
Index: gcc/fortran/ChangeLog.fortran-caf
===================================================================
--- gcc/fortran/ChangeLog.fortran-caf	(Revision 209209)
+++ gcc/fortran/ChangeLog.fortran-caf	(Arbeitskopie)
@@ -1,3 +1,9 @@ 
+2014-04-08  Tobias Burnus  <burnus@net-b.de>
+
+	* trans.h (gfor_fndecl_caf_remote_get): Declare variables.
+	* trans-decl.c (gfor_fndecl_caf_remote_get): Define it.
+	(gfc_build_builtin_function_decls): Initialize it.
+
 2014-04-06  Tobias Burnus  <burnus@net-b.de>
 
 	* trans-intrinsic.c (conv_caf_send): Fix bugs with
Index: gcc/fortran/trans.h
===================================================================
--- gcc/fortran/trans.h	(Revision 209209)
+++ gcc/fortran/trans.h	(Arbeitskopie)
@@ -700,6 +700,7 @@  extern GTY(()) tree gfor_fndecl_caf_this_image;
 extern GTY(()) tree gfor_fndecl_caf_num_images;
 extern GTY(()) tree gfor_fndecl_caf_register;
 extern GTY(()) tree gfor_fndecl_caf_deregister;
+extern GTY(()) tree gfor_fndecl_caf_remote_get;
 extern GTY(()) tree gfor_fndecl_caf_send;
 extern GTY(()) tree gfor_fndecl_caf_send_desc;
 extern GTY(()) tree gfor_fndecl_caf_send_desc_scalar;
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c	(Revision 209209)
+++ gcc/fortran/trans-decl.c	(Arbeitskopie)
@@ -125,6 +125,7 @@  tree gfor_fndecl_caf_this_image;
 tree gfor_fndecl_caf_num_images;
 tree gfor_fndecl_caf_register;
 tree gfor_fndecl_caf_deregister;
+tree gfor_fndecl_caf_remote_get;
 tree gfor_fndecl_caf_send;
 tree gfor_fndecl_caf_send_desc;
 tree gfor_fndecl_caf_send_desc_scalar;
@@ -3262,22 +3263,27 @@  gfc_build_builtin_function_decls (void)
 
       gfor_fndecl_caf_deregister = gfc_build_library_function_decl_with_spec (
 	get_identifier (PREFIX("caf_deregister")), ".WWW", void_type_node, 4,
-        ppvoid_type_node, pint_type, pchar_type_node, integer_type_node);
+	ppvoid_type_node, pint_type, pchar_type_node, integer_type_node);
 
+      gfor_fndecl_caf_remote_get = gfc_build_library_function_decl_with_spec (
+	get_identifier (PREFIX("caf_get")), "R..W..", void_type_node, 6,
+	pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
+	size_type_node, boolean_type_node);
+
       gfor_fndecl_caf_send = gfc_build_library_function_decl_with_spec (
 	get_identifier (PREFIX("caf_send")), "R..R..", void_type_node, 6,
-        pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
+	pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
 	size_type_node, boolean_type_node);
 
       gfor_fndecl_caf_send_desc = gfc_build_library_function_decl_with_spec (
 	get_identifier (PREFIX("caf_send_desc")), "R..RR.", void_type_node, 6,
-        pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
+	pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
 	pvoid_type_node, boolean_type_node);
 
       gfor_fndecl_caf_send_desc_scalar
 	= gfc_build_library_function_decl_with_spec (
 	get_identifier (PREFIX("caf_send_desc_scalar")), "R..RR..", void_type_node, 6,
-        pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
+	pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
 	pvoid_type_node, boolean_type_node);
 
       gfor_fndecl_caf_critical = gfc_build_library_function_decl (