public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: "Cui, Lili" <lili.cui@intel.com>, Jan Hubicka <hubicka@ucw.cz>,
	"jh@suse.cz" <jh@suse.cz>
Cc: "Lu, Hongjiu" <hongjiu.lu@intel.com>,
	"Liu, Hongtao" <hongtao.liu@intel.com>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: Ping^3 [PATCH V2] Add attribute hot judgement for INLINE_HINT_known_hot hint.
Date: Fri, 28 Oct 2022 22:28:17 -0600	[thread overview]
Message-ID: <1eed381a-708c-8ea7-9010-ecc144ab959c@gmail.com> (raw)
In-Reply-To: <SJ0PR11MB5600A9CDD52DBEC97E81257D9E2D9@SJ0PR11MB5600.namprd11.prod.outlook.com>


On 10/20/22 19:52, Cui, Lili via Gcc-patches wrote:
> Hi Honza,
>
> Gentle ping  https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601934.html
>
> gcc/ChangeLog
>
>    * ipa-inline-analysis.cc (do_estimate_edge_time): Add function attribute
>    judgement for INLINE_HINT_known_hot hint.
>
> gcc/testsuite/ChangeLog:
>
>    * gcc.dg/ipa/inlinehint-6.c: New test.
> ---
>   gcc/ipa-inline-analysis.cc              | 13 ++++---
>   gcc/testsuite/gcc.dg/ipa/inlinehint-6.c | 47 +++++++++++++++++++++++++
>   2 files changed, 56 insertions(+), 4 deletions(-)
>   create mode 100644 gcc/testsuite/gcc.dg/ipa/inlinehint-6.c
>
> diff --git a/gcc/ipa-inline-analysis.cc b/gcc/ipa-inline-analysis.cc
> index 1ca685d1b0e..7bd29c36590 100644
> --- a/gcc/ipa-inline-analysis.cc
> +++ b/gcc/ipa-inline-analysis.cc
> @@ -48,6 +48,7 @@ along with GCC; see the file COPYING3.  If not see
>   #include "ipa-utils.h"
>   #include "cfgexpand.h"
>   #include "gimplify.h"
> +#include "attribs.h"
>   
>   /* Cached node/edge growths.  */
>   fast_call_summary<edge_growth_cache_entry *, va_heap> *edge_growth_cache = NULL;
> @@ -249,15 +250,19 @@ do_estimate_edge_time (struct cgraph_edge *edge, sreal *ret_nonspec_time)
>         hints = estimates.hints;
>       }
>   
> -  /* When we have profile feedback, we can quite safely identify hot
> -     edges and for those we disable size limits.  Don't do that when
> -     probability that caller will call the callee is low however, since it
> +  /* When we have profile feedback or function attribute, we can quite safely
> +     identify hot edges and for those we disable size limits.  Don't do that
> +     when probability that caller will call the callee is low however, since it
>        may hurt optimization of the caller's hot path.  */
> -  if (edge->count.ipa ().initialized_p () && edge->maybe_hot_p ()
> +  if ((edge->count.ipa ().initialized_p () && edge->maybe_hot_p ()
>         && (edge->count.ipa () * 2
>   	  > (edge->caller->inlined_to
>   	     ? edge->caller->inlined_to->count.ipa ()
>   	     : edge->caller->count.ipa ())))
> +      || (lookup_attribute ("hot", DECL_ATTRIBUTES (edge->caller->decl))
> +	  != NULL
> +	 && lookup_attribute ("hot", DECL_ATTRIBUTES (edge->callee->decl))
> +	  != NULL))
>       hints |= INLINE_HINT_known_hot;

Is the theory here that if the user has marked the caller and callee as 
hot, then we're going to assume an edge between them is hot too?  That's 
not necessarily true, it could be they're both hot, but via other call 
chains.  But it's probably a reasonable heuristic in practice.


OK


jeff



  reply	other threads:[~2022-10-29  4:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20  8:48 [PATCH] " Cui,Lili
2022-09-20 16:17 ` Jan Hubicka
2022-09-21  9:21   ` Cui, Lili
2022-10-08  0:33     ` Ping^1 " Cui, Lili
2022-10-14  6:28       ` Ping^2 " Cui, Lili
2022-10-21  1:52         ` Ping^3 [PATCH V2] " Cui, Lili
2022-10-29  4:28           ` Jeff Law [this message]
2022-10-31  1:44             ` Cui, Lili
2022-10-31 16:35               ` Jeff Law

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=1eed381a-708c-8ea7-9010-ecc144ab959c@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hongjiu.lu@intel.com \
    --cc=hongtao.liu@intel.com \
    --cc=hubicka@ucw.cz \
    --cc=jh@suse.cz \
    --cc=lili.cui@intel.com \
    /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).