public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: bin.cheng@linux.alibaba.com, Jan Hubicka <hubicka@ucw.cz>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH AutoFDO/2]Treat ZERO as common profile probability/count
Date: Wed, 31 Oct 2018 09:43:00 -0000	[thread overview]
Message-ID: <CAFiYyc0Dj7y4fe8Jj9JGZp3xh0h=vEbohs7kccO5RsXe5u4GNg@mail.gmail.com> (raw)
In-Reply-To: <7f153787-f390-4661-92aa-06d47cefbbf5.bin.cheng@linux.alibaba.com>

On Wed, Oct 31, 2018 at 7:30 AM bin.cheng <bin.cheng@linux.alibaba.com> wrote:
>
> Hi,
> In new profile probability/count infra, we have different precision quality categories,
> and probabilities/counts of different categories are not supposed to be compared or
> calculated.  Though in general is an improvement, it introduces unexpected behavior.
> Specifically, class profile_probablity and profile_count themselves are implemented
> by comparing probabilities/counts against profile_count::zero().  while zero() is of
> profile_precision category, it's always compared different to zero of other precision
> categories including afdo.
>
> I can see two ways fixing this: 1) Treat zero as a common probability/count regardless
> of its category; 2) Provide an "is_zero" method rather than relying on "==" comparison
> against probability_count::zero().  2) requires lots of code changes so I went with 1)
> in this patch set.  This patch doesn't handle "always" but it might be.
>
> This patch also corrects a minor issue where we try to invert an uninitialized value.
>
> Bootstrap and test on x86_64 in patch set.  Is it OK?

I'll defer on the emit_store_flag_force change, likewise for the zero
handling in
compares - I don't think zeros of different qualities should compare equal.
Would compares against ::always() not have the very same issue?
Likewise ::even(),
::likely(), etc.?  Those always get guessed quality.

The invert change looks OK to me.  The related change to the always() API would
suggest to replace guessed_always() with always (guessed) and also do similar
changes throughout the whole API...

Honza?

Thanks,
Richard.


> Thanks,
> bin
>
> 2018-10-31  Bin Cheng  <bin.cheng@linux.alibaba.com>
>
>         * expmed.c (emit_store_flag_force): Use profile_probability::always.
>         * profile-count.h (profile_probability::always): Add parameter.
>         (profile_probability::operator==, profile_count::operator==): Treat
>         ZERO as common probability/count regardless of its quality.
>         (profile_probability::invert): Don't invert uninitialized probability.

  reply	other threads:[~2018-10-31  9:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-31  8:33 bin.cheng
2018-10-31  9:43 ` Richard Biener [this message]
2018-10-31  9:57   ` Bin.Cheng
2018-11-02  5:31   ` bin.cheng
2018-11-05 14:38     ` Jan Hubicka
2018-11-05 14:40     ` Jan Hubicka
2018-11-13  6:58       ` Bin.Cheng
     [not found]   ` <20181105141206.4ncu3s2v2jxv6o54@kam.mff.cuni.cz>
2018-11-20 10:54     ` bin.cheng
     [not found]       ` <CAHFci28CQB3KK+Yp7gb8BR61UaGhAJJ-R1yzZPHxitczvgEB3w@mail.gmail.com>
2018-11-28 16:20         ` Jan Hubicka
2018-12-04  8:40           ` Bin.Cheng
2018-12-07 10:00             ` Bin.Cheng
2018-12-07 16:57               ` Jan Hubicka
2018-12-09  6:40                 ` Bin.Cheng
2018-10-31 15:02 ` Jeff Law
2018-11-01  1:11   ` Bin.Cheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFiYyc0Dj7y4fe8Jj9JGZp3xh0h=vEbohs7kccO5RsXe5u4GNg@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=bin.cheng@linux.alibaba.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).