public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH AutoFDO]Call update_max_bb_count even if autofdo counts are all zeros
@ 2018-12-13  3:50 bin.cheng
  2018-12-13 18:17 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: bin.cheng @ 2018-12-13  3:50 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 609 bytes --]

Hi,
This patch calls update_max_bb_count even if autofdo counts are all zeros,
otherwise it would trigger ICE because of mismatch between basic blocks'
count (all autofdo::zero) and cfun->cfg->max_count (guessed::non_zero).
For functions with all autofdo::zero counts, we should improve by restoring
guessed profile counts, but this maybe not for GCC-9.

Bootstrap and test on x86_64 along with following patches.  Is it OK?

Thanks,
bin

2018-12-13  Bin Cheng  <bin.cheng@linux.alibaba.com>

        * auto-profile.c (afdo_annotate_cfg): Call update_max_bb_count even
        if autofdo counts are all zeros.

[-- Attachment #2: 0005-Call-update_max_bb_count-even-if-autufdo-counts-are-.patch --]
[-- Type: application/octet-stream, Size: 959 bytes --]

From b5e00cc2faa8fdef5025ae54a97d5575828b3383 Mon Sep 17 00:00:00 2001
From: chengbin <bin.cheng@linux.alibaba.com>
Date: Thu, 13 Dec 2018 10:46:32 +0800
Subject: [PATCH 5/7] Call update_max_bb_count even if autufdo counts are all
 zeros.

---
 gcc/auto-profile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c
index f51a4bf4ce1..d337cbc7200 100644
--- a/gcc/auto-profile.c
+++ b/gcc/auto-profile.c
@@ -1553,9 +1553,9 @@ afdo_annotate_cfg (const stmt_set &promoted_stmts)
     {
       /* Calculate, propagate count and probability information on CFG.  */
       afdo_calculate_branch_prob (&annotated_bb);
-      update_max_bb_count ();
-      profile_status_for_fn (cfun) = PROFILE_READ;
     }
+  update_max_bb_count ();
+  profile_status_for_fn (cfun) = PROFILE_READ;
   if (flag_value_profile_transformations)
     {
       gimple_value_profile_transformations ();
-- 
2.14.4.44.g2045bb6


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH AutoFDO]Call update_max_bb_count even if autofdo counts are all zeros
  2018-12-13  3:50 [PATCH AutoFDO]Call update_max_bb_count even if autofdo counts are all zeros bin.cheng
@ 2018-12-13 18:17 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2018-12-13 18:17 UTC (permalink / raw)
  To: bin.cheng, GCC Patches

On 12/12/18 8:50 PM, bin.cheng wrote:
> Hi,
> This patch calls update_max_bb_count even if autofdo counts are all zeros,
> otherwise it would trigger ICE because of mismatch between basic blocks'
> count (all autofdo::zero) and cfun->cfg->max_count (guessed::non_zero).
> For functions with all autofdo::zero counts, we should improve by restoring
> guessed profile counts, but this maybe not for GCC-9.
> 
> Bootstrap and test on x86_64 along with following patches.  Is it OK?
> 
> Thanks,
> bin
> 
> 2018-12-13  Bin Cheng  <bin.cheng@linux.alibaba.com>
> 
>         * auto-profile.c (afdo_annotate_cfg): Call update_max_bb_count even
>         if autofdo counts are all zeros.
> 
OK.  Though note there may be some kind of skew between your
auto-profile.c and the trunk.  Your patch has a comment just before the
removed calls to update_max_bb_count that isn't on the trunk.

I'm sure you can adjust accordingly.

jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-13 18:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-13  3:50 [PATCH AutoFDO]Call update_max_bb_count even if autofdo counts are all zeros bin.cheng
2018-12-13 18:17 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).