From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by sourceware.org (Postfix) with ESMTPS id 62179385768D for ; Mon, 31 Oct 2022 16:35:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 62179385768D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-x529.google.com with SMTP id b5so11157881pgb.6 for ; Mon, 31 Oct 2022 09:35:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=mnVbvX61e1Q2/N95/+tc6y6YLedRYy4nubH0zfcSWAM=; b=AVdLu0Kc/DiWvAH5ymGqbos5y05r2O+KKY0XpXksedbVQFM6CYxar/bk4NlTbsx4g8 gOjLPE4Xnm3elPCJhLDg8Cox+AJhKAZUU1lZN6LGh7DsfjQU3nbiS1F5iIvReNGLdlfQ Aj3qSgaIwqrGtIBokpLynWXMzbJlDDdegjh92UBS81AekP//zX5zSU4t2FE0VeC32ffz H+dCpAs5NzBqhpOeXFK0So9iklvm9n9ntAQpNbHukX7s86ulJAVJzxR6tEjFaJT3FaU7 SB1AwvVlILmwS+h3i7tM4sYIwyocdGkxoiIl6l9fdyca8H4Yl1K7OAT+ydgMQjg/OJgp 3epA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mnVbvX61e1Q2/N95/+tc6y6YLedRYy4nubH0zfcSWAM=; b=mKTqVvim48E8yzS+2ZHAHH2MhdNYYMPIzHdx4HykT8mKy4hPGOJ2Dd4/IQZw3SzyfC yVnENOmueCHCNmfOnPdBgrBDZHKnCXltb0hQfC7d0bvHDLfv22GBlQAjMljDXxoKZKW1 vrmkGapRq0+Ioo6w3yucvGCkInQLWwdri04K5jkcOP3cTDkVnTMbvDd8iaiW/yYDlyZD IuYrTLwDnZboN/ZhPVfkQ0fw5Rztfu8BdqsVmcdur3HSWltCN+coUIuwa8QlKID2qHGD gY75nf2UjB74ATzJu1hYV/yalLqrh4AJrVi7tHWc1b/YC3JIorD3j3sDY6wGiSBU9aJQ MBpg== X-Gm-Message-State: ACrzQf337BDn2hS7+PyvxLkO+AQa0VtNGFHmrjB3PFuMozmmXK10wHMQ xLkMyYagBlP6C5FLeaXIBXc= X-Google-Smtp-Source: AMsMyM4QwFVx62HlmCaJNDDyzVK1IVxVXHNnojP9/8LYQClkXbr7+kpKXC6tKnMT9FW+hcx+QyDpPw== X-Received: by 2002:a65:56c4:0:b0:458:85e:9e65 with SMTP id w4-20020a6556c4000000b00458085e9e65mr13716985pgs.358.1667234151282; Mon, 31 Oct 2022 09:35:51 -0700 (PDT) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id 1-20020a17090a0d4100b00205db4ff6dfsm4380060pju.46.2022.10.31.09.35.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Oct 2022 09:35:50 -0700 (PDT) Message-ID: Date: Mon, 31 Oct 2022 10:35:49 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: Ping^3 [PATCH V2] Add attribute hot judgement for INLINE_HINT_known_hot hint. Content-Language: en-US To: "Cui, Lili" , Jan Hubicka , "jh@suse.cz" Cc: "Lu, Hongjiu" , "Liu, Hongtao" , "gcc-patches@gcc.gnu.org" References: <20220920084810.25157-1-lili.cui@intel.com> <1eed381a-708c-8ea7-9010-ecc144ab959c@gmail.com> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: On 10/30/22 19:44, Cui, Lili wrote: >> 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 = 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. >> > Yes, thanks Jeff. Thanks for the confirmation.  This is OK for the trunk. jeff