From: Thomas Schwinge <thomas@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>, Robin Dapp <rdapp.gcc@gmail.com>,
<pan2.li@intel.com>, Richard Biener <richard.guenther@gmail.com>,
"Jakub Jelinek" <jakub@redhat.com>
Cc: <richard.sandiford@arm.com>, <kito.cheng@gmail.com>,
Jeff Law <jeffreyalaw@gmail.com>, <juzhe.zhong@rivai.ai>,
<yanzhang.wang@intel.com>
Subject: LTO: Get rid of 'lto_mode_identity_table' (was: Machine Mode ICE in RISC-V when LTO)
Date: Mon, 18 Sep 2023 16:46:29 +0200 [thread overview]
Message-ID: <87il87bku2.fsf@euler.schwinge.homeip.net> (raw)
In-Reply-To: <8c55be5d-3a6a-18bd-a054-072ecb28b949@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1039 bytes --]
Hi!
On 2023-09-15T15:33:59+0200, Robin Dapp <rdapp.gcc@gmail.com> wrote:
> is there anything we can do to assist from the riscv side in order to help
> with this? I haven't really been involved with it but was wondering
> what's missing. If I understand correctly Thomas has a major cleanup
> operation in plan
Not really major, but indeed non-trivial -- but WIP already. ;-)
> but might not get to it soon.
Right.
> The fix he proposed
> helps for the riscv case, however, even without the rework?
Right, and no harm done for my work.
> If so, I'd kindly ping Jakub to check if the fix is reasonable.
I'll push the attached "LTO: Get rid of 'lto_mode_identity_table'"
mid-week, unless any objections raised.
Grüße
Thomas
-----------------
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-LTO-Get-rid-of-lto_mode_identity_table.patch --]
[-- Type: text/x-diff, Size: 3264 bytes --]
From f88a923d7e3e26c29630f1b20624fa54032f8e96 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Thu, 10 Aug 2023 15:23:37 +0200
Subject: [PATCH] LTO: Get rid of 'lto_mode_identity_table'
This, in particular, resolves LTO ICEs with big 'machine_mode's, as for RISC-V.
('mode_table' in 'lto_file_decl_data' still is 'unsigned char'; changing that
is still to be done (for use in offloading compilation), but is not trivial.)
For now, get rid of 'lto_mode_identity_table' to resolve the RISC-V LTO ICEs;
we don't need an actual table for a 1-to-1 mapping.
gcc/lto/
* lto-common.cc (lto_mode_identity_table): Remove.
(lto_file_finalize) [!ACCEL_COMPILER]: 'NULL'-intialize
'file_data->mode_table'.
(lto_fe_init): Don't initialize 'lto_mode_identity_table'.
* lto-common.h (lto_mode_identity_table): Remove.
gcc/
* tree-streamer.h (bp_unpack_machine_mode): If
'ib->file_data->mode_table' not available, apply 1-to-1 mapping.
Co-authored-by: Pan Li <pan2.li@intel.com>
---
gcc/lto/lto-common.cc | 11 +----------
gcc/lto/lto-common.h | 1 -
gcc/tree-streamer.h | 5 ++++-
3 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc
index 703e665b698..ad6e7fde5ce 100644
--- a/gcc/lto/lto-common.cc
+++ b/gcc/lto/lto-common.cc
@@ -64,8 +64,6 @@ static bool type_streaming_finished = false;
GTY(()) tree first_personality_decl;
-GTY(()) const unsigned char *lto_mode_identity_table;
-
/* Returns a hash code for P. */
static hashval_t
@@ -2277,7 +2275,7 @@ lto_file_finalize (struct lto_file_decl_data *file_data, lto_file *file,
#ifdef ACCEL_COMPILER
lto_input_mode_table (file_data);
#else
- file_data->mode_table = lto_mode_identity_table;
+ file_data->mode_table = NULL;
file_data->mode_bits = ceil_log2 (MAX_MACHINE_MODE);
#endif
@@ -3118,13 +3116,6 @@ lto_fe_init (void)
memset (<o_stats, 0, sizeof (lto_stats));
bitmap_obstack_initialize (NULL);
gimple_register_cfg_hooks ();
-#ifndef ACCEL_COMPILER
- unsigned char *table
- = ggc_vec_alloc<unsigned char> (MAX_MACHINE_MODE);
- for (int m = 0; m < MAX_MACHINE_MODE; m++)
- table[m] = m;
- lto_mode_identity_table = table;
-#endif
}
#include "gt-lto-lto-common.h"
diff --git a/gcc/lto/lto-common.h b/gcc/lto/lto-common.h
index 24b2445673b..b9faa72e5cb 100644
--- a/gcc/lto/lto-common.h
+++ b/gcc/lto/lto-common.h
@@ -26,7 +26,6 @@ void print_lto_report_1 (void);
extern tree lto_eh_personality_decl;
extern GTY(()) vec<tree, va_gc> *tree_with_vars;
-extern const unsigned char *lto_mode_identity_table;
extern tree first_personality_decl;
#endif
diff --git a/gcc/tree-streamer.h b/gcc/tree-streamer.h
index ff49d1ba637..886ee6ac754 100644
--- a/gcc/tree-streamer.h
+++ b/gcc/tree-streamer.h
@@ -118,7 +118,10 @@ bp_unpack_machine_mode (struct bitpack_d *bp)
lto_input_block *ib = (class lto_input_block *) bp->stream;
int last = 1 << ib->file_data->mode_bits;
unsigned ix = bp_unpack_enum (bp, machine_mode, last);
- return (machine_mode) ib->file_data->mode_table[ix];
+ if (ib->file_data->mode_table)
+ return (machine_mode) ib->file_data->mode_table[ix];
+ else
+ return (machine_mode) ix;
}
#endif /* GCC_TREE_STREAMER_H */
--
2.34.1
next prev parent reply other threads:[~2023-09-18 14:46 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-12 5:00 [PATCH] Machine_Mode: Extend machine_mode from 8 to 16 bits pan2.li
2023-05-12 6:49 ` Richard Biener
2023-05-12 19:14 ` Bernhard Reutner-Fischer
2023-05-13 8:44 ` Kito Cheng
2023-05-13 12:26 ` Li, Pan2
2023-06-30 11:46 ` Adjust LTO mode tables for "Machine_Mode: Extend machine_mode from 8 to 16 bits" (was: [PATCH] Machine_Mode: Extend machine_mode from 8 to 16 bits) Thomas Schwinge
2023-06-30 12:45 ` Kito Cheng
2023-06-30 16:11 ` Thomas Schwinge
2023-06-30 16:37 ` Jakub Jelinek
2023-07-04 15:45 ` Thomas Schwinge
[not found] ` <MW5PR11MB590876BB7E52B78E837C95C9A913A@MW5PR11MB5908.namprd11.prod.outlook.com>
[not found] ` <CAFiYyc0Ajoi__g1YJhdrh-Z3DsOyU7+1iG6SEmZMDzAShX-L6g@mail.gmail.com>
[not found] ` <MW5PR11MB5908E5743F472D48ACF60039A913A@MW5PR11MB5908.namprd11.prod.outlook.com>
2023-08-10 13:23 ` Machine Mode ICE in RISC-V when LTO Thomas Schwinge
2023-08-10 14:14 ` Li, Pan2
2023-08-11 6:40 ` Li, Pan2
2023-09-15 13:33 ` Robin Dapp
2023-09-18 14:46 ` Thomas Schwinge [this message]
2023-09-18 14:53 ` LTO: Get rid of 'lto_mode_identity_table' (was: Machine Mode ICE in RISC-V when LTO) Richard Biener
2023-05-12 8:24 ` [PATCH] Machine_Mode: Extend machine_mode from 8 to 16 bits Richard Sandiford
2023-05-12 11:16 ` Li, Pan2
2023-05-12 11:31 ` Richard Sandiford
2023-05-12 11:48 ` Li, Pan2
2023-05-16 15:35 ` pan2.li
2023-05-18 8:57 ` Richard Sandiford
2023-05-18 9:17 ` Li, Pan2
[not found] <Message-Id: <20230512050016.476110-1-pan2.li@intel.com>
2023-05-12 15:38 ` [PATCH v2] " pan2.li
2023-05-13 13:13 ` [PATCH v3] " pan2.li
2023-05-16 1:12 ` Li, Pan2
2023-05-16 7:29 ` Richard Sandiford
2023-05-16 7:55 ` Li, Pan2
2023-05-16 8:03 ` Xi Ruoyao
2023-05-16 8:05 ` Li, Pan2
2023-05-16 9:09 ` Richard Sandiford
2023-05-16 12:17 ` Li, Pan2
2023-05-16 15:39 ` Li, Pan2
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=87il87bku2.fsf@euler.schwinge.homeip.net \
--to=thomas@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jeffreyalaw@gmail.com \
--cc=juzhe.zhong@rivai.ai \
--cc=kito.cheng@gmail.com \
--cc=pan2.li@intel.com \
--cc=rdapp.gcc@gmail.com \
--cc=richard.guenther@gmail.com \
--cc=richard.sandiford@arm.com \
--cc=yanzhang.wang@intel.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).