From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6625 invoked by alias); 7 Jan 2019 17:37:48 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 6606 invoked by uid 89); 7 Jan 2019 17:37:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 spammy=tomorrow X-HELO: userp2120.oracle.com Received: from userp2120.oracle.com (HELO userp2120.oracle.com) (156.151.31.85) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 07 Jan 2019 17:37:44 +0000 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x07HTZfn036459; Mon, 7 Jan 2019 17:37:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=content-type : mime-version : subject : from : in-reply-to : date : cc : content-transfer-encoding : message-id : references : to; s=corp-2018-07-02; bh=q64yKjkgYP32ZkaB/M1hUAgVtp1KDgrogxv7Bvu9928=; b=ZGEVQbkpErnfqonop5izo6wAwCIbcqooHk+awZRik1UmkG/7fcLRJypzr2X3uu1lXz0Z NSNzAzJOVDfkUje0YHW41+lLON93SEY6CFgbTayBySUkifpPx9sT6sFWPsxJKgZ2ycJ8 kjCcSrRLpVC+FYXoBQ3W3aLvFmo4ex6zuneQpiM3hZqd2V6/Y9vCYb023wuyruu4Ognq k/MMIvsYfWlj4VwhFMXQdU9mQ5Gjdt+yB6QakfAvPpOJGSwM0p/+V8dzfZW31JW92HBF X6khRBn1kgi41Es1IlTUSH1irH8Ezm/z2r+UaYWuXlHgCWjvbbeO23hSW5g1auc/QiWV rw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2ptn7qq0cd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 07 Jan 2019 17:37:41 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x07HbeGB030120 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 7 Jan 2019 17:37:40 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x07HbefP018113; Mon, 7 Jan 2019 17:37:40 GMT Received: from dhcp-10-159-139-188.vpn.oracle.com (/10.159.139.188) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 07 Jan 2019 09:37:40 -0800 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: Remove overall growth from badness metrics From: Qing Zhao In-Reply-To: <20190106235208.tqx4jqylljlbk3gk@kam.mff.cuni.cz> Date: Mon, 07 Jan 2019 17:37:00 -0000 Cc: gcc-patches@gcc.gnu.org Content-Transfer-Encoding: quoted-printable Message-Id: <5ECDB2A8-9A03-4D59-BECD-4D4BB7D4BE4D@oracle.com> References: <20190106235208.tqx4jqylljlbk3gk@kam.mff.cuni.cz> To: Jan Hubicka X-IsSubscribed: yes X-SW-Source: 2019-01/txt/msg00325.txt.bz2 > On Jan 6, 2019, at 5:52 PM, Jan Hubicka wrote: >=20 > Hi, > this patch removes overall growth from badness metrics. This code was > added at a time inliner was purely function size based to give a hint > that inlining more different functions into all callers is better than > inlining one called very many times. >=20 > With profile we now have more fine grained information and in all > tests I did this heuristics seems to be counter-productive now and > harmful especially on large units where growth estimate gets out of > date. >=20 > I plan to commit the patch tomorrow after re-testing everything after > the bugfixes from today and yesterday. In addition to this have found > that current inline-unit-growth is too small for LTO of large programs > (especially Firefox:) and there are important improvements when > increased from 20 to 30 or 40. I am re-running C++ benchmarks and other > tests to decide about precise setting. Finally I plan to increase > the new parameters for bit more inlining at -O2 and -Os. Usually increasing these parameters might increase the compilation time and= the=20 final code size, do you have any data for compilation time and code size im= pact from these parameter change? thanks. Qing >=20 > Bootstrapped/regtested x86_64-linux, will commit it tomorrow. >=20 > * ipa-inline.c (edge_badness): Do not account overall_growth into > badness metrics. > Index: ipa-inline.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- ipa-inline.c (revision 267612) > +++ ipa-inline.c (working copy) > @@ -1082,8 +1082,8 @@ edge_badness (struct cgraph_edge *edge, > /* When profile is available. Compute badness as: >=20 > time_saved * caller_count > - goodness =3D ------------------------------------------------- > - growth_of_caller * overall_growth * combined_size > + goodness =3D -------------------------------- > + growth_of_caller * combined_size >=20 > badness =3D - goodness >=20 > @@ -1094,7 +1094,6 @@ edge_badness (struct cgraph_edge *edge, > || caller->count.ipa ().nonzero_p ()) > { > sreal numerator, denominator; > - int overall_growth; > sreal inlined_time =3D compute_inlined_call_time (edge, edge_time); >=20 > numerator =3D (compute_uninlined_call_time (edge, unspec_edge_time) > @@ -1106,73 +1105,6 @@ edge_badness (struct cgraph_edge *edge, > else if (caller->count.ipa ().initialized_p ()) > numerator =3D numerator >> 11; > denominator =3D growth; > - > - overall_growth =3D callee_info->growth; > - > - /* Look for inliner wrappers of the form: > - > - inline_caller () > - { > - do_fast_job... > - if (need_more_work) > - noninline_callee (); > - } > - Withhout panilizing this case, we usually inline noninline_callee > - into the inline_caller because overall_growth is small preventing > - further inlining of inline_caller. > - > - Penalize only callgraph edges to functions with small overall > - growth ... > - */ > - if (growth > overall_growth > - /* ... and having only one caller which is not inlined ... */ > - && callee_info->single_caller > - && !edge->caller->global.inlined_to > - /* ... and edges executed only conditionally ... */ > - && edge->sreal_frequency () < 1 > - /* ... consider case where callee is not inline but caller is ... */ > - && ((!DECL_DECLARED_INLINE_P (edge->callee->decl) > - && DECL_DECLARED_INLINE_P (caller->decl)) > - /* ... or when early optimizers decided to split and edge > - frequency still indicates splitting is a win ... */ > - || (callee->split_part && !caller->split_part > - && edge->sreal_frequency () * 100 > - < PARAM_VALUE > - (PARAM_PARTIAL_INLINING_ENTRY_PROBABILITY) > - /* ... and do not overwrite user specified hints. */ > - && (!DECL_DECLARED_INLINE_P (edge->callee->decl) > - || DECL_DECLARED_INLINE_P (caller->decl))))) > - { > - ipa_fn_summary *caller_info =3D ipa_fn_summaries->get (caller); > - int caller_growth =3D caller_info->growth; > - > - /* Only apply the penalty when caller looks like inline candidate, > - and it is not called once and. */ > - if (!caller_info->single_caller && overall_growth < caller_growth > - && caller_info->inlinable > - && caller_info->size > - < (DECL_DECLARED_INLINE_P (caller->decl) > - ? MAX_INLINE_INSNS_SINGLE : MAX_INLINE_INSNS_AUTO)) > - { > - if (dump) > - fprintf (dump_file, > - " Wrapper penalty. Increasing growth %i to %i\n", > - overall_growth, caller_growth); > - overall_growth =3D caller_growth; > - } > - } > - if (overall_growth > 0) > - { > - /* Strongly preffer functions with few callers that can be inlined > - fully. The square root here leads to smaller binaries at average. > - Watch however for extreme cases and return to linear function > - when growth is large. */ > - if (overall_growth < 256) > - overall_growth *=3D overall_growth; > - else > - overall_growth +=3D 256 * 256 - 256; > - denominator *=3D overall_growth; > - } > denominator *=3D ipa_fn_summaries->get (caller)->self_size + growth; >=20 > badness =3D - numerator / denominator; > @@ -1182,18 +1114,14 @@ edge_badness (struct cgraph_edge *edge, > fprintf (dump_file, > " %f: guessed profile. frequency %f, count %" PRId64 > " caller count %" PRId64 > - " time w/o inlining %f, time with inlining %f" > - " overall growth %i (current) %i (original)" > - " %i (compensated)\n", > + " time w/o inlining %f, time with inlining %f\n", > badness.to_double (), > edge->sreal_frequency ().to_double (), > edge->count.ipa ().initialized_p () ? edge->count.ipa ().to_gcov_typ= e () : -1, > caller->count.ipa ().initialized_p () ? caller->count.ipa ().to_gcov= _type () : -1, > compute_uninlined_call_time (edge, > unspec_edge_time).to_double (), > - inlined_time.to_double (), > - estimate_growth (callee), > - callee_info->growth, overall_growth); > + inlined_time.to_double ()); > } > } > /* When function local profile is not available or it does not give