From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 7F0593948A74 for ; Fri, 7 Oct 2022 13:50:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7F0593948A74 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6827E21904; Fri, 7 Oct 2022 13:50:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1665150623; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5ynkQpate7Hg8czcoKl4nfdTyJagiQ6HCtEqej7/leU=; b=eTsPwrkLZ4BX7++o0kbN4Pnvwax4jydQ6MbkmiiNm2YAJHtLLjJCmCLSqmPZZw5OgK69z0 seWIQ2C3cWpj6UhsZ+7+74IY5BEOJR/s6Of89nu1El1njBLQDlWbqq6BHODWY7rZGP9jwe xeCUMocZ1GUs2CEL9nMWZeoLjQuQrt8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1665150623; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5ynkQpate7Hg8czcoKl4nfdTyJagiQ6HCtEqej7/leU=; b=WOoxdQZK97d84cYCgxBTQ7fY7z9WYBRd9KRxc4rkITyL4FHe7Eecii5LgWTjQlMB/ehYyw gf0COXRy/AgtfiDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3BA6213A3D; Fri, 7 Oct 2022 13:50:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id vDEnDZ8uQGPXAwAAMHmgww (envelope-from ); Fri, 07 Oct 2022 13:50:23 +0000 Message-ID: <03472088-de23-d658-ad6c-86eac06612ba@suse.cz> Date: Fri, 7 Oct 2022 15:50:22 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH] IPA: support -flto + -flive-patching=inline-clone Content-Language: en-US To: Qing Zhao , Richard Biener Cc: "gcc-patches@gcc.gnu.org" , Jan Hubicka References: <137fde8c-7ade-ecc0-96f2-9ec828b4745e@suse.cz> <406C00D6-71C6-4D62-A772-448BB014A656@oracle.com> <03E958B0-A70F-48BA-A28E-A365B9B70981@oracle.com> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= In-Reply-To: <03E958B0-A70F-48BA-A28E-A365B9B70981@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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/7/22 15:04, Qing Zhao wrote: > > >> On Oct 7, 2022, at 2:34 AM, Richard Biener wrote: >> >> On Thu, Oct 6, 2022 at 3:18 PM Qing Zhao wrote: >>> >>> >>> >>>> On Oct 6, 2022, at 4:29 AM, Richard Biener wrote: >>>> >>>> On Wed, Oct 5, 2022 at 8:18 PM Qing Zhao via Gcc-patches >>>> wrote: >>>>> >>>>> >>>>> >>>>>> On Oct 5, 2022, at 1:36 PM, Martin Liška wrote: >>>>>> >>>>>> On 10/5/22 16:50, Qing Zhao wrote: >>>>>>> I have two questions on this: >>>>>> >>>>>> Hello. >>>>>> >>>>>>> >>>>>>> 1. What’s the motivation to enable -flive-patching with -flto? Is there any application that will try -flive-patching with -flto now? >>>>>> >>>>>> We're planning supporting GCC LTO Linux kernel support, so that's one motivation. And the second one is a possible >>>>>> use in user-space livepatching. Note majority of modern distros default to -flto (openSUSE, Fedora, Debian, Ubuntu, ...). >>>>> >>>>> Okay, I see. That’s reasonable. >>>>>> >>>>>>> >>>>>>> 2. Why only enable -flive-patching=inline-clone with -flto? >>>>>> >>>>>> Because the inline-only-static level (which you added/requested) would have to properly >>>>>> block inter-procedural inlining that happens in LTO (can_inline_edge_by_limits_p) and >>>>>> I'm not sure it would be properly blocked. So, feel free to extend my patch if you want? >>>>> >>>>> -flive-patching=inline-only-static >>>>> >>>>> Only enable static functions inlining, all the inlining of external visible functions are blocked, So, LTO should be compatible with this naturally without any issue, I think. >>>>> >>>>> i.e, when "-flive-patching=inline-only-static -flto" present together, all the inter-procedural inlining should be automatically blocked by -flive-patching=inline-only-static already. >>>>> >>>>> Do I miss anything here? >>>> >>>> WPA will promote externally visible functions static when all accesses >>>> are from LTO IR, I don't think we preserve >>>> the "original" visibility for IPA inlining heuristics. >>> >>> WPA is Whole Program Analysis? >> >> Yes. >> >>> Okay, then It will promote all static function to extern functions. That’s reasonable. >> >> No, all extern functions to static functions. > > Oh, really? Why change “extern” to “static”? (I recall that studio compiler promote static to extern for inter-procedural inlining) Because the linker LTO plug-in can get information about symbols are really and the thus some of them can before static and not visible. >> >>> Is it hard to preserve the original “static” visibility in the IR? >> >> Probably not hard, and the IPA pass adjusting visbility could as well >> mark the functions >> as not to be inlined with -flive-patching=inline-only-static. > Okay, then the implementation should be doable? >> >>>> >>>> OTOH inline-only-static could disable WPA inlining and do all inlining early ... >>> >>> Inline-only-static ONLY inlines static functions, how can it disable WPA inlining? Don’t quite understand here. >> >> it's a flag so it can be used to control other things. > > When -flive-patching=inline-only-static is specified by the user, user explicitly request ONLY inlining static functions. > Even when LTO is enabled, if only static function inlining is enabled, user gets what he/she want. So I didn’t see any issue here. Please see Honza's previous email about the second inliner. Anyway, I'm going to install my patch that handles inline-clone option value. Martin > > Let me know if I still miss anything here> > Thanks. > > Qing > > >> >>> thanks. >>> >>> Qing >>>> >>>> Richard, >>>> >>>>> >>>>> thanks. >>>>> >>>>> Qing >>>>> >>>>>> >>>>>> Martin >>>>>> >>>>>>> >>>>>>> thanks. >