From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id 4AE3C3858C55 for ; Tue, 20 Sep 2022 16:17:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4AE3C3858C55 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id EEF1D280837; Tue, 20 Sep 2022 18:17:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1663690621; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WyWx5DFldIUoYA5cFE0DdRNSkZYVj1bzFqhKuU/gKW0=; b=BH22JgOnurMPbHN6zOaGmSsZU6VV25bEgJFYqSLxUhUNjus1hZc8vKMI9XITXQHLAIArA9 tKH1u1JlfpyhUdSjPv/ErPl4BwdTwdke6X/3iU9CmyFzC4kyTRzu+t9SoL7dAjxp2+UWyb vqQy6P1KMmArsMxuwso0tOyfUlliMUI= Date: Tue, 20 Sep 2022 18:17:01 +0200 From: Jan Hubicka To: "Cui,Lili" Cc: gcc-patches@gcc.gnu.org, hongtao.liu@intel.com, hongjiu.lu@intel.com Subject: Re: [PATCH] Add attribute hot judgement for INLINE_HINT_known_hot hint. Message-ID: References: <20220920084810.25157-1-lili.cui@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220920084810.25157-1-lili.cui@intel.com> X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > Hi Honza, > > This patch is to add attribute hot judgement for INLINE_HINT_known_hot hint. > > We set up INLINE_HINT_known_hot hint only when we have profile feedback, > now add function attribute judgement for it, when both caller and callee > have __attribute__((hot)), we will also set up INLINE_HINT_known_hot hint > for it. > > With this patch applied > Ratio Codesize > ADL Multi-copy: 538.imagic_r 16.7% 1.6% > SPR Multi-copy: 538.imagic_r 15% 1.7% > ICX Multi-copy: 538.imagic_r 15.2% 1.7% > CLX Multi-copy: 538.imagic_r 12.7% 1.7% > Znver3 Multi-copy: 538.imagic_r 10.6% 1.5% > > Bootstrap and regtest pending on x86_64-unknown-linux-gnu. > OK for trunk? > > Thanks, > Lili. > > gcc/ChangeLog > > * ipa-inline-analysis.cc (do_estimate_edge_time): Add function attribute > judgement for INLINE_HINT_known_hot hint. Thank you. Can you please also add a testcase that tests for this. So you modify imagemagick marking attribute hot on the specific inline? I will try to also look again at your earlier patch - I had very busy summer and unfortunately lost track on this one. Honza > --- > gcc/ipa-inline-analysis.cc | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > 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 = 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; > > gcc_checking_assert (size >= 0); > -- > 2.17.1 >