From patchwork Wed Nov 30 15:59:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andre Vehreschild X-Patchwork-Id: 85891 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp289815qgi; Wed, 30 Nov 2016 08:00:15 -0800 (PST) X-Received: by 10.99.114.2 with SMTP id n2mr60585938pgc.130.1480521615395; Wed, 30 Nov 2016 08:00:15 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id v11si65100552pfd.199.2016.11.30.08.00.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Nov 2016 08:00:15 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-443085-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-443085-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-443085-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type; q=dns; s=default; b=ScL5DV5S2ipfOcWT bSQOKURULHw8dw6IVtYfWj7rE+MbDYZuj/2N1Lpe/JvDcesaLpkH8NfPC9lOfFAX 3uHwg9685uofmL/Xy5bJTSy/SvO9K83/1GxUNp9UbA9h8QZhTCqiOGBdRuRkjBjN TQdhF+YEytzNmtlvGauGS6x1PC8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type; s=default; bh=s5Taov6HY/hT3ow7dzMqIa HpRdE=; b=eC/zjO5XySXIPU08gkFAmy62LRbkmxFDFv7bZwbdmeMgJnvtH2XyOn Pieu/TltUY80qpkMr2Ui6lDg4xXawT6iJOUlzhXvu6UqpK8id6W1mxXdU4O90zi2 GoqqfqGHkj/5+Xt0y4QEMMAJdppoEYlr44sykfz/U9Bf4kMsu31NE= Received: (qmail 20996 invoked by alias); 30 Nov 2016 15:59:55 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 20968 invoked by uid 89); 30 Nov 2016 15:59:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.7 required=5.0 tests=AWL, BAYES_50, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 spammy=nicht, paulrichardthomasgmailcom, scans, paul.richard.thomas@gmail.com X-Spam-User: qpsmtpd, 3 recipients X-HELO: mout.gmx.net Received: from mout.gmx.net (HELO mout.gmx.net) (212.227.15.18) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 30 Nov 2016 15:59:44 +0000 Received: from vepi2 ([92.76.205.227]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MJSQ7-1c9eBU3Zdb-0033b6; Wed, 30 Nov 2016 16:59:40 +0100 Date: Wed, 30 Nov 2016 16:59:39 +0100 From: Andre Vehreschild To: Janus Weil Cc: Paul Richard Thomas , GCC-Patches-ML , GCC-Fortran-ML Subject: Re: PING! [PATCH, Fortran, accaf, v1] Add caf-API-calls to asynchronously handle allocatable components in derived type coarrays. Message-ID: <20161130165939.4bc669fc@vepi2> In-Reply-To: References: <20161122204650.03893214@vepi2> <20161128193330.55c0802a@vepi2> <20161130143007.235e8c73@vepi2> <20161130152246.03eec0fd@vepi2> <20161130153529.54bb0740@vepi2> MIME-Version: 1.0 X-UI-Out-Filterresults: notjunk:1; V01:K0:O8SP3CC5i2Y=:YIItVAGR56usGDkzCYhMvf X6s4CFXv3B6y+avGBG8edqCkAruRYFSSR+fwpxjthIGyV1g9KyYhGIWq/Sljqbobfysx2k3vJ tuhttzluDkFL9/6Tz9etLCcXXGSgZhSsCDQq5ddfBRoMqNuyUlcjljbx3punIXSffkmQ5QPLp iK+ZSt+zShqcDxeCPG+smfdC/qT6tGdALcVzMbXJhEJWMXjmSxyjqgIEDhl78VUL3HpsRiF1R s156pXa2tIAd42zcpfSBbynAMzo3/4ERCpOPGh22LzYu0o5qYfjuiFK411pBzoU8VPlr69YbD Kt6+c/ZDTi+QrYc4Mj7pR0wigAOa9mawE3z2SoP6JBOyYwx7hSVxHduexUV1+7EOKL+nRxuRG 8eg6jAGwvI2BaoP3byaI2zsw3OsxEaCxhaDWBbDGcW5VgrVHpUgA8gp4FArar2mfHLvmhCXAb JVimai1bK2utg1wqMrNbSLdfhCVW35GPdvg6jhFyBE/OhyPhZvgPP3/CMKf0ORDYLvhNTw4RU 87X2Q0YH9yhzp+yZh3Jk+b7zqaQZwGbzsIyBBrgnfEiboDNPdjv+06EU8EQQr7fWEx7Bd1Lq7 gSPCkmd3TGvmYuqrT1i6XMjxmKzMutVJOA9C7Vb2A+b1HnZGufgIw29OtkfPpbD7aKF5jXmA3 m/U5ugY6qBo4bFzc/N0dTgIZuXEIFA1CrGgwfJ73473iMMXJ0HXbBGSL8RdTgo8iCGhLsRsdY ChzIsvsCCWInj8Pr8wdgafSj3lBqbjapl5DZKYUcmWOQvb0UH6enaZr8j/M= Fixed -> r243034. - Andre On Wed, 30 Nov 2016 15:53:39 +0100 Janus Weil wrote: > Hi, > > > on IRC: > > 15:28:22 dominiq: vehre: add /* FALLTHROUGH */ > > > > Done and committed as obvious as r243023. > > thanks. However, I still see these two: > > > >> > /home/jweil/gcc/gcc7/trunk/libgfortran/caf/single.c: In function > >> > ‘_gfortran_caf_get_by_ref’: > >> > /home/jweil/gcc/gcc7/trunk/libgfortran/caf/single.c:1863:29: warning: > >> > ‘src_size’ may be used uninitialized in this function > >> > [-Wmaybe-uninitialized] > >> > if (size == 0 || src_size == 0) > >> > ~~~~~~~~~^~~~ > >> > /home/jweil/gcc/gcc7/trunk/libgfortran/caf/single.c: In function > >> > ‘_gfortran_caf_send_by_ref’: > >> > /home/jweil/gcc/gcc7/trunk/libgfortran/caf/single.c:2649:29: warning: > >> > ‘src_size’ may be used uninitialized in this function > >> > [-Wmaybe-uninitialized] > >> > if (size == 0 || src_size == 0) > >> > ~~~~~~~~~^~~~ > > Can you please fix them as well? > > Thanks, > Janus > > > > > >> > 2016-11-30 14:30 GMT+01:00 Andre Vehreschild : > >> > > Hi Paul, > >> > > > >> > > thanks for the review. Committed with the changes requested and the one > >> > > reported by Dominique on IRC for coarray_lib_alloc_4 when compiled with > >> > > -m32 as r243021. > >> > > > >> > > Thanks for the review and tests. > >> > > > >> > > Regards, > >> > > Andre > >> > > > >> > > On Wed, 30 Nov 2016 07:49:13 +0100 > >> > > Paul Richard Thomas wrote: > >> > > > >> > >> Dear Andre, > >> > >> > >> > >> This all looks OK to me. The only comment that I have that you might > >> > >> deal with before committing is that some of the Boolean expressions, > >> > >> eg: > >> > >> + int caf_dereg_mode > >> > >> + = ((caf_mode & GFC_STRUCTURE_CAF_MODE_IN_COARRAY) != 0 > >> > >> + || c->attr.codimension) > >> > >> + ? ((caf_mode & GFC_STRUCTURE_CAF_MODE_DEALLOC_ONLY) != 0 > >> > >> + ? GFC_CAF_COARRAY_DEALLOCATE_ONLY > >> > >> + : GFC_CAF_COARRAY_DEREGISTER) > >> > >> + : GFC_CAF_COARRAY_NOCOARRAY; > >> > >> > >> > >> are getting be sufficiently convoluted that a small, appropriately > >> > >> named, helper function might be clearer. Of course, this is true of > >> > >> many parts of gfortran but it is not too late to start making the code > >> > >> a bit clearer. > >> > >> > >> > >> You can commit to the present trunk as far as I am concerned. I know > >> > >> that the caf enthusiasts will test it to bits before release! > >> > >> > >> > >> Regards > >> > >> > >> > >> Paul > >> > >> > >> > >> > >> > >> On 28 November 2016 at 19:33, Andre Vehreschild > >> > >> wrote: > >> > >> > PING! > >> > >> > > >> > >> > I know it's a lengthy patch, but comments would be nice anyway. > >> > >> > > >> > >> > - Andre > >> > >> > > >> > >> > On Tue, 22 Nov 2016 20:46:50 +0100 > >> > >> > Andre Vehreschild wrote: > >> > >> > > >> > >> >> Hi all, > >> > >> >> > >> > >> >> attached patch addresses the need of extending the API of the > >> > >> >> caf-libs to enable allocatable components asynchronous allocation. > >> > >> >> Allocatable components in derived type coarrays are different from > >> > >> >> regular coarrays or coarrayed components. The latter have to be > >> > >> >> allocated on all images or on none. Furthermore is the allocation > >> > >> >> a point of synchronisation. > >> > >> >> > >> > >> >> For allocatable components the F2008 allows to have some allocated > >> > >> >> on some images and on others not. Furthermore is the registration > >> > >> >> with the caf-lib, that an allocatable component is present in a > >> > >> >> derived type coarray no longer a synchronisation point. To > >> > >> >> implement these features two new types of coarray registration > >> > >> >> have been introduced. The first one just registering the component > >> > >> >> with the caf-lib and the latter doing the allocate. Furthermore > >> > >> >> has the caf-API been extended to provide a query function to learn > >> > >> >> about the allocation status of a component on a remote image. > >> > >> >> > >> > >> >> Sorry, that the patch is rather lengthy. Most of this is due to the > >> > >> >> structure_alloc_comps' signature change. The routine and its > >> > >> >> wrappers are used rather often which needed the appropriate > >> > >> >> changes. > >> > >> >> > >> > >> >> I know I left two or three TODOs in the patch to remind me of > >> > >> >> things I have to investigate further. For the current state these > >> > >> >> TODOs are no reason to hold back the patch. The third party > >> > >> >> library opencoarrays implements the mpi-part of the caf-model and > >> > >> >> will change in sync. It would of course be advantageous to just > >> > >> >> have to say: With gcc-7 gfortran implements allocatable components > >> > >> >> in derived coarrays nearly completely. > >> > >> >> > >> > >> >> I know we are in stage 3. But the patch bootstraps and regtests ok > >> > >> >> on x86_64-linux/F23. So, is it ok for trunk or shall it go to 7.2? > >> > >> >> > >> > >> >> Regards, > >> > >> >> Andre > >> > >> > > >> > >> > > >> > >> > -- > >> > >> > Andre Vehreschild * Email: vehre ad gmx dot de > >> > >> > >> > >> > >> > >> > >> > > > >> > > > >> > > -- > >> > > Andre Vehreschild * Email: vehre ad gmx dot de > >> > >> > > > > > > -- > > Andre Vehreschild * Email: vehre ad gmx dot de -- Andre Vehreschild * Email: vehre ad gmx dot de Index: gcc/testsuite/ChangeLog =================================================================== --- gcc/testsuite/ChangeLog (Revision 243033) +++ gcc/testsuite/ChangeLog (Arbeitskopie) @@ -1,3 +1,8 @@ +2016-11-30 Andre Vehreschild + + Now really add the file. + * gfortran.dg/coarray_lib_alloc_4.f90: New test. + 2016-11-30 David Edelsohn * g++.dg/eh/new1.C: XFAIL on AIX. @@ -35,11 +40,6 @@ 2016-11-30 Andre Vehreschild - * caf/single.c (_gfortran_caf_is_present): Prevent fallthrough - warnings. - -2016-11-30 Andre Vehreschild - * gfortran.dg/coarray/alloc_comp_1.f90: Fix tree-dump scans to adhere to the changed interfaces. * gfortran.dg/coarray_alloc_comp_1.f08: Likewise. Index: gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90 =================================================================== --- gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90 (nicht existent) +++ gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90 (Arbeitskopie) @@ -0,0 +1,46 @@ +! { dg-do run } +! { dg-options "-fcoarray=lib -lcaf_single -fdump-tree-original" } +! +! Allocate/deallocate with libcaf. +! + +program test_caf_alloc + + type t + integer, allocatable :: i + real, allocatable :: r(:) + end type t + + type(t), allocatable :: xx[:] + + allocate (xx[*]) + + if (allocated(xx%i)) call abort() + if (allocated(xx[1]%i)) call abort() + if (allocated(xx[1]%r)) call abort() + allocate(xx%i) + if (.not. allocated(xx[1]%i)) call abort() + if (allocated(xx[1]%r)) call abort() + + allocate(xx%r(5)) + if (.not. allocated(xx[1]%i)) call abort() + if (.not. allocated(xx[1]%r)) call abort() + + deallocate(xx%i) + if (allocated(xx[1]%i)) call abort() + if (.not. allocated(xx[1]%r)) call abort() + + deallocate(xx%r) + if (allocated(xx[1]%i)) call abort() + if (allocated(xx[1]%r)) call abort() + + deallocate(xx) +end + +! { dg-final { scan-tree-dump-times "_gfortran_caf_is_present \\(xx\\.token, 2 - \\(integer\\(kind=4\\)\\) xx\\.dim\\\[0\\\]\\.lbound, &caf_ref\\.\[0-9\]+\\)|_gfortran_caf_is_present \\(xx\\.token, 2 - xx\\.dim\\\[0\\\]\\.lbound, &caf_ref\\.\[0-9\]+\\)" 10 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(72, 1, &xx\\.token, \\(void \\*\\) &xx, 0B, 0B, 0\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(\[0-9\]+, 7" 2 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(\[0-9\]+, 8" 2 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister \\(&xx\\.token, 0, 0B, 0B, 0\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister \\(&\\(\\(struct t \\* restrict\\) xx\\.data\\)->r\\.token, 1, 0B, 0B, 0\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister \\(&\\(\\(struct t \\* restrict\\) xx\\.data\\)->_caf_i, 1, 0B, 0B, 0\\)" 1 "original" } } Index: libgfortran/ChangeLog =================================================================== --- libgfortran/ChangeLog (Revision 243033) +++ libgfortran/ChangeLog (Arbeitskopie) @@ -1,5 +1,12 @@ 2016-11-30 Andre Vehreschild + * caf/single.c (_gfortran_caf_get_by_ref): Prevent compile time + warning. + (_gfortran_caf_send_by_ref): Same. + (_gfortran_caf_is_present): Prevent fallthrough warnings. + +2016-11-30 Andre Vehreschild + * caf/libcaf.h: Add new action types for (de-)registration of allocatable components in derived type coarrays. Add _caf_is_present prototype. Index: libgfortran/caf/single.c =================================================================== --- libgfortran/caf/single.c (Revision 243033) +++ libgfortran/caf/single.c (Arbeitskopie) @@ -1471,7 +1471,7 @@ size_t dst_index[GFC_MAX_DIMENSIONS]; int dst_rank = GFC_DESCRIPTOR_RANK (dst); int dst_cur_dim = 0; - size_t src_size; + size_t src_size = 0; caf_single_token_t single_token = TOKEN (token); void *memptr = single_token->memptr; gfc_descriptor_t *src = single_token->desc; @@ -2325,7 +2325,7 @@ size_t dst_index[GFC_MAX_DIMENSIONS]; int src_rank = GFC_DESCRIPTOR_RANK (src); int src_cur_dim = 0; - size_t src_size; + size_t src_size = 0; caf_single_token_t single_token = TOKEN (token); void *memptr = single_token->memptr; gfc_descriptor_t *dst = single_token->desc;