public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: Xinliang David Li <davidxl@google.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: FDO usability patch -- cfg and lineno checksum
Date: Sun, 17 Apr 2011 17:15:00 -0000	[thread overview]
Message-ID: <20110417153611.GF911@atrey.karlin.mff.cuni.cz> (raw)
In-Reply-To: <BANLkTi=4D2nZQ0_85OwGcYBcUM9DWdMTJA@mail.gmail.com>

> Hi,  in current FDO implementation, the source file version used in
> profile-generate needs to strictly match the version used in
> profile-use -- simple formating changes will invalidate the profile
> data (use of it will lead to compiler error or ICE). There are two
> main problems that lead to the weakness:
> 
> 1) the function checksum is computed based on line number and number
> of basic blocks -- this means any line number change will invalidate
> the profile data. In fact, line number should play very minimal role
> in profile matching decision. Another problem is that number of basic
> blocks is also not a good indicator whether CFG matches or not.
> 2) cgraph's pid is used as the key to find the matching profile data
> for a function. If there is any new function added, or if the order of
> the functions changes, the profile data is invalidated.
> 
> The attached is a patch from google that improves this.
> 1) function checksum is split into two parts: lineno checksum and cfg checksum
> 2) function assembler name is used in profile hashing.

Well, the overall idea was to make profile intolerant to pretty much any source
level change, since you never know if even when the CFG shape match, the actual
probabiliies did not changed.
I however see that during development it is not bad to make compiler grok
the profile as long as it seems consistent.

I did not looked in detail into the implementation yet, but it seems
sane at first glance.  However what about issuing a warning when line number
information change telling user that profile might no longer be accurate
and that he may want to remove it and train again?

Honza

  parent reply	other threads:[~2011-04-17 15:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13 22:26 Xinliang David Li
2011-04-13 22:34 ` Xinliang David Li
     [not found] ` <BANLkTinVavyXCqy88TpqLzmexp2LQ1Pwqw@mail.gmail.com>
2011-04-15 16:54   ` Xinliang David Li
2011-04-17 17:15 ` Jan Hubicka [this message]
2011-04-17 19:22   ` Xinliang David Li
2011-04-19 20:37   ` Xinliang David Li
2011-04-19 22:36     ` Jan Hubicka
2011-04-21  8:30       ` Xinliang David Li
2011-04-21 22:21         ` Jan Hubicka
2011-04-21 22:42           ` Xinliang David Li
2011-04-22 19:35             ` Xinliang David Li
2011-04-22 20:11               ` Jan Hubicka
2011-04-25 17:05                 ` Xinliang David Li
2011-04-27 16:22                   ` Xinliang David Li
2011-04-27 16:27               ` Jan Hubicka
2011-04-27 17:45                 ` Xinliang David Li
2011-04-27 17:54                   ` Jan Hubicka
2011-04-27 17:57                     ` Xinliang David Li
2011-04-21 18:23     ` Diego Novillo

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=20110417153611.GF911@atrey.karlin.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=davidxl@google.com \
    --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).