From: Jan Hubicka <hubicka@ucw.cz>
To: Richard Biener <richard.guenther@gmail.com>
Cc: gcc-patches@gcc.gnu.org, rguenther@suse.cz
Subject: Re: Fix optimize_mask_stores profile update
Date: Fri, 21 Jul 2023 19:34:12 +0200 [thread overview]
Message-ID: <ZLrBlCO9ShQAbhxP@kam.mff.cuni.cz> (raw)
In-Reply-To: <CAFiYyc3xOOcuwG8F8jjywN6zp7FY-q5T-0FW=XhWfyjsxNVJCg@mail.gmail.com>
> On Mon, Jul 17, 2023 at 12:36 PM Jan Hubicka via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
> >
> > Hi,
> > While looking into sphinx3 regression I noticed that vectorizer produces
> > BBs with overall probability count 120%. This patch fixes it.
> > Richi, I don't know how to create a testcase, but having one would
> > be nice.
> >
> > Bootstrapped/regtested x86_64-linux, commited last night (sorry for
> > late email)
>
> This should trigger with sth like
>
> for (i)
> if (cond[i])
> out[i] = 1.;
>
> so a masked store and then using AVX2+. ISTR we disable AVX masked
> stores on zen (but not AVX512).
Richard,
if we know probability of if (cond[i]) to be p,
then we know that the combined conditional is somewhere between
low = p (the strategy packing true and falses into VF sized
blocks)
and
high = min (p*vf,1)
(the stragegy doing only one true per block if possible)
Likely value is
likely = 1-pow(1-p, vf)
I wonder if we can work out p at least in common cases.
Making store unlikely as we do right now will place it offline with
extra jump. Making it likely is better unless p is very small.
I think if p is close to 0 or 1 which may be common case the analysis
above may be useful. If range [low...high] is small, we can use likely
and keep it as reliable.
If it is high, we can probably just end up with guessed value close but
above 50% so the store stays inline.
Honza
next prev parent reply other threads:[~2023-07-21 17:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 10:35 Jan Hubicka
2023-07-17 10:49 ` Richard Biener
2023-07-17 12:38 ` Jan Hubicka
2023-07-17 13:26 ` Richard Biener
2023-07-21 17:34 ` Jan Hubicka [this message]
2023-07-24 7:28 ` Richard Biener
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=ZLrBlCO9ShQAbhxP@kam.mff.cuni.cz \
--to=hubicka@ucw.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.cz \
--cc=richard.guenther@gmail.com \
/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).