public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "goldstein.w.n at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug string/26852] aarch64/strcmp has performance regression for some cases
Date: Tue, 15 Mar 2022 17:33:29 +0000	[thread overview]
Message-ID: <bug-26852-131-NYqugu3RJR@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26852-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=26852

--- Comment #11 from Noah Goldstein <goldstein.w.n at gmail dot com> ---
(In reply to Wilco from comment #10)
> (In reply to Noah Goldstein from comment #9)
> > (In reply to yangyanchao6@huawei.com from comment #8)
> 
> > > - .p2align 4
> > > -
> > > L(loop_aligned):
> > > ldr data2, [src1, off2]
> > > ldr data1, [src1], 8
> > > 
> > > I removed the first alignment in strcmp and the 300% performance degradation
> > > disappeared.
> > 
> > Not an expert of the microarch but that sounds like a benchmark artifact.
> > Possibly check the decode path? If the change in alignment causes decode
> > to run / not-run out of the trace cache that would severely impact the
> > benchmark but not necessarily affect real-world performance (where
> > presumably strcmp is just run back-to-back-to-back in a loop).
> 
> As reported it does also occur in Dhrystone, so it's not due to calling
> strcmp in a tiny loop. It seems like an issue with the branch predictor not
> learning to predict certain loops. The question is whether the proposed
> workaround means all sizes now work without misprediction. Other string
> functions use small loops as well and compiled code will be affected too, so
> it's not clear to me there is an easy fix here.

Well whats causing the mispredictions? Clobber in the BHT?

By decode I was wondering if there was something like the
loop-stream-detector in aarch64. On x86 entering the LSD is
related to code alignment and can cause a spike in branch-misses
because its implemented s.t the only way to exit LSD decode 'mode'
is a branch-miss.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2022-03-15 17:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-09  8:10 [Bug string/26852] New: " xuchunmei at linux dot alibaba.com
2020-11-09  8:12 ` [Bug string/26852] " xuchunmei at linux dot alibaba.com
2020-11-09  8:13 ` xuchunmei at linux dot alibaba.com
2020-11-09 10:30 ` nsz at gcc dot gnu.org
2020-11-09 12:53 ` xuchunmei at linux dot alibaba.com
2020-11-09 13:06 ` wdijkstr at arm dot com
2020-11-09 13:08 ` wdijkstr at arm dot com
2020-11-10  1:46 ` xuchunmei at linux dot alibaba.com
2020-11-10 12:53 ` wdijkstr at arm dot com
2022-02-23  3:22 ` yangyanchao6 at huawei dot com
2022-02-23  3:29 ` yangyanchao6 at huawei dot com
2022-03-05 19:31 ` goldstein.w.n at gmail dot com
2022-03-15 17:04 ` wdijkstr at arm dot com
2022-03-15 17:33 ` goldstein.w.n at gmail dot com [this message]
2022-03-16 18:53 ` wdijkstr at arm dot com

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=bug-26852-131-NYqugu3RJR@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.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).