> 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.

Thanks, this makes sense to me.  I wonder about quality of training.  One 
perofmrance
critical bit that does not get trained at all is LTO stremaing when you build 
non-LTO
compiler.  I guess we should add someting for that as that seems to be rather 
common
case. Similarly -O0 path may need bit of care.  But your changes seems 
improvement
over current state for sure.

What are the bootstrap times now?
Honza
> 
> Martin

> >From 77fb3302ef98548d37bf0f891ff09bca297f77fa Mon Sep 17 00:00:00 2001
> From: marxin <mli...@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  <mli...@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
> 

Reply via email to