* [Patch] nvptx/mkoffload.cc: Fix "$nohost" check
@ 2022-11-15 18:47 Tobias Burnus
0 siblings, 0 replies; only message in thread
From: Tobias Burnus @ 2022-11-15 18:47 UTC (permalink / raw)
To: gcc-patches, Jakub Jelinek
[-- Attachment #1: Type: text/plain, Size: 557 bytes --]
Found when working on real reverse offload - as
the reverse-offload stub function was added to the reverse-offload table.
Reason - as mentioned in the commit log: lhd_set_decl_assembler_name.
I intent to commit it tomorrow as obvious, unless there are further
comments.
Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
[-- Attachment #2: fix-nvptx-rev-off.diff --]
[-- Type: text/x-patch, Size: 1790 bytes --]
nvptx/mkoffload.cc: Fix "$nohost" check
If lhd_set_decl_assembler_name is invoked - in particular if
!TREE_PUBLIC (decl) && !DECL_FILE_SCOPE_P (decl) - the '.nohost' suffix
might change to '.nohost.2'. This happens for the existing reverse offload
testcases via cgraph_node::analyze and is a side effect of
r13-3455-g178ac530fe67e4f2fc439cc4ce89bc19d571ca31 for some reason.
The solution is to not only check for a tailing '$nohost' but also for
'$nohost$' in nvptx/mkoffload.cc.
gcc/ChangeLog:
* config/nvptx/mkoffload.cc (process): Recognize '$nohost$...'
besides tailing '$nohost' as being for reverse offload.
gcc/config/nvptx/mkoffload.cc | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gcc/config/nvptx/mkoffload.cc b/gcc/config/nvptx/mkoffload.cc
index 854cd72f3c7..5d89ba8a788 100644
--- a/gcc/config/nvptx/mkoffload.cc
+++ b/gcc/config/nvptx/mkoffload.cc
@@ -364,7 +364,8 @@ process (FILE *in, FILE *out, uint32_t omp_requires)
Alternatively, besides searching for 'BEGIN FUNCTION DECL',
checking for '.visible .entry ' + id->ptx_name would be
required. */
- if (!endswith (id->ptx_name, "$nohost"))
+ if (!endswith (id->ptx_name, "$nohost")
+ && !strstr (id->ptx_name, "$nohost$"))
continue;
fprintf (out, "\t\".extern ");
const char *p = input + file_idx[fidx];
@@ -402,7 +403,8 @@ process (FILE *in, FILE *out, uint32_t omp_requires)
"$offload_func_table[] = {");
for (comma = "", id = func_ids; id; comma = ",", id = id->next)
fprintf (out, "%s\"\n\t\t\"%s", comma,
- endswith (id->ptx_name, "$nohost") ? id->ptx_name : "0");
+ (endswith (id->ptx_name, "$nohost")
+ || strstr (id->ptx_name, "$nohost$")) ? id->ptx_name : "0");
fprintf (out, "};\\n\";\n\n");
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-15 18:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15 18:47 [Patch] nvptx/mkoffload.cc: Fix "$nohost" check Tobias Burnus
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).