public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Jambor <mjambor@suse.cz>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 4/4] ipa-cp: Select saner profile count to base heuristics on
Date: Wed, 27 Oct 2021 15:20:13 +0200	[thread overview]
Message-ID: <ri6sfwm1u5u.fsf@suse.cz> (raw)
In-Reply-To: <96160a5131c9e5eb302fb9f4db43c5d8b4cfe042.1629805719.git.mjambor@suse.cz>

Hi,

On Mon, Aug 23 2021, Martin Jambor wrote:
> When profile feedback is available, IPA-CP takes the count of the
> hottest node and then evaluates all call contexts relative to it.
> This means that typically almost no clones for specialized contexts
> are ever created because the maximum is some special function, called
> from everywhere (that is likely to get inlined anyway) and all the
> examined edges look cold compared to it.
>
> This patch changes the selection.  It simply sorts counts of all edges
> eligible for cloning in a vector and then picks the count in 90th
> percentile (the actual number is configurable via a parameter).
>
> I also tried more complex approaches which were summing the counts and
> picking the edge which together with all hotter edges accounted for a
> given portion of the total sum of all edge counts.  But first it was
> not apparently clear to me that they make more logical sense that the
> simple method and practically I always also had to ignore a few
> percent of the hottest edges with really extreme counts (looking at
> bash and python).  And when I had to do that anyway, it seemed simpler
> to just "ignore" more and take the first non-ignored count as the
> base.
>
> Nevertheless, if people think some more sophisticated method should be
> used anyway, I am willing to be persuaded.  But this patch is a clear
> improvement over the current situation.
>
> gcc/ChangeLog:
>
> 2021-08-23  Martin Jambor  <mjambor@suse.cz>
>
> 	* params.opt (param_ipa_cp_profile_count_base): New parameter.
> 	* ipa-cp.c (max_count): Replace with base_count, replace all
> 	occurrences too, unless otherwise stated.
> 	(ipcp_cloning_candidate_p): identify mostly-directly called
> 	functions based on their counts, not max_count.
> 	(compare_edge_profile_counts): New function.
> 	(ipcp_propagate_stage): Instead of setting max_count, find the
> 	appropriate edge count in a sorted vector of counts of eligible
> 	edges and make it the base_count.

Honza approved this patch in a private conversation but then I noticed I
forgot to add an entry for the new parameter into invoke.texi, so I
fixed that problem (and checked the result with make info and make pdf)
and pushed the patch to master as commit
ab1008255e37b5b51a433ed69e04c06300543799.

Thanks,

Martin

      parent reply	other threads:[~2021-10-27 13:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 11:48 [PATCH 0/4] IPA-CP profile feedback handling fixes Martin Jambor
2021-08-20 17:43 ` [PATCH 3/4] ipa-cp: Fix updating of profile counts and self-gen value evaluation Martin Jambor
2021-10-08 11:31   ` Jan Hubicka
2021-10-18 16:56     ` Martin Jambor
2021-10-27 13:18       ` Martin Jambor
2021-08-20 17:43 ` [PATCH 2/4] ipa-cp: Propagation boost for recursion generated values Martin Jambor
2021-10-06 15:49   ` Jan Hubicka
2021-10-07 14:59     ` Martin Jambor
2021-10-07 15:25       ` Jan Hubicka
2021-08-20 17:43 ` [PATCH 1/4] cgraph: Do not warn about caller count mismatches of removed functions Martin Jambor
2021-09-16 15:10   ` Martin Jambor
2021-08-23 18:49 ` [PATCH 4/4] ipa-cp: Select saner profile count to base heuristics on Martin Jambor
2021-10-06 15:33   ` Jan Hubicka
2021-10-18 17:10     ` Martin Jambor
2021-10-27 13:22       ` Martin Jambor
2021-10-27 13:20   ` Martin Jambor [this message]

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=ri6sfwm1u5u.fsf@suse.cz \
    --to=mjambor@suse.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).