[Patch, Fortran] CAF dep (3/3): coarrays - pass may_require_tmp informtion for CAF_get/send/sendget to the library
Tobias Burnus
burnus@net-b.de
Thu Aug 28 06:13:00 GMT 2014
This patch is based on 1/2 and 2/2 on the series. When the patch is
approved, OpenCoarrays needs to be adapted; however, as surplus
arguments of the callee are ignored, no immediate action is required.
(And some delay avoids issues with compilers being older than the library.)
The issue comes up in the context of having a coarray access on the same
image, e.g. "a[this_image()] = a", where alias questions play a role.
While one can leave the general handling to the library - such as
switching to memmove in case of local memory access, this patch tries to
help the library to decide whether it has to create a temporary variable
or not. For that reason, it passes an may_require_temporary argument to
the library.
may_require_temporary is false if the source and target variables are
disjunct, or if they are such overlapping that walking them in element
order will not require a temporary (special case: identical). If the
compiler cannot tell at compile time, the value is always one. Of
course, if the memory access is for a different image than the current
image (or for sendget: when the two image indexes are for different
images), the library can ignore the argument "may_require_temporary" and
use the normal remote memory access.
Build and regtested on x86-64-gnu-linux.
OK for the trunk?
Tobias
PS: I image code like the following in the library:
if (image_index == this_image)
{
if (contiguous LHS and RHS):
use memmove
// With special case: LHS and RHS identical
if (!may_require_temporary)
for-loop assigning
LHS = RHS in element order
else
{
tmp = malloc()
if (RHS contiguous or scalar)
tmp = memcpy(RHS)
else
for loop assigning RHS to tmp
if (LHS contiguous)
LHS = memcpy(tmp)
else
for loop assigning tmp to LHS
}
} else {
do normal remote-image assignment
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: caf-dep.diff
Type: text/x-patch
Size: 25305 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20140828/4e51697f/attachment.bin>
More information about the Fortran
mailing list