From patchwork Thu May 25 09:55:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 766913 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wYPmH323Jz9ryv for ; Thu, 25 May 2017 19:56:15 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="c2tCSCYS"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=FEdVDgoQ7I1SqOTqvNllfWGbp2HYJzPpW9d/fzy9IO5pCQeqpt WHP4wfGi+ST9jj0g9gLHao08Fle+zTukxgz7LE09sikNnYx3aFNM96XEVncl6CDs DXohSShhzNiap2m09ZfwauO85Hw+yi58cX3LhS1agCrwZVyZKDkdJBqKA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=9baFa3mLEqcBSu/xhhNRUJr5jy4=; b=c2tCSCYSflK5mcAfrk96 gFaeQh9sgY7L+A4vHPFaMKizH7FsLWm1F4Gdl2GlrMh954MZxGL6o7JPEwuqj64l Lqv0GzZG1DLyccoS67yDcbGQiIqgM5Fu7BM3WiOU/bHI9v9tvikUcg1kKgLwFnaj tHA3N4n+NPpxXpPpvhOfg0A= Received: (qmail 125912 invoked by alias); 25 May 2017 09:56:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 125860 invoked by uid 89); 25 May 2017 09:55:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=train, spoke, training X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 May 2017 09:55:58 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B163CAC0D; Thu, 25 May 2017 09:55:59 +0000 (UTC) To: GCC Patches Cc: Richard Biener , Jan Hubicka From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH] Introduce 4-stages profiledbootstrap to get a better profile. Message-ID: Date: Thu, 25 May 2017 11:55:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 X-IsSubscribed: yes 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 From 0a9c9a7f7d335e5e053ab37c5649371996e95325 Mon Sep 17 00:00:00 2001 From: marxin 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 * doc/install.texi: Document that PGO runs in 4 stages. ChangeLog: 2017-05-25 Martin Liska * 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