From patchwork Mon Jun 3 01:21:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dehao Chen X-Patchwork-Id: 248151 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 438B52C009D for ; Mon, 3 Jun 2013 11:21:44 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=ES/Oa+/nz34xn3/XDd Oymec6jwLvb6emfGrq0l3L2WYI6o27DAvKilmvavFg2M8GsOm61rS9xrpyY4MZ52 +D4c1SeRNEtmBEWB70yblHXFOHeMHgnGxo6lFerg0SBhQVho1vVU4tE8nb2GrGq1 UB2Ic1yO2yRLJ9cn5P0xGVIoQ= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=+S57xmixGvoWDNNgNVmFpwmE J8Q=; b=CkS/DxJaac6XNMST2jr3v5hrUYb1N6/AuUntsn43cyhb4oMLWUKgBIbI I/f5y0Zv0cuF1pgsHLgoukxVtu3mE5ml/Gae86dq6BZxD2I8409M13K2eZykJO5X wufPCYkZ81cUfZ4gPHscqceQv+mKXNPCAXSMBfMmjWY2MI41UVQ= Received: (qmail 11061 invoked by alias); 3 Jun 2013 01:21:37 -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 11032 invoked by uid 89); 3 Jun 2013 01:21:31 -0000 X-Spam-SWARE-Status: No, score=-4.3 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.1 Received: from mail-ea0-f182.google.com (HELO mail-ea0-f182.google.com) (209.85.215.182) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 03 Jun 2013 01:21:30 +0000 Received: by mail-ea0-f182.google.com with SMTP id r16so2988539ead.41 for ; Sun, 02 Jun 2013 18:21:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=LSASUSuh3HevRCkWiepyFd/9zb40xDdrj/GX/Q1dMpQ=; b=gYuGNzcKSdFiz8pw7hh8MVqEL93bICC0g4H7f5N7DaTNxLBLkA992M0isyg1Sapr8c +sEInN9NISy0YoTwqSCUnLXq9aYL9XIhdVud9UJ2iaOx+imcy7KNzozaBAk2BQkDZnMD Z2/e4bwchJ1Zkyt9Rx5KkitqunTikc+c0qSXoIq+Buy2PodNI2YzNCnNKPrSsEfkuuSA +IJVcWCcxLhIg/iIYE/MjaiXPUrcd5tR+fFhnOQ0hAz3pEwOYuBLMZsNu9OLJotONlDk SlVuuo1+kESpIw3aaQUXUJ8tSxk5PpOL9V1vGjID7Vn/D/cnhWb3EUjPo57ptw/3FsHd 3DBg== MIME-Version: 1.0 X-Received: by 10.14.209.5 with SMTP id r5mr21523383eeo.112.1370222487695; Sun, 02 Jun 2013 18:21:27 -0700 (PDT) Received: by 10.14.220.9 with HTTP; Sun, 2 Jun 2013 18:21:27 -0700 (PDT) In-Reply-To: References: Date: Sun, 2 Jun 2013 18:21:27 -0700 Message-ID: Subject: Re: [GOOGLE] Unrestrict early inline restrictions for AutoFDO From: Dehao Chen To: Xinliang David Li Cc: GCC Patches , Teresa Johnson X-Gm-Message-State: ALoCoQk/WeNEBXLu3dRxmYDeuHifsUt6D3TN3fTmhcWSJ0y8uUv7fHEkqYMMDY43JYskksstYygxphhzJbZyl+naGWDH3CVzJg1IRMD/AhTucuOBi6Cl4lxc/FFy54FnWkZy70ggTSg0mVDktkxlsYlnWfrgfEI/jkyVATIerjPniCmYY4lWLVacmcCnP4n06JcgkhHBQID1 The patch was committed to google-4_8, but it causes problem because einline sets PARAM_EARLY_INLINING_INSNS = 11. This will cause recursive inlining at einline stage (e.g. main->foo, foo->bar, bar->foo) when autofdo is enabled. The following patch can fix the problem by doing more targetted early inlining: Performance testing on-going... Dehao On Wed, May 29, 2013 at 3:44 PM, Dehao Chen wrote: > OK, I'll commit the early inline part. > > Dehao > > On Wed, May 29, 2013 at 10:00 AM, Xinliang David Li wrote: >> The early inlining part is ok. The tracer optimization should be >> revisited -- we should have more fine grain control on it (for >> instance, based on FDO summary -- but that should be common to >> FDO/LIPO). >> >> David >> >> On Wed, May 29, 2013 at 9:39 AM, Dehao Chen wrote: >>> In gcc4-8, the max einline iterations are restricted to 1. For >>> AutoFDO, this is bad because early inline is not size restricted. This >>> patch allows einline to do multiple iterations in AutoFDO. It also >>> enables tracer optimization in AutoFDO. >>> >>> Bootstrapped and passed regression test. >>> >>> OK for googel-4_8? >>> >>> Thanks, >>> Dehao >>> >>> Index: gcc/ipa-inline.c >>> =================================================================== >>> --- gcc/ipa-inline.c (revision 199416) >>> +++ gcc/ipa-inline.c (working copy) >>> @@ -2161,7 +2161,8 @@ early_inliner (void) >>> { >>> /* We iterate incremental inlining to get trivial cases of indirect >>> inlining. */ >>> - while (iterations < PARAM_VALUE (PARAM_EARLY_INLINER_MAX_ITERATIONS) >>> + while ((flag_auto_profile >>> + || iterations < PARAM_VALUE (PARAM_EARLY_INLINER_MAX_ITERATIONS)) >>> && early_inline_small_functions (node)) >>> { >>> timevar_push (TV_INTEGRATION); >>> Index: gcc/opts.c >>> =================================================================== >>> --- gcc/opts.c (revision 199416) >>> +++ gcc/opts.c (working copy) >>> @@ -1644,6 +1644,8 @@ common_handle_option (struct gcc_options *opts, >>> opts->x_flag_peel_loops = value; >>> if (!opts_set->x_flag_value_profile_transformations) >>> opts->x_flag_value_profile_transformations = value; >>> + if (!opts_set->x_flag_tracer) >>> + opts->x_flag_tracer = value; >>> if (!opts_set->x_flag_inline_functions) >>> opts->x_flag_inline_functions = value; >>> if (!opts_set->x_flag_ipa_cp) Index: gcc/predict.c =================================================================== --- gcc/predict.c (revision 199593) +++ gcc/predict.c (working copy) @@ -175,6 +175,8 @@ cgraph_maybe_hot_edge_p (struct cgraph_edge *edge) && !maybe_hot_count_p (NULL, edge->count)) return false; + if (flag_auto_profile) + return false; if (edge->caller->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED || (edge->callee && edge->callee->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED))