From: Tobias Burnus <tobias@codesourcery.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>, Jakub Jelinek <jakub@redhat.com>
Subject: Re: [Patch] LTO: Force externally_visible for offload_vars/funcs (PR97179)
Date: Wed, 23 Sep 2020 23:29:49 +0200 [thread overview]
Message-ID: <dc718fb1-fcb7-ab5e-6995-caf6cd997b47@codesourcery.com> (raw)
In-Reply-To: <26b07ad0-ba42-b2c6-2325-cad7360f8e2c@codesourcery.com>
[-- Attachment #1: Type: text/plain, Size: 1315 bytes --]
Actually working patch attached.
As mentioned, just using TREE_PUBLIC in input_offload_tables
works for functions but for variables this gets overridden.
The externally_visible is set to avoid running into the
promote_symbol code (→ visibility hidden) later in the
function.
On 9/23/20 5:47 PM, Tobias Burnus wrote:
> ...
> On 9/23/20 4:23 PM, Tobias Burnus wrote:
>> On 9/23/20 3:10 PM, Richard Biener wrote:
>>
>>> On Wed, 23 Sep 2020, Richard Biener wrote:
>>>> LTRANS usually makes the symbols hidden, not local.
>> Could also be – whatever the 'nm' output means.
>>>> So are you
>>>> sure this isn't a target bug (hidden symbols not implemented
>>>> but the host compiler obviously having checked that but assuming
>>>> the target behaves the same as the host) or a linker bug?
>>
>> Unlikely, I assume the Linux x86-64 linker is rather well tested.
>> As written this is the host – just the offloading symbol table is
>> device specific.
>>
>>> See lto/lto-partition.c:promote_symbol btw.
>>
>> Thanks for the pointer; it pointed me to node->externally_visible,
...
Tobias
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
[-- Attachment #2: lto-offload-v2.diff --]
[-- Type: text/x-patch, Size: 1361 bytes --]
LTO: Force externally_visible+tree_public for offload_vars/funcs (PR97179)
gcc/ChangeLog:
PR lto/97179
* lto-cgraph.c (input_offload_tables):
diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
index 8e0488a..52f4811 100644
--- a/gcc/lto/lto-partition.c
+++ b/gcc/lto/lto-partition.c
@@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-fnsummary.h"
#include "lto-partition.h"
#include "sreal.h"
+#include "omp-offload.h" /* For offload_funcs and offload_vars. */
vec<ltrans_partition> ltrans_partitions;
@@ -1120,6 +1121,7 @@ void
lto_promote_cross_file_statics (void)
{
unsigned i, n_sets;
+ tree decl;
gcc_assert (flag_wpa);
@@ -1135,6 +1137,20 @@ lto_promote_cross_file_statics (void)
part->encoder = compute_ltrans_boundary (part->encoder);
}
+ /* Ensure that all offload table referenced vars/funcs are available. */
+ if (offload_funcs)
+ FOR_EACH_VEC_ELT (*offload_funcs, i, decl)
+ {
+ cgraph_node::get (decl)->externally_visible = 1;
+ TREE_PUBLIC (decl) = 1;
+ }
+ if (offload_vars)
+ FOR_EACH_VEC_ELT (*offload_vars, i, decl)
+ {
+ varpool_node::get (decl)->externally_visible = 1;
+ TREE_PUBLIC (decl) = 1;
+ }
+
lto_clone_numbers = new hash_map<const char *, unsigned>;
/* Look at boundaries and promote symbols as needed. */
next prev parent reply other threads:[~2020-09-23 21:29 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 [this message]
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
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=dc718fb1-fcb7-ab5e-6995-caf6cd997b47@codesourcery.com \
--to=tobias@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--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).