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 C60D43858C54 for ; Wed, 8 Mar 2023 10:32:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C60D43858C54 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 DBB3621A0C; Wed, 8 Mar 2023 10:32:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1678271551; h=from:from:reply-to: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=slrp0uiSw7eFn7aIOmxvfPstAn62960JCbq0WPndXCU=; b=S5RZDhfYvqggqbKiEeb6/kKe95jhHCKAqNm8twO1/romtJRQ62OSvOn+2h5YDFSQMKdxMU 4o6EXX+DIt5GR43QjZ4Tk6Jpx7hpPze8pAY7RxKh7wRPG0Yz8wqc2nzJGWhhKPHPuM2Vaq 1I5kSSl0sc7PbuzqU0fNWITYps1NFX8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1678271551; h=from:from:reply-to: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=slrp0uiSw7eFn7aIOmxvfPstAn62960JCbq0WPndXCU=; b=ZLj1TBaPOlb4JXDElJrqPSeTp6BJaFxUBODe6DPjEt/8rDb2EqWsxCVQyHESPn7zSoz80C SJfLr0nP4Szl1ZDA== 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 CD1731391B; Wed, 8 Mar 2023 10:32:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QpM7MT9kCGTIXwAAMHmgww (envelope-from ); Wed, 08 Mar 2023 10:32:31 +0000 From: Martin Jambor To: GCC Patches Cc: Jan Hubicka Subject: Re: [PATCH 1/2] ipa-cp: Fix various issues in update_specialized_profile (PR 107925) In-Reply-To: References: User-Agent: Notmuch/0.37 (https://notmuchmail.org) Emacs/28.2 (x86_64-suse-linux-gnu) Date: Wed, 08 Mar 2023 11:32:31 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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: Hello, I'd like to ping the patch below. Martin On Tue, Feb 21 2023, Martin Jambor wrote: > Hi, > > the patch below fixes various issues in function > update_specialized_profile. The main is removal of the assert which > is bogus in the case of recursive cloning. The division of > unexplained counts is guesswork, which then leads to updates of counts > of recursive edges, which then can be redirected to the new clone and > their count subtracted from the count and there simply may not be > enough left in the count of the original node - especially when we > clone a lot because of using --param ipa-cp-eval-threshold=1. > > The other issue was omission to drop the count of the original node to > ipa count. And when calculating the remainder, we should use > lenient_count_portion_handling to account for partial train runs. > Finally, the patch adds dumping of the original count which I think > is useful. > > Profiled-LTO-bootstrapped on its own and also normally bootstrapped and > tested together with the subsequent patch on an x86_64-linux. OK for > master and the 12 branch - assuming it is also affected? > > Thanks, > > Martin > > > gcc/ChangeLog: > > 2023-02-17 Martin Jambor > > PR ipa/107925 > * ipa-cp.cc (update_specialized_profile): Drop orig_node_count to > ipa count, remove assert, lenient_count_portion_handling, dump > also orig_node_count. > --- > gcc/ipa-cp.cc | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc > index 4b8dedc0c51..5a6b41cf2d6 100644 > --- a/gcc/ipa-cp.cc > +++ b/gcc/ipa-cp.cc > @@ -5093,22 +5093,24 @@ update_specialized_profile (struct cgraph_node *new_node, > profile_count redirected_sum) > { > struct cgraph_edge *cs; > - profile_count new_node_count, orig_node_count = orig_node->count; > + profile_count new_node_count, orig_node_count = orig_node->count.ipa (); > > if (dump_file) > { > fprintf (dump_file, " the sum of counts of redirected edges is "); > redirected_sum.dump (dump_file); > + fprintf (dump_file, "\n old ipa count of the original node is "); > + orig_node_count.dump (dump_file); > fprintf (dump_file, "\n"); > } > if (!(orig_node_count > profile_count::zero ())) > return; > > - gcc_assert (orig_node_count >= redirected_sum); > - > new_node_count = new_node->count; > new_node->count += redirected_sum; > - orig_node->count -= redirected_sum; > + orig_node->count > + = lenient_count_portion_handling (orig_node->count - redirected_sum, > + orig_node); > > for (cs = new_node->callees; cs; cs = cs->next_callee) > cs->count += cs->count.apply_scale (redirected_sum, new_node_count); > -- > 2.39.1