From: Jeff Law <law@redhat.com>
To: "bin.cheng" <bin.cheng@linux.alibaba.com>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH AutoFDO/2]Treat ZERO as common profile probability/count
Date: Wed, 31 Oct 2018 15:02:00 -0000 [thread overview]
Message-ID: <e55483fa-4488-db1c-a9ab-dc5c3e38c237@redhat.com> (raw)
In-Reply-To: <7f153787-f390-4661-92aa-06d47cefbbf5.bin.cheng@linux.alibaba.com>
On 10/31/18 12:30 AM, bin.cheng 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?
>
> 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.
>
I'm really not sure the emit_store_flag_force change is right --
essentially without external information I can't see how we can pass in
any probability here other than "we don't know" which is
profile_probability::uninitialized IIUC.
You could potentially make an argument that a 50-50 probability is
reasonable here. That's profile_probability::even. But I just don't
see how profile_probability::always is right here.
jeff
next prev parent reply other threads:[~2018-10-31 14:36 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
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 [this message]
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=e55483fa-4488-db1c-a9ab-dc5c3e38c237@redhat.com \
--to=law@redhat.com \
--cc=bin.cheng@linux.alibaba.com \
--cc=gcc-patches@gcc.gnu.org \
/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).