public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: gcc-patches@gcc.gnu.org
Subject: Another tweak of inline badness metric
Date: Fri, 03 Apr 2015 20:21:00 -0000	[thread overview]
Message-ID: <20150403202116.GD37152@kam.mff.cuni.cz> (raw)

Hi,
this patch adds combined_size (i.e. size of caller after inlining) to the
denominator of the badness metric.  This is based on observations in PR 65076.
Old metric did use relative time speedup to get into sane range with fixed
point math.  I removed this after switching to sreals and this caused quite
noticeable compile time slowdowns on tramp3d and a regression on dromaeo
benchmark of Firefox.

The issue turns out to be the fact that new metric preffer building very
large functions with are not completely cool for optimization and definitely
bad for compile time.

I am comitting the attached patch and plan to watch benchmark results over
the long weekend. If everything goes well, I plan to also increase somewhat
the inline-unit-growth. In GCC 4.9 it is 30%, I dropped it to 15% that seems
too tight for firefox.  Given that large applications was the main motivator
for the drop, I think it is good enough reason to retreat and do not be so
agressive about code size at -O2/-O3.

Bootstrapped/regtested x86_64-linux, will commit it shortly.

Honza

	PR ipa/65076
	* ipa-inline.c (edge_badness): Add combined size to the denominator.

Index: ipa-inline.c
===================================================================
--- ipa-inline.c	(revision 221806)
+++ ipa-inline.c	(working copy)
@@ -1077,8 +1077,8 @@ edge_badness (struct cgraph_edge *edge,
   /* When profile is available. Compute badness as:
      
                  time_saved * caller_count
-     goodness =  ---------------------------------
-	         growth_of_caller * overall_growth
+     goodness =  -------------------------------------------------
+	         growth_of_caller * overall_growth * combined_size
 
      badness = - goodness
 
@@ -1167,6 +1167,7 @@ edge_badness (struct cgraph_edge *edge,
 	    overall_growth += 256 * 256 - 256;
 	  denominator *= overall_growth;
         }
+      denominator *= inline_summaries->get (caller)->self_size + growth;
 
       badness = - numerator / denominator;
 

                 reply	other threads:[~2015-04-03 20:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150403202116.GD37152@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).