From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by sourceware.org (Postfix) with ESMTPS id 594993858C55 for ; Sat, 8 Oct 2022 00:33:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 594993858C55 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665189206; x=1696725206; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=1Yo8Eq8swcbBcvdZrpjMnwa7z124anZUIhprRK6SesM=; b=T4/BP+UOxofm7Xy6WufcTRpshYwcluHUwN5UiuuOwMbxXPgOV2mkaRWy MnBPBuX9b6nOcLkMB4uPeCqmNFwIkuHIb0zQ2r/uGH7+hPV2kN0TZcnRy wgM6cTFw6M3FH+LGbMv/n3FLTfH5XWWby5m8VLkKWPVXS054JMTuJJWu4 C6fH/S+94yYMtgusHG8g+iaM1tu4eMhcGM7wt1lin44EHcKu9IoArv4WF ihiV0o96xB65QSy+M97rv3eWykv3lAMgVpwfHIrtJYgOvXwDiuYBhNreR ZnlmdobsUDAi9bmylIdNRNPty22WyNF/RjRgIJq6NqUk1+g5yO8XwLUR8 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10493"; a="305455675" X-IronPort-AV: E=Sophos;i="5.95,168,1661842800"; d="scan'208";a="305455675" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2022 17:33:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10493"; a="750731024" X-IronPort-AV: E=Sophos;i="5.95,168,1661842800"; d="scan'208";a="750731024" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga004.jf.intel.com with ESMTP; 07 Oct 2022 17:33:25 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 7 Oct 2022 17:33:24 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 7 Oct 2022 17:33:24 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Fri, 7 Oct 2022 17:33:24 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.42) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Fri, 7 Oct 2022 17:33:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k4cH3vSN7zvtjufSKHPxYWNi6MlG7CKUkTJ9rje28IInVi8T9tclDWIVh6OpAtZ7+Khtjo2efPusUMvZJ5+15qEKdNtb8VR/tuH3tEqrDGUilNOImNO3WQWAZ6Xqcv1e8w9ZGILFPJCQjq96JMYTcWmjayuW33meAvJKlnOTMiRQ39H9Eov8/WLtfxWsU+9tL7jK4h/Yz2umqpsSry/RdJ0tg3G0koR7rqD8bcXU0teHuiL6/ate3SfOdIESziH+YR3+z3PF361xgWwQpfRGE3m5FhWj7KdmDJLu6ki2ecp/L3FA1vXVX2BQXCcQlfWvqccj6/65jxTUDNkOjYCH/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=n4r/P9jQ2TBhufpSXyDlZOLIlX7CpaA642IrOmferHg=; b=S0TDUrjFZZntMCCJacyh5ChCC7XSUWjO3Cw9WBzd3O1T+eJjN4QBAhj8timKKmEGWLA6mKHOtfzH1GSsIbLUgkOY6RaxE1JTxJFJ4JEfL1IDx+cX7kgfiuXNT/GwkbI8HvlxTFmmGIXPcIYA+Z/Ng4+9lPhvyLZ3a1u84u/z41lckxZcXv/Tog3l4P9Cezy/cd3uH8hDycpYH2Pb5ECnoBou1QiKDFeAoJn04cyheCm3kG4WnpPg8H1jqLtYecBSb4CujH/vdyfEZG00hxCTg6Ajy3ZX7Yw3TKDuWBDtxe3fCyOHqZShn6ToQJhVHBReiX9J5jxyqfrnJ8cuEl38Pw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from SJ0PR11MB5600.namprd11.prod.outlook.com (2603:10b6:a03:3ab::16) by DM4PR11MB5359.namprd11.prod.outlook.com (2603:10b6:5:396::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Sat, 8 Oct 2022 00:33:22 +0000 Received: from SJ0PR11MB5600.namprd11.prod.outlook.com ([fe80::a038:823e:8895:63aa]) by SJ0PR11MB5600.namprd11.prod.outlook.com ([fe80::a038:823e:8895:63aa%4]) with mapi id 15.20.5676.031; Sat, 8 Oct 2022 00:33:22 +0000 From: "Cui, Lili" To: "Cui, Lili" , Jan Hubicka CC: "Lu, Hongjiu" , "Liu, Hongtao" , "gcc-patches@gcc.gnu.org" Subject: Ping^1 [PATCH] Add attribute hot judgement for INLINE_HINT_known_hot hint. Thread-Topic: Ping^1 [PATCH] Add attribute hot judgement for INLINE_HINT_known_hot hint. Thread-Index: AQHYzM3hz5SEbbuWE021DEQwM6v93a3ofziAgAEZ3ACAGihyoA== Date: Sat, 8 Oct 2022 00:33:22 +0000 Message-ID: References: <20220920084810.25157-1-lili.cui@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.500.17 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ0PR11MB5600:EE_|DM4PR11MB5359:EE_ x-ms-office365-filtering-correlation-id: ca200cfd-f7f5-4bc5-563f-08daa8c4b496 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: rOEGf/eCU2b5LAm1pcfVbXF/Mpnc5uMFf08Rlron/TGnI+zMMap/+nYf71ojU8PQnNbP3Y3iJOMSWrEtQxvO/5e8NYgeGuy4ifH+K6IzzRuP+Si8fKpuqv4sveQ+tYrRTQr5IOQTZY6v3ck/anvATA69oNO0ilZn9fOuihW6OMjefDKPWjQxgDpMIC31cO4L4Nt9Fs4ugpAxSKaA9u21GzdO6PlW9Te/rc12LDjWPREDL4nc8L4SIC+YF+N9cwyq2fIVglokSpsmxcs7UFZ/qdLqZT6ZP4C0Dq9RQhpj2yjqTQNmXVv8TFl9pQWbKKNS17YwiLFvJEZNQbAWyKRlmrQiETriNPsqE2ItfY2Hx9JlIAZsu70QH9bYOlt6KqQ8lJ9aYWhaQQV0zkunB0rcB1UbqGTknjaUP14pXuVebM7qYm/wtrO7RGAdY3xMRrRIUhBTkmlBJ0ThadA4uE72JVV2tyLHwfmH/hmBdxPxN6vpcI7SEq62G+G2o2spUU2+dQFH2JW12w3o+BCjbByl2kjOU7MrXO9Xg/GRoW+gUYGWbAsC/hq5tBECgy8co9zdQvCFXVPa/7/EcVSUGa4zQbA0csPRn13KGaqsyAxvZLJ+u2U6urm03xxE3gCa+mfVznAS03IExYzvvBUP5Ye85Kj1JSGoZq2aZGPe0ilIlpi4C8TuRJXqpqY/y8UGxvRpb/I/9e5VP5VWhJNwLSrrDnbpWVsdqxkI59prrVNA2lZ4bOQOxQALINcPWHVK6wdm6Z8f3YRR+kzp1Q9hRH7XUf2HLykkcRfBGAYnrsbqSIus30nL+adAPr2lGAiQgS1G x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR11MB5600.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(39860400002)(136003)(376002)(346002)(396003)(451199015)(66556008)(66446008)(64756008)(38070700005)(66476007)(9686003)(83380400001)(86362001)(26005)(71200400001)(186003)(76116006)(478600001)(8676002)(84970400001)(82960400001)(33656002)(122000001)(54906003)(66946007)(316002)(966005)(110136005)(4326008)(38100700002)(8936002)(53546011)(7696005)(2906002)(41300700001)(5660300002)(55016003)(6506007)(52536014)(81973001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?y5GfOAihEoHWLGbMJQsw72Owyp4gnCcNqDqNPHXzrshXvF/6GQNFkhN5X3OX?= =?us-ascii?Q?iHJf1xydf/M1scN3tf3hHLZhg68UxuFGJJJuvTPQAZ6+W1RnOwC6HnSRZBDZ?= =?us-ascii?Q?XjA6vnXO0wy+2b0afwnkHOR5rzIlvFfyNydolEkzzmEvSojMu7f5U0RPZAWo?= =?us-ascii?Q?yj4pOrQtVC+BB3Z5LwIjTnA096BBE/IxlpdTQO+vwm550ZeLU41JCqeKJWT7?= =?us-ascii?Q?sFNLem7TuO4AE7n+p2GkvQfD0Ozz4MUfU2c6Wguyim3XfILqad9C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i5AWWOq7fhhMxT4HUEnMxxQAb8ZfmmU?= =?us-ascii?Q?s3lXT9e9yMYDRCnnT76wr90SHnZF6vi7oNjinSKNilmh27B+IC4nMi4jDqhu?= =?us-ascii?Q?6do7Hs4zX7nUpOfZxVyglZYArmEEaf1Ny/kxPZwRT6Q6oFw2balxnapuxKFu?= =?us-ascii?Q?TyZjBAuiOR7j0QWD0kUwqFBNdUhMQ/wYeHJf2ChwaO6k9/WruN9H5To4qt40?= =?us-ascii?Q?Ha/ipjPf3p9kXTiQ66J8VMUI9bqlR9WXdKGCKwSabqZMLU5V1T5jBLv7Bdn6?= =?us-ascii?Q?CJYiCW2y+vgREQmLGxQiGgDd0vbCb/EKkLmIY1mMhibCJoeSQcwiA8jeIzzk?= =?us-ascii?Q?aEdMbKvkovHIQpbMXcVxw5dqhjHdNDYIBeM1LE30wVQlKZB6vPNKbLU+tJBB?= =?us-ascii?Q?X5cFTkaTIBhZGSZcm+uZnKpkHVdDI9JbWsKUzZiP?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5600.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca200cfd-f7f5-4bc5-563f-08daa8c4b496 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2022 00:33:22.2998 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: RxePtaojwhDa2dYOJ7/O92VTy1yC1BhaAJO5BJD3Y4bBZoRxOJmmLbW7MyjCHhXXL3kETCeMAyfHWCJA4VTuYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5359 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,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, Gentle ping https://gcc.gnu.org/pipermail/gcc-patches/2022-September/60193= 4.html Thanks, Lili. > -----Original Message----- > From: Gcc-patches = On > Behalf Of Cui, Lili via Gcc-patches > Sent: Wednesday, September 21, 2022 5:22 PM > To: Jan Hubicka > Cc: Lu, Hongjiu ; Liu, Hongtao > ; gcc-patches@gcc.gnu.org > Subject: RE: [PATCH] Add attribute hot judgement for > INLINE_HINT_known_hot hint. >=20 > > Thank you. Can you please also add a testcase that tests for this. > > So you modify imagemagick marking attribute hot on the specific inline? >=20 > Thanks Honza. Added the testcase. I didn't modify source code of > 538.imagic_r, the original source code has attribute like: >=20 > #define magick_hot_spot __attribute__((__hot__)) static Cache > *SetPixelCacheNexusPixels( ... ) magick_hot_spot; >=20 > > I will try to also look again at your earlier patch - I had very busy > > summer and unfortunately lost track on this one. > > > NP, I guessed you were busy during that time, my earlier patch was partia= lly > duplicated with function "Elimination_by_inlining_prob", except "paramete= r > points to caller local memory" part, maybe we can find a suitable place t= o > add local memory part to the IPA. >=20 > > Honza >=20 > gcc/ChangeLog >=20 > * ipa-inline-analysis.cc (do_estimate_edge_time): Add function attribut= e > judgement for INLINE_HINT_known_hot hint. >=20 > gcc/testsuite/ChangeLog: >=20 > * 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 >=20 > diff --git a/gcc/ipa-inline-analysis.cc b/gcc/ipa-inline-analysis.cc inde= x > 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" >=20 > /* Cached node/edge growths. */ > fast_call_summary > *edge_growth_cache =3D NULL; @@ -249,15 +250,19 @@ > do_estimate_edge_time (struct cgraph_edge *edge, sreal *ret_nonspec_time) > hints =3D estimates.hints; > } >=20 > - /* 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)) > + !=3D NULL > + && lookup_attribute ("hot", DECL_ATTRIBUTES (edge->callee->decl)) > + !=3D NULL)) > hints |=3D INLINE_HINT_known_hot; >=20 > gcc_checking_assert (size >=3D 0); > diff --git a/gcc/testsuite/gcc.dg/ipa/inlinehint-6.c > b/gcc/testsuite/gcc.dg/ipa/inlinehint-6.c > new file mode 100644 > index 00000000000..1f3be641c6d > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/ipa/inlinehint-6.c > @@ -0,0 +1,47 @@ > +/* { dg-options "-O3 -c -fdump-ipa-inline-details -fno-early-inlining > +-fno-ipa-cp" } */ > +/* { dg-add-options bind_pic_locally } */ > + > +#define size_t long long int > + > +struct A > +{ > + size_t f1, f2, f3, f4; > +}; > +struct C > +{ > + struct A a; > + size_t b; > +}; > +struct C x; > + > +__attribute__((hot)) struct C callee (struct A *a, struct C *c) { > + c->a=3D(*a); > + > + if((c->b + 7) & 17) > + { > + c->a.f1 =3D c->a.f2 + c->a.f1; > + c->a.f2 =3D c->a.f3 - c->a.f2; > + c->a.f3 =3D c->a.f2 + c->a.f3; > + c->a.f4 =3D c->a.f2 - c->a.f4; > + c->b =3D c->a.f2; > + > + } > + return *c; > +} > + > +__attribute__((hot)) struct C caller (size_t d, size_t e, size_t f, > +size_t g, struct C *c) { > + struct A a; > + a.f1 =3D 1 + d; > + a.f2 =3D e; > + a.f3 =3D 12 + f; > + a.f4 =3D 68 + g; > + if (c->b > 0) > + return callee (&a, c); > + else > + return *c; > +} > + > +/* { dg-final { scan-ipa-dump "known_hot" "inline" } } */ > + > -- > 2.17.1 >=20 > Thanks, > Lili.