From: Sunil Pandey <skpgkp2@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: abush wang <abushwangs@gmail.com>,
Noah Goldstein <goldstein.w.n@gmail.com>,
abushwang via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: x86-64: strlen-evex performance performance degradation compared to strlen-avx2
Date: Tue, 30 Apr 2024 13:16:54 -0700 [thread overview]
Message-ID: <CAMAf5_cDP_Cypktg6Xu2-q6d1roc0CO4YOiY2hryXyQzi=5NPQ@mail.gmail.com> (raw)
In-Reply-To: <CAMe9rOqjSmKOGyghRhZJcJz3woEH0CbOC_PAm4UaJiPuuChgag@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 6778 bytes --]
On Mon, Apr 29, 2024 at 7:52 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Apr 29, 2024 at 5:55 PM Sunil Pandey <skpgkp2@gmail.com> wrote:
> >
> >
> >
> > On Mon, Apr 29, 2024 at 1:20 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >>
> >> On Mon, Apr 29, 2024 at 10:42 AM Sunil Pandey <skpgkp2@gmail.com>
> wrote:
> >> >
> >> >
> >> >
> >> > On Sun, Apr 28, 2024 at 9:17 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >> >>
> >> >> On Sun, Apr 28, 2024 at 9:13 AM Sunil Pandey <skpgkp2@gmail.com>
> wrote:
> >> >> >
> >> >> >
> >> >> >
> >> >> > On Sat, Apr 27, 2024 at 7:13 PM abush wang <abushwangs@gmail.com>
> wrote:
> >> >> >>
> >> >> >> Actually, I was handling performance issue from libmicro in our
> distro OS.
> >> >> >> I found that the performance degradation of localtime_r benchmark
> from libmicro is blame to strlen.
> >> >> >> So I abstracted this test case.
> >> >> >>
> >> >> >
> >> >> > Can you consistently reproduce strlen perf behaviour by running
> multiple times back-to-back?
> >> >> >
> >> >> > You can see high swing from run
> >> >>
> >> >> Hi Sunil,
> >> >>
> >> >> Intel(R) Xeon(R) Gold 6133 CPU @ 2.50GHz is SKX. Please add this
> test to
> >> >> benchtests/bench-strlen.c and check its performance on SKX.
> >> >>
> >> >> --
> >> >> H.J.
> >> >
> >> >
> >> > I collected the glibc micro-benchmark data for the string length in
> question.
> >> >
> >> > 2.38 evex data:
> >> >
> >> > length=4, alignment=4: 4.40
> >> > length=4, alignment=0: 4.29
> >> > length=4, alignment=0: 3.64
> >> > length=4, alignment=7: 3.64
> >> > length=4, alignment=2: 3.64
> >> >
> >> > 2.28 evex data:
> >> >
> >> > Length 4, alignment 4: 6.46875
> >> > Length 4, alignment 0: 6.5
> >> > Length 4, alignment 0: 6.53125
> >> > Length 4, alignment 7: 6.46875
> >> > Length 4, alignment 2: 6.53125
> >> >
> >> > Data collected on Machine: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
> >> >
> >> > 2.38 perf numbers are better than 2.28 as expected.
> >>
> >> 1. Please compare AVX2 vs EVEX strlen on glibc master branch.
> >> 2. Please check strlen on strings of length == 4 and alignments = 0, 1,
> 2, 3.
> >>
> >> --
> >> H.J.
> >
> >
> > Data from master branch:
> >
> > Data collected on Machine: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
> >
> > __strlen_evex __strlen_avx2
> > =======================================================
> > length=4, alignment=0: 5.00 5.11
> > length=4, alignment=1: 4.92 4.80
> > length=4, alignment=2: 4.82 4.62
> > length=4, alignment=3: 4.62 4.92
> > length=4, alignment=4: 4.44 4.44
> > length=4, alignment=5: 4.59 4.29
> > length=4, alignment=6: 4.39 4.29
> > length=4, alignment=7: 4.14 4.14
> > length=4, alignment=8: 4.19 4.00
> > length=4, alignment=9: 4.00 4.00
> > length=4, alignment=10: 4.31 3.87
> > length=4, alignment=11: 3.96 3.87
> > length=4, alignment=12: 3.86 3.75
> > length=4, alignment=13: 3.75 3.75
> > length=4, alignment=14: 3.64 3.64
> > length=4, alignment=15: 3.64 3.72
> > length=4, alignment=16: 3.64 3.53
> > length=4, alignment=17: 3.63 3.53
> > length=4, alignment=18: 4.12 3.53
> > length=4, alignment=19: 3.43 3.43
> > length=4, alignment=20: 3.43 3.43
> > length=4, alignment=21: 3.33 3.33
> > length=4, alignment=22: 3.33 3.42
> > length=4, alignment=23: 3.33 3.33
> > length=4, alignment=24: 3.33 3.33
> > length=4, alignment=25: 3.33 3.33
> > length=4, alignment=26: 3.96 3.33
> > length=4, alignment=27: 3.33 3.41
> > length=4, alignment=28: 3.33 3.33
> > length=4, alignment=29: 3.41 3.33
> > length=4, alignment=30: 3.33 3.41
> > length=4, alignment=31: 3.33 3.33
> >
> > --Sunil
>
> Hi Sunil,
>
> strlen-avx2.S in glibc 2.28 release (tag glibc-2.28) is
> different from strlen-avx2.S on master branch. Please
> compare their performances.
>
> --
> H.J.
>
I tested strlen implementations with different alignment combinations.
_strlen_evex(master) __strlen_avx2(master)
__strlen_avx2(2.28)
==========================================================
length=4, alignment=0: 5.00 5.09 8.00
length=4, alignment=1: 4.80 4.80 7.78
length=4, alignment=2: 4.71 4.62 7.46
length=4, alignment=3: 4.44 4.55 7.11
length=4, alignment=4: 4.44 4.45 7.23
length=4, alignment=5: 4.29 4.29 6.86
length=4, alignment=6: 4.14 4.14 6.76
length=4, alignment=7: 4.00 4.00 6.40
length=4, alignment=8: 4.00 4.00 6.50
length=4, alignment=9: 3.87 3.87 6.29
length=4, alignment=10: 3.75 3.85 6.00
length=4, alignment=11: 3.75 3.75 6.00
length=4, alignment=12: 3.76 3.64 5.82
length=4, alignment=13: 3.64 3.64 6.08
length=4, alignment=14: 3.53 3.53 5.74
length=4, alignment=15: 3.53 3.53 5.74
length=4, alignment=16: 3.43 3.43 5.57
length=4, alignment=17: 3.43 3.43 5.67
length=4, alignment=18: 3.33 3.33 5.41
length=4, alignment=19: 3.33 3.33 5.44
length=4, alignment=20: 3.33 3.33 5.41
length=4, alignment=21: 3.33 3.33 5.43
length=4, alignment=22: 3.33 3.33 5.41
length=4, alignment=23: 3.33 3.33 5.41
length=4, alignment=24: 3.33 3.33 5.33
length=4, alignment=25: 3.41 3.33 5.33
length=4, alignment=26: 3.86 3.33 5.33
length=4, alignment=27: 3.42 3.33 5.33
length=4, alignment=28: 3.33 3.33 5.33
length=4, alignment=29: 3.33 3.33 5.33
length=4, alignment=30: 3.33 3.33 5.33
length=4, alignment=31: 3.33 3.33 5.33
Based on the data
- avx2/evex version in master is faster than avx2 version in glibc-2.28 as
expected.
--Sunil
[-- Attachment #2: Type: text/html, Size: 9541 bytes --]
next prev parent reply other threads:[~2024-04-30 20:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-26 4:03 x86-64: strlen-evex performance performance degradation compared to strlen-avx2 abush wang
2024-04-26 13:30 ` H.J. Lu
2024-04-26 16:53 ` Sunil Pandey
2024-04-28 2:13 ` abush wang
2024-04-28 16:12 ` Sunil Pandey
2024-04-28 16:16 ` H.J. Lu
2024-04-29 17:41 ` Sunil Pandey
2024-04-29 20:19 ` H.J. Lu
2024-04-30 0:54 ` Sunil Pandey
2024-04-30 2:51 ` H.J. Lu
2024-04-30 20:16 ` Sunil Pandey [this message]
2024-04-28 2:06 ` abush wang
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
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAMAf5_cDP_Cypktg6Xu2-q6d1roc0CO4YOiY2hryXyQzi=5NPQ@mail.gmail.com' \
--to=skpgkp2@gmail.com \
--cc=abushwangs@gmail.com \
--cc=goldstein.w.n@gmail.com \
--cc=hjl.tools@gmail.com \
--cc=libc-alpha@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).