public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: Richard Biener <rguenther@suse.de>,
	Tobias Burnus <tobias@codesourcery.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
	Jakub Jelinek <jakub@redhat.com>, Jan Hubicka <hubicka@ucw.cz>
Subject: Re: [Patch] LTO: Force externally_visible for offload_vars/funcs (PR97179)
Date: Thu, 24 Sep 2020 11:41:00 +0200	[thread overview]
Message-ID: <731ae3cb-847c-6813-0d07-af835a54149c@codesourcery.com> (raw)
In-Reply-To: <nycvar.YFH.7.76.2009240953560.10073@p653.nepu.fhfr.qr>

On 9/24/20 10:03 AM, Richard Biener wrote:

>> The symbols are added to offload_vars + offload_funcs.
>> In lto-cgraph.c's output_offload_tables there is the last chance
>> to remove now unused nodes ? as once the tables are streamed
>> for device usage, they cannot be changed. Hence, there one
>> has
>>     node->force_output = 1;
>> [Unrelated: this prevents later optimizations, which still
>> could be done; cf. PR95622]
>>
>>
>> The table itself is written in omp-offload.c's omp_finish_file.
> But this is called at LTRANS time only, in particular we seem
> to stream the offload_funcs/vars array, marking streamed nodes
> as force_output but we do not make the offload table visible
> to the partitioner.  But force_output should make the
> nodes not renamed.  But then output_offload_tables is called at
> the very end and we likely do not stream the altered
> force_output state.
>
> So - can you try, in prune_offload_funcs, in addition to
> setting DECL_PRESERVE_P, mark the cgraph node ->force_output
> so this happens early?  I guess the same is needed for
> variables (there's no prune_offloar_vars ...).

As it accesses global variables, I could do just the same
with the variables – but it did not seems to have an effect.

Following Jakub's suggestion, I also added
   __attribute__((used))
to the tree belonging to both tables in omp-offload.c's omp_finish
but that did not help, either.

I think both the 'used' and 'force_output' are red herrings:
after all, the tables and the referrenced funcs/vars are output;
the problem is 'just' that they end up in different ltrans
while not being public. – Thus, some property ia wrong
during building the cgraph or when it is partitioned into ltrans.

Any additional suggestion to try?

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter

  reply	other threads:[~2020-09-24  9:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 12:53 [Patch] lto-wrapper.c: Use -flto-partition=none with offloading (PR97179) Tobias Burnus
2020-09-23 13:02 ` Jakub Jelinek
2020-09-23 13:09 ` Richard Biener
2020-09-23 13:10   ` Richard Biener
2020-09-23 14:23     ` [Patch] LTO: Force externally_visible for offload_vars/funcs (PR97179) (was: lto-wrapper.c: Use -flto-partition=none with offloading (PR97179)) Tobias Burnus
2020-09-23 15:47       ` [Patch] LTO: Force externally_visible for offload_vars/funcs (PR97179) Tobias Burnus
2020-09-23 21:29         ` Tobias Burnus
2020-09-24  7:03           ` Richard Biener
2020-09-24  7:47             ` Tobias Burnus
2020-09-24  8:03               ` Richard Biener
2020-09-24  9:41                 ` Tobias Burnus [this message]
2020-09-24  9:49                   ` Jakub Jelinek
2020-09-24  9:51                     ` Richard Biener
2020-09-24  9:50                   ` Richard Biener

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=731ae3cb-847c-6813-0d07-af835a54149c@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.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).