public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Richard Thomas <paul.richard.thomas@gmail.com>
To: Thomas Koenig <tkoenig@netcologne.de>
Cc: Nicolas Koenig <koenigni@student.ethz.ch>,
	dhumieres.dominique@free.fr,
	 "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
	Steve Kargl <sgk@troutmask.apl.washington.edu>
Subject: Re: Update on shared memory coarrays
Date: Sat, 26 Dec 2020 12:10:19 +0000	[thread overview]
Message-ID: <CAGkQGiJa_5S7As8UtQnhvMj5eC6W3ubSAfh+18qaWHn772nX5Q@mail.gmail.com> (raw)
In-Reply-To: <0fbe5cbc-9e99-6ec9-19df-faaa0b458216@netcologne.de>

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 <tkoenig@netcologne.de> 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

  reply	other threads:[~2020-12-26 12:10 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-29 19:09 dhumieres.dominique
2020-11-30  6:21 ` Thomas Koenig
2020-11-30 15:41   ` dhumieres.dominique
2020-11-30 22:13     ` Thomas Koenig
2020-12-02 17:41       ` dhumieres.dominique
2020-12-03  7:27         ` Thomas Koenig
2020-12-21 12:24           ` dhumieres.dominique
2020-12-21 13:04             ` Thomas Koenig
2020-12-22 12:28               ` dhumieres.dominique
2020-12-22 15:10                 ` Thomas Koenig
2020-12-22 16:12                   ` Paul Richard Thomas
2020-12-23  9:09                     ` Thomas Koenig
2020-12-23  9:38                       ` Paul Richard Thomas
2020-12-23 10:47                         ` Thomas Koenig
2020-12-26 12:10                           ` Paul Richard Thomas [this message]
2020-12-26 13:01                             ` Thomas Koenig
2020-12-27 15:38                             ` Thomas Koenig
2020-12-23 16:42                         ` Nicolas König
2020-12-23 17:25                   ` dhumieres.dominique
2020-12-27 17:10                     ` Nicolas König
2021-01-01 13:51                       ` dhumieres.dominique
2021-01-01 16:16                         ` Thomas Koenig
2021-01-01 16:41                           ` dhumieres.dominique
2021-01-02 20:45                             ` Thomas Koenig
2021-01-02 20:55                               ` Iain Sandoe
2021-01-02 21:43                                 ` Thomas Koenig
2021-01-02 22:37                                 ` Nicolas König
2021-01-02 21:44                                   ` Iain Sandoe
2021-01-02 22:09                                     ` Iain Sandoe
2021-01-03 10:46                                       ` Iain Sandoe
2021-01-03 14:54                                         ` Iain Sandoe
2021-01-03 15:42                                           ` Iain Sandoe
2021-01-03 21:53                                             ` Thomas Koenig
2021-01-04  2:34                                               ` Iain Sandoe
2021-01-04 18:54                                                 ` Nicolas König
2021-01-05 13:11                                                   ` Iain Sandoe
2021-01-05 13:23                                                     ` Iain Sandoe
2021-01-05 13:27                                                     ` Thomas Koenig
2021-01-05 13:34                                                       ` Iain Sandoe
2021-01-05 14:54                                                     ` Nicolas König
2021-01-05 14:28                                                       ` Iain Sandoe
2021-01-05 15:45                                                         ` Nicolas König
     [not found]                                                           ` <BAD6EA1D-BB9F-4905-ADD1-76FA1D6B9591@sandoe.co.uk>
2021-01-05 17:11                                                             ` Nicolas König
2021-01-06 16:56                                                               ` Iain Sandoe
  -- strict thread matches above, loose matches on Subject: below --
2020-11-29 13:10 Nicolas König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGkQGiJa_5S7As8UtQnhvMj5eC6W3ubSAfh+18qaWHn772nX5Q@mail.gmail.com \
    --to=paul.richard.thomas@gmail.com \
    --cc=dhumieres.dominique@free.fr \
    --cc=fortran@gcc.gnu.org \
    --cc=koenigni@student.ethz.ch \
    --cc=sgk@troutmask.apl.washington.edu \
    --cc=tkoenig@netcologne.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).