This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Introduce 4-stages profiledbootstrap to get a better profile.
- From: Martin Liška <mliska at suse dot cz>
- To: Markus Trippelsdorf <markus at trippelsdorf dot de>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Biener <richard dot guenther at gmail dot com>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Tue, 6 Jun 2017 15:30:01 +0200
- Subject: Re: [PATCH] Introduce 4-stages profiledbootstrap to get a better profile.
- Authentication-results: sourceware.org; auth=none
- References: <f61115af-55e1-8d59-545f-295f7e5b53cb@suse.cz> <20170529050407.GA15061@x4>
On 05/29/2017 07:04 AM, Markus Trippelsdorf wrote:
> On 2017.05.25 at 11:55 +0200, Martin Liška wrote:
>> Hi.
>>
>> As I spoke about the PGO with Honza and Richi, current 3-stage is not ideal for following
>> 2 reasons:
>>
>> 1) stageprofile compiler is train just on libraries that are built during stage2
>> 2) apart from that, as the compiler is also used to build the final compiler, profile
>> is being updated during the build. So the stage2 compiler is making different decisions.
>>
>> Both problems can be resolved by adding another step in between current stage2 and stage3
>> where we train stage2 compiler by building compiler with default options.
>
> Another issue that I've noticed is that LTO doesn't get used in the
> final stage (stagefeedback) with "bootstrap-O3 bootstrap-lto".
> It only is used during training. So either move -flto to stagefeedback,
> or use -flto both during training and during the final stage.
>
You're right, thus I'm suggesting to use -flto in all stages of PGO if 'make profiledbootstrap'
is invoked.
Martin
>From 77fb3302ef98548d37bf0f891ff09bca297f77fa Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Tue, 6 Jun 2017 11:23:38 +0200
Subject: [PATCH] Enable -flto in all PGO stages for
bootstrap-lto-{,noplugin}.mk.
config/ChangeLog:
2017-06-06 Martin Liska <mliska@suse.cz>
* bootstrap-lto-noplugin.mk: Enable -flto in all PGO stages.
* bootstrap-lto.mk: Likewise.
---
config/bootstrap-lto-noplugin.mk | 4 +++-
config/bootstrap-lto.mk | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/config/bootstrap-lto-noplugin.mk b/config/bootstrap-lto-noplugin.mk
index a5073365b5a..fc980d2bc17 100644
--- a/config/bootstrap-lto-noplugin.mk
+++ b/config/bootstrap-lto-noplugin.mk
@@ -3,4 +3,6 @@
STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects
STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects
-STAGEprofile_CFLAGS += -fno-lto
+STAGEprofile_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects
+STAGEtrain_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects
+STAGEfeedback_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects
diff --git a/config/bootstrap-lto.mk b/config/bootstrap-lto.mk
index 9e065e1d85a..50b86ef1c81 100644
--- a/config/bootstrap-lto.mk
+++ b/config/bootstrap-lto.mk
@@ -2,7 +2,9 @@
STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1
STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1
-STAGEprofile_CFLAGS += -fno-lto
+STAGEprofile_CFLAGS += -flto=jobserver -frandom-seed=1
+STAGEtrain_CFLAGS += -flto=jobserver -frandom-seed=1
+STAGEfeedback_CFLAGS += -flto=jobserver -frandom-seed=1
# assumes the host supports the linker plugin
LTO_AR = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ar$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/
--
2.13.0