Dear Tobias, This looks fine to me - OK for trunk.
Thanks for this massive effort! Paul On 28 August 2014 08:13, Tobias Burnus <bur...@net-b.de> wrote: > 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 > } -- The knack of flying is learning how to throw yourself at the ground and miss. --Hitchhikers Guide to the Galaxy