unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Peter Bergner <bergner@linux.ibm.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH] powerpc: Remove power8 strcasestr optimization
Date: Mon, 18 Mar 2024 09:52:28 -0300	[thread overview]
Message-ID: <fefec69f-edf8-42ee-a712-91117b84baa7@linaro.org> (raw)
In-Reply-To: <9e42c217-97ec-4e8f-93dd-17c432934697@linux.ibm.com>



On 15/03/24 16:57, Peter Bergner wrote:
> I'm sorry I haven't replied earlier, but I just got back from vacation.
> I also see you've pushed this already.  That said...
> 
> As with the power7 patch, I'm all for cleanups, especially if they
> simplify things, remove more code than they add, and make things
> faster.
> 
> 
> On 3/5/24 2:13 PM, Adhemerval Zanella wrote:
>> Similar to strstr (1e9a550ba4), power8 strcasestr does not show much
>> improvement compared to the generic implementation.  The geomean
>> on bench-strcasestr shows:
>>
>>             __strcasestr_power8  __strcasestr_ppc
>>   power10                  1159              1120
>>   power9                   1640              1469
>>   power8                   1787              1904
> 
> The generic implementation being the one in string/strcasestr.c,
> correct?  Then how do I read the performance numbers above?

Sorry about that, in fact I created these numbers with an improved
bench-strcasestr.c [1] benchmark based on bench-strstr.c and I forgot
to send it along the patch to remove the power implementation.
With this patch you should be able to use benchtests/scripts/compare_strings.py
to get the numbers.

> 
> When Raji first added the power8 optimized routine, it was
> showing big speedups.  I see that was before Wilco's changes
> to the generic routine.  Do you think that was the main
> reason why the generic implementation is better now?

Yes, but the change was not only motivated by this.  Wilco added
a set of improvements (3ae725dfb6d7f6144 which on aarch64 improved
performance by about 4.3% and 284f42bc778e487dfd5 which improved
by 3-4%). But the main problem with previous implementation was it
used a non-linear vector scan and added a hack (by counting the
iteration on the search) to fallback to generic version.  

This turns to waste a lot of cycles for this tests and it also make
the generic implementation to not take the improvement in the generic
one (not without rewrite it anyway).

We are trying to avoid such 'optimization', since they are really
hard to evaluate if they are not quadratic and we are trying to avoid
such pitfalls in the code.

However, I think there are still room for improvement on powerpc64le
since it uses ifunc for some functions that are not really required
since the minimum ISA is power8 (strnlen, strncat for instance).
We can just setup the built system to use the power8 version and
not provide ifunc variants for LE (as zseries and x86_64-vN are
doing).

> 
> 
> Even though it's already pushed...
> 
> LGTM.
> 
> Reviewed-by: Peter Bergner <bergner@linux.ibm.com>  

Thanks!

> 
> Peter
> 
> 

[1] https://sourceware.org/pipermail/libc-alpha/2024-March/155413.html

      reply	other threads:[~2024-03-18 12:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 20:13 [PATCH] powerpc: Remove power8 strcasestr optimization Adhemerval Zanella
2024-03-12  2:37 ` DJ Delorie
2024-03-15 19:57 ` Peter Bergner
2024-03-18 12:52   ` Adhemerval Zanella Netto [this message]

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=fefec69f-edf8-42ee-a712-91117b84baa7@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=bergner@linux.ibm.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).