public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Tobias Burnus <tobias@codesourcery.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>, fortran <fortran@gcc.gnu.org>
Subject: Re: [Patch] OpenMP: Fix 'omp declare target' handling for vars [PR99509]
Date: Fri, 12 Mar 2021 13:20:49 +0100	[thread overview]
Message-ID: <20210312122049.GT745611@tucnak> (raw)
In-Reply-To: <29dc3864-050b-a83d-4b64-3982e233bd4f@codesourcery.com>

On Wed, Mar 10, 2021 at 03:20:42PM +0100, Tobias Burnus wrote:
> The C/C++ FE sets for an 'omp declare target' ... 'omp end declare target'
> the attribute 'omp declare target implicit'.
> 
> That's later processed (for C++) in decl.c - which remove that attribute
> and either keeps and explicit 'omp declare target' or 'omp declare target link'
> attribute.
> 
> Unfortunately, adding 'omp declare target' comes too late as the varpool
> has been generated.

Looking attributes on every get rather than just once is IMHO too expensive.
For explicit declare target, we use:
          symtab_node *node = symtab_node::get (t);
          if (node != NULL)
            {
              node->offloadable = 1;
              if (ENABLE_OFFLOADING)
                {
                  g->have_offload = true;
                  if (is_a <varpool_node *> (node))
                    vec_safe_push (offload_vars, t);
                }
            }
(e.g. from cp/parser.c).
So, I think it would be better to do the same thing when we turn
an "omp declare target implicit" into "omp declare target", i.e. in
cp/decl.c (cp_finish_decl) and in c/c-decl.c (finish_decl) - right
after adding the "omp declare target" attribute in there.

	Jakub


  reply	other threads:[~2021-03-12 12:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 14:20 Tobias Burnus
2021-03-12 12:20 ` Jakub Jelinek [this message]
2021-03-15  8:17   ` Tobias Burnus
2021-03-15  8:20     ` Jakub Jelinek

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=20210312122049.GT745611@tucnak \
    --to=jakub@redhat.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tobias@codesourcery.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).