linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <patch-notifications@ellerman.id.au>
To: wei.guo.simon@gmail.com, linuxppc-dev@lists.ozlabs.org
Cc: "Naveen N.  Rao" <naveen.n.rao@linux.vnet.ibm.com>,
	Simon Guo <wei.guo.simon@gmail.com>,
	Cyril Bur <cyrilbur@gmail.com>
Subject: Re: [v8, 1/5] powerpc/64: Align bytes before fall back to .Lshort in powerpc64 memcmp()
Date: Tue, 24 Jul 2018 23:59:49 +1000 (AEST)	[thread overview]
Message-ID: <41Zg395wSgz9s4Z@ozlabs.org> (raw)
In-Reply-To: <1528336675-10879-2-git-send-email-wei.guo.simon@gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2810 bytes --]

On Thu, 2018-06-07 at 01:57:51 UTC, wei.guo.simon@gmail.com wrote:
> From: Simon Guo <wei.guo.simon@gmail.com>
> 
> Currently memcmp() 64bytes version in powerpc will fall back to .Lshort
> (compare per byte mode) if either src or dst address is not 8 bytes aligned.
> It can be opmitized in 2 situations:
> 
> 1) if both addresses are with the same offset with 8 bytes boundary:
> memcmp() can compare the unaligned bytes within 8 bytes boundary firstly
> and then compare the rest 8-bytes-aligned content with .Llong mode.
> 
> 2)  If src/dst addrs are not with the same offset of 8 bytes boundary:
> memcmp() can align src addr with 8 bytes, increment dst addr accordingly,
>  then load src with aligned mode and load dst with unaligned mode.
> 
> This patch optmizes memcmp() behavior in the above 2 situations.
> 
> Tested with both little/big endian. Performance result below is based on
> little endian.
> 
> Following is the test result with src/dst having the same offset case:
> (a similar result was observed when src/dst having different offset):
> (1) 256 bytes
> Test with the existing tools/testing/selftests/powerpc/stringloops/memcmp:
> - without patch
> 	29.773018302 seconds time elapsed                                          ( +- 0.09% )
> - with patch
> 	16.485568173 seconds time elapsed                                          ( +-  0.02% )
> 		-> There is ~+80% percent improvement
> 
> (2) 32 bytes
> To observe performance impact on < 32 bytes, modify
> tools/testing/selftests/powerpc/stringloops/memcmp.c with following:
> -------
>  #include <string.h>
>  #include "utils.h"
> 
> -#define SIZE 256
> +#define SIZE 32
>  #define ITERATIONS 10000
> 
>  int test_memcmp(const void *s1, const void *s2, size_t n);
> --------
> 
> - Without patch
> 	0.244746482 seconds time elapsed                                          ( +-  0.36%)
> - with patch
> 	0.215069477 seconds time elapsed                                          ( +-  0.51%)
> 		-> There is ~+13% improvement
> 
> (3) 0~8 bytes
> To observe <8 bytes performance impact, modify
> tools/testing/selftests/powerpc/stringloops/memcmp.c with following:
> -------
>  #include <string.h>
>  #include "utils.h"
> 
> -#define SIZE 256
> -#define ITERATIONS 10000
> +#define SIZE 8
> +#define ITERATIONS 1000000
> 
>  int test_memcmp(const void *s1, const void *s2, size_t n);
> -------
> - Without patch
>        1.845642503 seconds time elapsed                                          ( +- 0.12% )
> - With patch
>        1.849767135 seconds time elapsed                                          ( +- 0.26% )
> 		-> They are nearly the same. (-0.2%)
> 
> Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/2d9ee327adce5f6becea2dd51d282a

cheers

  reply	other threads:[~2018-07-24 13:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07  1:57 [PATCH v8 0/5] powerpc/64: memcmp() optimization wei.guo.simon
2018-06-07  1:57 ` [PATCH v8 1/5] powerpc/64: Align bytes before fall back to .Lshort in powerpc64 memcmp() wei.guo.simon
2018-07-24 13:59   ` Michael Ellerman [this message]
2018-06-07  1:57 ` [PATCH v8 2/5] powerpc: add vcmpequd/vcmpequb ppc instruction macro wei.guo.simon
2018-06-07  1:57 ` [PATCH v8 3/5] powerpc/64: enhance memcmp() with VMX instruction for long bytes comparision wei.guo.simon
2018-06-07  1:57 ` [PATCH v8 4/5] powerpc/64: add 32 bytes prechecking before using VMX optimization on memcmp() wei.guo.simon
2018-06-07  1:57 ` [PATCH v8 5/5] powerpc:selftest update memcmp_64 selftest for VMX implementation wei.guo.simon

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=41Zg395wSgz9s4Z@ozlabs.org \
    --to=patch-notifications@ellerman.id.au \
    --cc=cyrilbur@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=wei.guo.simon@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 NNTP newsgroup(s).