From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by sourceware.org (Postfix) with ESMTPS id AC5D3385701F for ; Sat, 26 Dec 2020 12:10:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AC5D3385701F Received: by mail-lf1-x136.google.com with SMTP id m12so14078953lfo.7 for ; Sat, 26 Dec 2020 04:10:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AFtATzCkGZC7DBkh6WHAtVgyP/jBHzWUW2IwS37kpgU=; b=r4VQGVcG7u74RKdUKzwxljUSZuKohSC7oBzGPkyPHAtE+zLUoAcje/aZQcwa1E13s9 8Flx4DrIBYM81fr3wtA7zQV3YSX6E/WD7tkDef51sh4L+9dhbKl74Y8bOfGeSy9VuYlB wOtSdaLVDWyhQXUrIIMiy25BCuVAIfFXiqnSnFkizaF7Y5TiRgF2LhoWOaC1aiCANOyH SaR39Z4DXLknlp6z17dRyFkj2u6+8rUjLGLOknuXPP1/rTvVOi0CrAPioSVVAXMqh/Hn 34AdI9Pj4o+ttDPwjwG5J9WSVsGFFD4DhK9bZIJOkGq70pgvfUE2JaS/F/dSL0lmIa8B EcFw== X-Gm-Message-State: AOAM530y2SI4MCx58sYvhMP5dijIiLebu2cp2rtgDeurmufS2AcQQBzh 4pPdVC4l5ne7VRwRb4nvbvL0ho/qg2Wb/XuNpXk= X-Google-Smtp-Source: ABdhPJwA2ap8iGU0CnMG9FP6y7sJdT7T9RmUgwydwecrxnLPb2QiAMHfr6fWyq39JTuKyHzQJqftlQhqGl5URvcF9e4= X-Received: by 2002:a19:589:: with SMTP id 131mr16873562lff.525.1608984631415; Sat, 26 Dec 2020 04:10:31 -0800 (PST) MIME-Version: 1.0 References: <3d57a473-4025-890d-d365-6c2f82e7f513@netcologne.de> <0e1c519febec1c47c411339269455b9d@free.fr> <7e332e70-246e-b44e-7689-477642bf114c@netcologne.de> <23f5fbb548e75b1a5029162b31a8ddd7@free.fr> <522f101eda4e212f98f1f071165a46e5@free.fr> <79fdfc28ee95e21ba173dad5780b4e02@free.fr> <83bd1f02-712c-37d0-d570-076372c9c5ff@netcologne.de> <0fbe5cbc-9e99-6ec9-19df-faaa0b458216@netcologne.de> In-Reply-To: <0fbe5cbc-9e99-6ec9-19df-faaa0b458216@netcologne.de> From: Paul Richard Thomas Date: Sat, 26 Dec 2020 12:10:19 +0000 Message-ID: Subject: Re: Update on shared memory coarrays To: Thomas Koenig Cc: Nicolas Koenig , dhumieres.dominique@free.fr, "fortran@gcc.gnu.org" , Steve Kargl X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Dec 2020 12:10:34 -0000 Hi Thomas and Nicolas, The patch applied cleanly, as might be expected, but resulted in the following failures on FC3/x86_64 (plus assumed_type_9.f90): FAIL: gfortran.dg/caf-shared/atomic_1.f90 -pthread -fcoarray=shared -O2 -lcaf_shared -lrt execution test FAIL: gfortran.dg/caf-shared/image_index_2.f90 -pthread -fcoarray=shared -O2 -lcaf_shared -lrt execution test FAIL: gfortran.dg/caf-shared/this_image_2.f90 -pthread -fcoarray=shared -O2 -lcaf_shared -lrt execution test ......... FAIL: gfortran.dg/alloc_comp_deep_copy_1.f03 -O0 execution test FAIL: gfortran.dg/alloc_comp_deep_copy_1.f03 -O1 execution test FAIL: gfortran.dg/alloc_comp_deep_copy_1.f03 -O2 execution test FAIL: gfortran.dg/alloc_comp_deep_copy_1.f03 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test FAIL: gfortran.dg/alloc_comp_deep_copy_1.f03 -O3 -g execution test FAIL: gfortran.dg/alloc_comp_deep_copy_1.f03 -Os execution test This latter is failing at stop 66, stop 83, stop 153, stop 170. In these cases, if (.not. allocated(o2%vec(2)%ai)) is translated to: if ((*(struct innert[0:] * restrict) o2.vec.data)[0].ai == 0B) , which is manifestly incorrect. Oddly, at the next line if (o2%vec(2)%ai /= 7) is correctly translated to: if (*(*(struct innert[0:] * restrict) o2.vec.data)[o2.vec.offset + 2].ai != 7) This is caused by the following chunk in the patch: @@ -3934,6 +3933,15 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_expr *expr, decl = NULL_TREE; } + /* Early return - only taken for ALLOCATED for shared coarrays. + FIXME - this could probably be done more elegantly. */ + if (se->address_only) // CHANGING TO if (se->address_only && ar->codimen) FIXES PROBLEM + { + se->expr = build_array_ref (se->expr, build_int_cst (TREE_TYPE (offset), 0), + decl, se->class_vptr); + return; + } + se->expr = build_array_ref (se->expr, offset, decl, se->class_vptr); } I don't know if adding ar->codimen was what was intended. The origin of this is in: trans-intrinsic.c(gfc_conv_allocated), where the condition needs to check for array references: if (arg1->expr->rank == 0) { /* Allocatable scalar. */ arg1se.want_pointer = 1; arg1se.address_only = 1; Cheers Paul On Wed, 23 Dec 2020 at 10:47, Thomas Koenig wrote: > Hi everybody, > > after Nicolas' offlineOK, I have now committed the attached patch > to the branch. > > This should fix the test cases which are already committed > (hopefully...). And I did add a FIXME for something that should > be cleaned up at a later date. > > Regarding the failures that Steve reported, we'll try to reproduce > this using -m32 bits later - right now, Christmas is approching fast :-) > > Best regards > > Thomas > > > Add offset to allocatable shared coarrays. > > This adds the calculation of the offset for allocatable coarrays, > which was missing before, and fixes the resulting fallout for > ALLOCATED. Additionally, it prepares the way for STAT and ERRMSG > for ALLOCATE of coarrays, but that still needs changes to > gfc_trans_allocate. > > gcc/fortran/ChangeLog: > > * trans-array.c (gfc_conv_array_ref): If se->address_only is set, > throw away all the offset calculation. > (gfc_allocate_shared_coarray): Add arguments stat, errmsg and > errlen to call to allocate. Calculate offset for allocatable > coarrays. > (gfc_array_allocate): Adjust call to gfc_allocate_shared_coarray. > * trans-array.h (gfc_allocate_shared_coarray): Change prototype > of cas_coarray_alloc. > * trans-decl.c (gfc_build_builtin_function_decls): Adjust > cas_coarray_alloc to changed prototypes. > (gfc_trans_shared_coarray): Adjust call to > gfc_allocate_shared_coarray. > * trans-intrinsic.c (gfc_conv_allocated): Set address_only on se. > * trans.h: Add flag address_only to gfc_se. > > libgfortran/ChangeLog: > > * caf_shared/wrapper.c (cas_coarray_alloc): Add status, error and > errmsg arguments and their checking. > -- "If you can't explain it simply, you don't understand it well enough" - Albert Einstein