public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <burnus@net-b.de>
To: Ilmir Usmanov <i.usmanov@samsung.com>
Cc: Thomas Schwinge <thomas@codesourcery.com>,
	 Evgeny Gavrin <e.gavrin@samsung.com>,
	GarbuzovViacheslav <v.garbuzov@samsung.com>,
	 Dmitri Botcharnikov <dmitry.b@samsung.com>,
	gcc-patches@gcc.gnu.org, jakub@redhat.com, fortran@gcc.gnu.org
Subject: Re: [PATCH 2/4] [GOMP4] [Fortran] OpenACC 1.0+ support in fortran front-end
Date: Sat, 08 Mar 2014 19:55:00 -0000	[thread overview]
Message-ID: <531B73F8.1030206@net-b.de> (raw)
In-Reply-To: <5319A358.7040207@samsung.com>

[Resend as it was initially HTML - sorry for those who are CCed.]

Ilmir Usmanov wrote:
> OpenACC 1.0 fortran FE support -- matching and resolving.

> +gfc_match_oacc_cache (void)
> +{
...
> +  if (gfc_current_state() != COMP_DO)
>       {
> -      gfc_free_omp_clauses (c);
> +      gfc_error ("ACC CACHE directive must be inside of loop %C");
> +      gfc_free_omp_clauses(c);
>         return MATCH_ERROR;
>       }

Shouldn't it also be supported in DO CONCURRENT? The following is 
currently rejected:

real :: b
!$acc loop
outer: do concurrent(i=1:5)
!$acc cache(b)
end do outer
end

(Side question: Is !$acc permitted in DO ... WHILE? If so, you need to 
also add EXEC_DO_WHILE.)

> +static void
> +resolve_oacc_positive_int_expr (gfc_expr *expr, const char *clause)
> +{
> +  resolve_oacc_scalar_int_expr (expr, clause);
> +  if (expr->expr_type == EXPR_CONSTANT && expr->ts.type == BT_INTEGER
> +      && expr->value.integer->_mp_size <= 0)
> +    gfc_warning ("INTEGER expression of %s clause at %L must be positive",
> +		     clause, &expr->where);

You shouldn't access internal variables of mpz_t. Use mpz_sgn() instead: 
https://gmplib.org/manual/Integer-Comparisons.html

> +  if ((sym->ts.type == BT_ASSUMED && sym->attr.pointer)
> +      || (sym->ts.type == BT_ASSUMED && CLASS_DATA (sym)
> +	  && CLASS_DATA (sym)->attr.pointer))

The second line should use BT_CLASS instead of BT_ASSUMED.


> +    gfc_error ("POINTER object '%s' of polymorphic type in %s clause at %L",
> +	       sym->name, name, &loc);
> +  if ((sym->ts.type == BT_ASSUMED && sym->attr.cray_pointer)
> +      || (sym->ts.type == BT_ASSUMED && CLASS_DATA (sym)
> +	  && CLASS_DATA (sym)->attr.cray_pointer))

Ditto.

> +    gfc_error ("Cray pointer object of polymorphic type '%s' in %s clause at %L",
> +	       sym->name, name, &loc);
> +  if ((sym->ts.type == BT_ASSUMED && sym->attr.cray_pointee)
> +      || (sym->ts.type == BT_ASSUMED && CLASS_DATA (sym)
> +	  && CLASS_DATA (sym)->attr.cray_pointee))
> +    gfc_error ("Cray pointee object of polymorphic type '%s' in %s clause at %L",
> +	       sym->name, name, &loc);

Ditto.


> +static void
> +check_array_not_assumed (gfc_symbol *sym, locus loc, const char *name)
> +{
> +  if (sym->as && sym->as->type == AS_ASSUMED_SIZE)
> +    gfc_error ("Assumed size array '%s' in %s clause at %L",
> +	       sym->name, name, &loc);
> +  if (sym->as && sym->as->type == AS_ASSUMED_SHAPE)
> +    gfc_error ("Assumed shape array '%s' in %s clause at %L",
> +	       sym->name, name, &loc);
> +  if (sym->as && sym->as->type == AS_ASSUMED_RANK)
> +    gfc_error ("Assumed rank array '%s' in %s clause at %L",
> +	       sym->name, name, &loc);
> +}

Actually, I wonder whether one needs to reject assumed-shape: I don't 
know what OpenACC says, but my impression is that the problem is that 
those can be noncontiguous. However, if they are marked as contiguous 
["attr.contiguous"] Â…


On the other hand, your code seems to permit deferred-shape arrays like:

real, pointer :: b(:)
!$acc data copyin(b)
end

The problem is that pointers to deferred-shape arrays can be 
noncontiguous. But deferred-shape array are always contiguous when they 
are either attr.allocatable or have the "attr.contiguous" attribute.


> +  if ((sym->ts.type == BT_ASSUMED && sym->attr.allocatable)
> +      || (sym->ts.type == BT_ASSUMED && CLASS_DATA (sym)
> +	  && CLASS_DATA (sym)->attr.allocatable))
As above: BT_CLASS in the second line.

> +resolve_oacc_deviceptr_clause (gfc_symbol *sym, locus loc, const char *name)
> +{
> +  if (sym->ts.type == BT_DERIVED && sym->attr.allocatable)
> +    gfc_error ("ALLOCATABLE object '%s' of derived type in %s clause at %L",
> +	       sym->name, name, &loc);
> +  if ((sym->ts.type == BT_ASSUMED && sym->attr.allocatable)
> +      || (sym->ts.type == BT_ASSUMED && CLASS_DATA (sym)
> +	  && CLASS_DATA (sym)->attr.allocatable))
Ditto.

> +    gfc_error ("ALLOCATABLE object '%s' of polymorphic type "
> +	       "in %s clause at %L", sym->name, name, &loc);
> +  if (sym->attr.pointer)
> +    gfc_error ("POINTER object '%s' in %s clause at %L",
> +	       sym->name, name, &loc);

Shouldn't you also add

|| (sym->ts.type == BT_CLASS && CLASS_DATA (sym) + && CLASS_DATA 
(sym)->attr.class_pointer)

here?

> +	  case OMP_LIST_USE_DEVICE:
> +	      if (n->sym->attr.allocatable)
> +		gfc_error ("ALLOCATABLE object '%s' in %s clause at %L",
> +			   n->sym->name, name, &code->loc);
> +	      if (n->sym->attr.pointer)
> +		gfc_error ("POINTER object '%s' in %s clause at %L",
> +			   n->sym->name, name, &code->loc);

Do you also need to handle BT_CLASS here for allocatable/pointer?


Otherwise, it looks good to me.

Tobias

  parent reply	other threads:[~2014-03-08 19:48 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-23 18:01 [PATCH] [GOMP4] " Ilmir Usmanov
2014-01-23 18:03 ` [PATCH 1/6] " Ilmir Usmanov
2014-01-23 18:03   ` [PATCH 2/6] " Ilmir Usmanov
2014-01-23 18:04     ` [PATCH 3/6] " Ilmir Usmanov
2014-01-23 18:05       ` [PATCH 4/6] " Ilmir Usmanov
2014-01-23 18:05         ` [PATCH 5/6] " Ilmir Usmanov
2014-01-23 18:06           ` [PATCH 6/6] " Ilmir Usmanov
2014-01-23 18:09             ` [PATCH 7/6] " Ilmir Usmanov
2014-01-24 19:33         ` [PATCH 4/6] " Thomas Schwinge
2014-11-05 16:29           ` [gomp4] OpenACC cache directive for C Thomas Schwinge
2014-11-05 16:36             ` [gomp4] OpenACC cache directive maintenance (was: [PATCH 4/6] [GOMP4] OpenACC 1.0+ support in fortran front-end) Thomas Schwinge
2014-11-05 16:45               ` [gomp4] OpenACC cache directive maintenance Thomas Schwinge
2015-10-27 15:26                 ` [PR fortran/63865] OpenACC cache directive: match Fortran support with C/C++ (was: [gomp4] OpenACC cache directive maintenance) Thomas Schwinge
2015-10-27 15:30                   ` Jakub Jelinek
2015-10-27 17:03                     ` [PR fortran/63865] OpenACC cache directive: match Fortran support with C/C++ Thomas Schwinge
2014-11-05 16:49             ` [gomp4] Testing of C/C++ OpenACC cache directive (was: OpenACC cache directive for C) Thomas Schwinge
2016-06-02 11:47             ` [PR c/71381] C/C++ OpenACC cache directive rejects valid syntax (was: [gomp4] OpenACC cache directive for C.) Thomas Schwinge
2016-06-08 13:29               ` [PING] [PR c/71381] C/C++ OpenACC cache directive rejects valid syntax Thomas Schwinge
2016-06-08 14:07                 ` Jakub Jelinek
2016-06-10 10:32                   ` Thomas Schwinge
2016-06-10 13:14                     ` Thomas Schwinge
2016-06-10 20:40                       ` Gerald Pfeifer
2014-01-24 20:47     ` [PATCH 2/6] [GOMP4] OpenACC 1.0+ support in fortran front-end Thomas Schwinge
2014-01-24 20:31   ` [PATCH 1/6] " Thomas Schwinge
2014-01-27 19:37     ` Tobias Burnus
2014-01-24 18:04 ` [PATCH] " Thomas Schwinge
2014-01-27 13:12   ` Ilmir Usmanov
2014-01-27 15:49     ` Thomas Schwinge
2014-01-27 16:35       ` Ilmir Usmanov
2014-01-31 11:14       ` Ilmir Usmanov
2014-01-31 11:16         ` [PATCH 1/6] " Ilmir Usmanov
2014-01-31 11:17           ` [PATCH 2/6] " Ilmir Usmanov
2014-01-31 11:18             ` [PATCH 3/6] " Ilmir Usmanov
2014-01-31 11:22               ` [PATCH 4/6] " Ilmir Usmanov
2014-01-31 11:34                 ` [PATCH 5/6] " Ilmir Usmanov
2014-01-31 11:45                   ` [PATCH 6/6] " Ilmir Usmanov
2014-02-09 23:43                   ` [PATCH 5/6] " Tobias Burnus
2014-02-10  8:52                     ` Thomas Schwinge
2014-02-10  9:34                       ` Ilmir Usmanov
2014-02-10 23:13                       ` Tobias Burnus
2014-02-10  9:45                     ` Ilmir Usmanov
2014-02-10 10:52                       ` Thomas Schwinge
2014-02-11 16:51                 ` [PATCH 4/6] " Thomas Schwinge
2014-02-13 13:15                   ` Ilmir Usmanov
2014-02-13 14:57                     ` Thomas Schwinge
2014-02-14  5:45                       ` Ilmir Usmanov
2014-02-21 19:29                   ` [GOMP4] gimple_code_is_oacc -> is_gimple_omp_oacc_specifically (was: [PATCH 4/6] [GOMP4] OpenACC 1.0+ support in fortran front-end) Thomas Schwinge
2014-02-09 23:24               ` [PATCH 3/6] [GOMP4] OpenACC 1.0+ support in fortran front-end Tobias Burnus
2014-02-09 23:10             ` [PATCH 2/6] " Tobias Burnus
2014-02-10  9:10               ` Thomas Schwinge
2014-02-19 16:43               ` Ilmir Usmanov
2014-01-31 12:00           ` [PATCH 1/6] " Jakub Jelinek
2014-01-31 12:33             ` Ilmir Usmanov
2014-02-03 15:21               ` [PING] " Ilmir Usmanov
2014-02-09 22:22           ` Tobias Burnus
2014-02-19 15:34             ` Ilmir Usmanov
2014-02-19 23:52               ` Tobias Burnus
2014-02-20  8:19                 ` Ilmir Usmanov
2014-03-04  7:56                   ` [PATCH 1/4] [GOMP4] [Fortran] " Ilmir Usmanov
2014-03-04  7:57                     ` Ilmir Usmanov
2014-03-04  7:57                       ` [PATCH 2/4] " Ilmir Usmanov
2014-03-04  7:58                         ` [PATCH 3/4] " Ilmir Usmanov
2014-03-04  7:59                           ` [PATCH 4/4] " Ilmir Usmanov
2014-03-04 22:56                             ` Tobias Burnus
2014-03-04 22:52                           ` [PATCH 3/4] " Tobias Burnus
2014-03-04 17:20                       ` [PATCH 1/4] " Tobias Burnus
2014-03-07 10:44                         ` Ilmir Usmanov
2014-03-07 10:45                           ` Ilmir Usmanov
2014-03-07 10:46                             ` [PATCH 2/4] " Ilmir Usmanov
2014-03-07 10:46                               ` [PATCH 3/4] " Ilmir Usmanov
2014-03-07 10:47                                 ` [PATCH 4/4] " Ilmir Usmanov
2014-03-08 17:55                                   ` Tobias Burnus
2014-03-20 10:53                                   ` Thomas Schwinge
2014-03-20 12:48                                     ` Ilmir Usmanov
2014-03-20 14:43                                     ` Jakub Jelinek
2014-03-08 17:19                                 ` [PATCH 3/4] " Tobias Burnus
2014-03-08 19:55                               ` Tobias Burnus [this message]
2014-03-11 12:04                                 ` [PATCH 2/4] " Ilmir Usmanov
2014-03-12 18:46                                   ` Tobias Burnus
2014-03-12 18:27                             ` [PATCH 1/4] " Tobias Burnus
2014-03-13  9:41                               ` Ilmir Usmanov
2014-03-13 11:43                                 ` Thomas Schwinge
2014-03-13 13:24                                   ` Ilmir Usmanov
2014-03-13 14:13                                     ` Ilmir Usmanov
2014-03-16 19:46                                       ` Tobias Burnus
2014-03-16 20:44                                         ` Thomas Schwinge
2014-04-05 10:40                                         ` Thomas Schwinge
2014-03-10 15:44                           ` Thomas Schwinge
2014-03-04 17:42                       ` Tobias Burnus

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=531B73F8.1030206@net-b.de \
    --to=burnus@net-b.de \
    --cc=dmitry.b@samsung.com \
    --cc=e.gavrin@samsung.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=i.usmanov@samsung.com \
    --cc=jakub@redhat.com \
    --cc=thomas@codesourcery.com \
    --cc=v.garbuzov@samsung.com \
    /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).