From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 982CE3858D3C for ; Tue, 21 Sep 2021 02:16:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 982CE3858D3C Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18L1edfN012481; Mon, 20 Sep 2021 22:16:18 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3b6unt77cm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Sep 2021 22:16:17 -0400 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 18L2GHRs022038; Mon, 20 Sep 2021 22:16:17 -0400 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 3b6unt77c1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Sep 2021 22:16:17 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 18L2DHPF032529; Tue, 21 Sep 2021 02:16:14 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma02fra.de.ibm.com with ESMTP id 3b57r95qm4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Sep 2021 02:16:14 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 18L2GBJZ53936430 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Sep 2021 02:16:11 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9169C11C054; Tue, 21 Sep 2021 02:16:11 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3435E11C04C; Tue, 21 Sep 2021 02:16:08 +0000 (GMT) Received: from KewenLins-MacBook-Pro.local (unknown [9.200.63.17]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 21 Sep 2021 02:16:07 +0000 (GMT) Subject: Re: [PATCH v2] ipa-inline: Add target info into fn summary [PR102059] To: Martin Jambor Cc: Richard Biener , Jan Hubicka , =?UTF-8?Q?Martin_Li=c5=a1ka?= , Segher Boessenkool , Bill Schmidt , fweimer@redhat.com, GCC Patches References: <0d10e5a2-a966-3b26-2e59-b6fd98d703a2@linux.ibm.com> <8a4da9c1-b46e-5176-2cde-65ac4a59dd75@linux.ibm.com> <8d230b16-e507-583f-7d98-d2ff45c7e656@linux.ibm.com> From: "Kewen.Lin" Message-ID: Date: Tue, 21 Sep 2021 10:16:06 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-GUID: M1cmu8OdVeyl0SheLfy5E2xeYuve-R6k X-Proofpoint-ORIG-GUID: ls9IULOKB3Rsj_qhPiwx7KSqTOSI236D Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-20_11,2021-09-20_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 malwarescore=0 mlxlogscore=999 clxscore=1015 impostorscore=0 phishscore=0 spamscore=0 priorityscore=1501 adultscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109210011 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 02:16:21 -0000 Hi Martin, on 2021/9/17 下午7:26, Martin Jambor wrote: > Hi, > > On Fri, Sep 17 2021, Kewen.Lin wrote: >> on 2021/9/16 下午9:19, Martin Jambor wrote: >>> On Thu, Sep 16 2021, Kewen.Lin wrote: >>>> on 2021/9/15 下午8:51, Martin Jambor wrote: >>>>> On Wed, Sep 08 2021, Kewen.Lin wrote: >>>>>> >>>>> >>>>> [...] >>>>> >>>>>> diff --git a/gcc/ipa-fnsummary.h b/gcc/ipa-fnsummary.h >>>>>> index 78399b0b9bb..300b8da4507 100644 >>>>>> --- a/gcc/ipa-fnsummary.h >>>>>> +++ b/gcc/ipa-fnsummary.h >>>>>> @@ -193,6 +194,9 @@ public: >>>>>> vec *loop_strides; >>>>>> /* Parameters tested by builtin_constant_p. */ >>>>>> vec GTY((skip)) builtin_constant_p_parms; >>>>>> + /* Like fp_expressions, but it's to hold some target specific information, >>>>>> + such as some target specific isa flags. */ >>>>>> + auto_vec GTY((skip)) target_info; >>>>>> /* Estimated growth for inlining all copies of the function before start >>>>>> of small functions inlining. >>>>>> This value will get out of date as the callers are duplicated, but >>>>> >>>>> Segher already wrote in the first thread that a vector of HOST_WIDE_INTs >>>>> is an overkill and I agree. So at least make the new field just a >>>>> HOST_WIDE_INT or better yet, an unsigned int. But I would even go >>>>> further and make target_info only a 16-bit bit-field, place it after the >>>>> other bit-fields in class ipa_fn_summary and pass it to the hooks as >>>>> uint16_t. Unless you have plans which require more space, I think we >>>>> should be conservative here. >>>>> >>>> >>>> OK, yeah, the consideration is mainly for the scenario that target has >>>> a few bits to care about. I just realized that to avoid inefficient >>>> bitwise operation for mapping target info bits to isa_flag bits, target >>>> can rearrange the sparse bits in isa_flag, so it's not a deal. >>>> Thanks for re-raising this! I'll use the 16 bits bit-field in v3 as you >>>> suggested, if you don't mind, I will put it before the existing bit-fields >>>> to have a good alignment. >>> >>> All right. >>> >> >> Sorry that I failed to use 16 bit-fields for this, I figured out that >> the bit-fields can not be address-taken or passed as non-const reference. >> The gentype also failed to recognize uint16_t if I used uint16_t directly >> in ipa-fnsummary.h. Finally I used unsigned int instead. >> > > well, you could have used: > > unsigned int target_info : 16; > > for the field (and uint16_t when passed to hooks). > > But I am not sure if it is that crucial. > I may miss something, specifically I tried with: 1) unsigned int target_info : 16; unsigned inlinable : 1; ... update_ipa_fn_target_info (uint16_t &, const gimple *) 2) unsigned int target_info : 16; unsigned inlinable : 1; ... update_ipa_fn_target_info (uint16_t *, const gimple *) The above two ways failed due to: "Because bit fields do not necessarily begin at the beginning of a byte, address of a bit field cannot be taken. Pointers and non-const references to bit fields are not possible." as [1]. Although we can change the hook prototype to bool update_ipa_fn_target_info (const uint16_t, const gimple*, uint16_t&) or uint16_t update_ipa_fn_target_info (const uint16_t, const gimple*, bool&) to workaround bit field limitation, it looks weird and inefficient. 3) ... unsigned int fp_expressions : 1; uint16_t target_info; update_ipa_fn_target_info (uint16_t &, const gimple *) it fails due to gengtype erroring: gcc/ipa-fnsummary.h:171: undefined type `uint16_t' gengtype: didn't write state file tmp-gtype.state after errors Then I gave up and guessed it's not so crucial like you said, and used unsigned int instead. :) [1] https://en.cppreference.com/w/cpp/language/bit_field BR, Kewen