public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Introduce 4-stages profiledbootstrap to get a better profile.
@ 2017-05-25 10:00 Martin Liška
  2017-05-25 10:00 ` Martin Liška
                   ` (3 more replies)
  0 siblings, 4 replies; 32+ messages in thread
From: Martin Liška @ 2017-05-25 10:00 UTC (permalink / raw)
  To: GCC Patches; +Cc: Richard Biener, Jan Hubicka

[-- Attachment #1: Type: text/plain, Size: 589 bytes --]

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.

I'm going to do some measurements.

Ready for trunk?
Martin

[-- Attachment #2: 0001-Introduce-4-stages-profiledbootstrap-to-get-a-better.patch --]
[-- Type: text/x-patch, Size: 2954 bytes --]

From 0a9c9a7f7d335e5e053ab37c5649371996e95325 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Thu, 25 May 2017 11:35:29 +0200
Subject: [PATCH] Introduce 4-stages profiledbootstrap to get a better profile.

gcc/ChangeLog:

2017-05-25  Martin Liska  <mliska@suse.cz>

	* doc/install.texi: Document that PGO runs in 4 stages.

ChangeLog:

2017-05-25  Martin Liska  <mliska@suse.cz>

	* Makefile.def: Define 4 stages PGO bootstrap.
	* Makefile.tpl: Define FLAGS.
	* Makefile.in: Regenerate.
---
 Makefile.in          | 7 +++++--
 Makefile.tpl         | 7 +++++--
 gcc/doc/install.texi | 5 +++--
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index b824e0a0ca1..75e5a1a912b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -522,8 +522,11 @@ STAGE1_CONFIGURE_FLAGS = --disable-intermodule $(STAGE1_CHECKING) \
 STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate
 STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
 
-STAGEfeedback_CFLAGS = $(STAGE3_CFLAGS) -fprofile-use
-STAGEfeedback_TFLAGS = $(STAGE3_TFLAGS)
+STAGEtrain_CFLAGS = $(STAGE3_CFLAGS)
+STAGEtrain_TFLAGS = $(STAGE3_TFLAGS)
+
+STAGEfeedback_CFLAGS = $(STAGE4_CFLAGS) -fprofile-use
+STAGEfeedback_TFLAGS = $(STAGE4_TFLAGS)
 
 STAGEautoprofile_CFLAGS = $(STAGE2_CFLAGS) -g
 STAGEautoprofile_TFLAGS = $(STAGE2_TFLAGS)
diff --git a/Makefile.tpl b/Makefile.tpl
index d0fa07005be..5fcd7e358d9 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -455,8 +455,11 @@ STAGE1_CONFIGURE_FLAGS = --disable-intermodule $(STAGE1_CHECKING) \
 STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate
 STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
 
-STAGEfeedback_CFLAGS = $(STAGE3_CFLAGS) -fprofile-use
-STAGEfeedback_TFLAGS = $(STAGE3_TFLAGS)
+STAGEtrain_CFLAGS = $(STAGE3_CFLAGS)
+STAGEtrain_TFLAGS = $(STAGE3_TFLAGS)
+
+STAGEfeedback_CFLAGS = $(STAGE4_CFLAGS) -fprofile-use
+STAGEfeedback_TFLAGS = $(STAGE4_TFLAGS)
 
 STAGEautoprofile_CFLAGS = $(STAGE2_CFLAGS) -g
 STAGEautoprofile_TFLAGS = $(STAGE2_TFLAGS)
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index b13fc1f6f42..386771872ba 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2611,8 +2611,9 @@ bootstrap the compiler with profile feedback, use @code{make profiledbootstrap}.
 When @samp{make profiledbootstrap} is run, it will first build a @code{stage1}
 compiler.  This compiler is used to build a @code{stageprofile} compiler
 instrumented to collect execution counts of instruction and branch
-probabilities.  Then runtime libraries are compiled with profile collected.
-Finally a @code{stagefeedback} compiler is built using the information collected.
+probabilities.  Training run is done by building @code{stagetrain}
+compiler.  Finally a @code{stagefeedback} compiler is built
+using the information collected.
 
 Unlike standard bootstrap, several additional restrictions apply.  The
 compiler used to build @code{stage1} needs to support a 64-bit integral type.
-- 
2.12.2


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2018-07-20  8:43 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-25 10:00 [PATCH] Introduce 4-stages profiledbootstrap to get a better profile Martin Liška
2017-05-25 10:00 ` Martin Liška
2017-05-25 11:38 ` Markus Trippelsdorf
2017-05-25 16:28   ` Martin Liška
2017-05-29 15:11     ` Jan Hubicka
2017-05-29  5:14 ` Markus Trippelsdorf
2017-06-06 13:30   ` Martin Liška
2017-06-19 10:37     ` Jan Hubicka
2017-08-30 10:44       ` [RFC] Make 4-stage PGO bootstrap really working Martin Liška
2017-09-14 12:21         ` Martin Liška
2017-10-19 12:59           ` Martin Liška
2017-10-19 14:53             ` Markus Trippelsdorf
2017-10-25 12:43         ` Markus Trippelsdorf
2017-10-27 13:07           ` Martin Liška
2017-10-27 15:00             ` Markus Trippelsdorf
2017-10-30 11:08               ` Richard Biener
2017-10-27 13:17           ` [PATCH][OBVIOUS] Fix profiledbootstrap Martin Liška
2017-10-27 13:19 ` [PATCH] Append PWD to path when using -fprofile-generate=/some/path Martin Liška
2017-12-20 14:55   ` Martin Liška
2017-12-20 17:35   ` Martin Sebor
2017-12-20 17:45     ` Jakub Jelinek
2017-12-20 18:00       ` Martin Sebor
2017-12-21  9:13       ` Martin Liška
2017-12-21 16:30         ` Martin Sebor
2018-05-16 12:26         ` [PATCH] When using -fprofile-generate=/some/path mangle absolute path of file (PR lto/85759) Martin Liška
2018-06-20 11:54           ` Martin Liška
2018-06-22 20:35           ` Jeff Law
2018-06-29 14:38             ` Martin Liška
2018-07-02  8:51               ` Rainer Orth
2018-07-20  4:02               ` Bin.Cheng
2018-07-20  8:43                 ` Martin Liška
2018-07-03  9:39           ` Jonathan Wakely

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