public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Cesar Philippidis <cesar@codesourcery.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Fortran List <fortran@gcc.gnu.org>,
	"gcc-patches@gcc.gnu.org"	<gcc-patches@gcc.gnu.org>
Subject: Re: [gomp4] privatize internal array variables introduced by the fortran FE
Date: Tue, 13 Oct 2015 20:40:00 -0000	[thread overview]
Message-ID: <561D6C1F.10600@codesourcery.com> (raw)
In-Reply-To: <20151013202915.GN478@tucnak.redhat.com>

On 10/13/2015 01:29 PM, Jakub Jelinek wrote:
> On Tue, Oct 13, 2015 at 01:12:25PM -0700, Cesar Philippidis wrote:
>> Arrays in fortran have a couple of internal variables associated with
>> them, e.g. stride, lbound, ubound, size, etc. Depending on how and where
>> the array was declared, these internal variables may be packed inside an
>> array descriptor represented by a struct or defined individually. The
>> major problem with this is that kernels and parallel regions with
>> default(none) will generate errors if those internal variables are
>> defined individually since the user has no way to add clauses to them. I
>> suspect this is also true for arrays inside omp target regions.
> 
> I believe gfc_omp_predetermined_sharing is supposed to handle this,
> returning predetermined shared for certain DECL_ARTIFICIAL decls.
> If you are not using that hook, perhaps you should have similar one tuned
> for OpenACC purposes?

We do have one for openacc. I thought it's job was to mark variables as
firstprivate or pcopy as necessary. Anyway, it might be too late to call
gfc_omp_predetermined_sharing from the gimplifier from a performance
standpoint. Consider something like this:

  !$acc data copy (array)
  do i = 1,n
    !$acc parallel loop
     do j = 1,n
       ...array...
     end do
  end do
  !$acc end data

The problem here is that all of those internal variables would end up
getting marked as firstprivate. And that would cause more data to be
transferred to the accelerator. This patch reinitialized those variables
on the accelerator so they don't have to be transferred at all.

Cesar

  reply	other threads:[~2015-10-13 20:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 20:12 Cesar Philippidis
2015-10-13 20:29 ` Jakub Jelinek
2015-10-13 20:40   ` Cesar Philippidis [this message]
2015-10-14 11:51 ` Paul Richard Thomas
2016-01-13  1:50 ` [gomp4] arrays inside modules Cesar Philippidis
2019-01-25 14:19   ` [PATCH, OpenACC] Rework OpenACC Fortran DO loop initialization Gergö Barany
2019-01-28 20:15     ` Thomas Schwinge
2019-02-19 12:28     ` [PATCH, OpenACC, og8] Fix incorrect test case Gergö Barany
2020-11-13 22:06       ` Add 'libgomp.oacc-fortran/pr94358-1.f90' [PR94358] (was: [PATCH, OpenACC] Rework OpenACC Fortran DO loop initialization) Thomas Schwinge

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=561D6C1F.10600@codesourcery.com \
    --to=cesar@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.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).