unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Sunil Pandey <skpgkp2@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: Mon, 29 Apr 2024 19:51:37 -0700	[thread overview]
Message-ID: <CAMe9rOqjSmKOGyghRhZJcJz3woEH0CbOC_PAm4UaJiPuuChgag@mail.gmail.com> (raw)
In-Reply-To: <CAMAf5_d1LzwFv+AuU1Wq20J-+EJPki9Zfb1GF2xtju_psLZk5Q@mail.gmail.com>

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.

  reply	other threads:[~2024-04-30  2:52 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 [this message]
2024-04-30 20:16                   ` Sunil Pandey
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=CAMe9rOqjSmKOGyghRhZJcJz3woEH0CbOC_PAm4UaJiPuuChgag@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=abushwangs@gmail.com \
    --cc=goldstein.w.n@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=skpgkp2@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).