This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/1] Add IFUNC POWER optimization for e_pow and e_exp
- From: "Tulio Magno Quites Machado Filho" <tuliom at linux dot vnet dot ibm dot com>
- To: "Juvenal A. Silva Jr" <juvenal dot silva dot jr at gmail dot com>, libc-alpha at sourceware dot org
- Cc:
- Date: Wed, 20 Sep 2017 18:00:01 -0300
- Subject: Re: [PATCH 1/1] Add IFUNC POWER optimization for e_pow and e_exp
- Authentication-results: sourceware.org; auth=none
- References: <20170709182430.91459-1-juvenal.silva.jr@gmail.com> <20170709182430.91459-2-juvenal.silva.jr@gmail.com>
"Juvenal A. Silva Jr" <juvenal.silva.jr@gmail.com> writes:
> 2017-01-31 Juvenal A. Silva Jr. <juvenal.silva.jr@gmail.com>
>
> * sysdeps/ieee754/dbl-64/e-pow.c: Fix a comment aligment problem.
> * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile: Add entries for
> custom build of CPU specific versions of e_pow and e_exp.
> * sysdeps/powerpc/powerpc64/fpu/multiarch/e_pow.c: New file
> * sysdeps/powerpc/powerpc64/fpu/multiarch/e_pow-ppc64.c: New file.
> * sysdeps/powerpc/powerpc64/fpu/multiarch/e_pow-power7.c: New file.
> * sysdeps/powerpc/powerpc64/fpu/multiarch/e_pow-power8.c: New file.
> * sysdeps/powerpc/powerpc64/fpu/multiarch/e_pow-power9.c: New file.
> * sysdeps/powerpc/powerpc64/fpu/multiarch/slowpow-ppc64.c: New file.
> * sysdeps/powerpc/powerpc64/fpu/multiarch/slowpow-power7.c: New file.
> * sysdeps/powerpc/powerpc64/fpu/multiarch/slowpow-power8.c: New file.
> * sysdeps/powerpc/powerpc64/fpu/multiarch/slowpow-power9.c: New file.
> * sysdeps/powerpc/powerpc64/fpu/multiarch/e_exp.c: New file
> * sysdeps/powerpc/powerpc64/fpu/multiarch/e_exp-ppc64.c: New file.
> * sysdeps/powerpc/powerpc64/fpu/multiarch/e_exp-power7.c: New file.
There has been a recent contribution of e_exp-ppc64 and e_exp-power7.
So, I had to remove both files from your patch before applying it.
> * sysdeps/powerpc/powerpc64/fpu/multiarch/e_exp-power8.c: New file.
> * sysdeps/powerpc/powerpc64/fpu/multiarch/e_exp-power9.c: New file.
In my tests using the benchtests, both these functions were not able to beat
the current implementation from e_exp-power7.c.
> diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
> index d6f14f360a..8bd508747b 100644
> --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
> +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
> @@ -27,7 +27,11 @@ libm-sysdep_routines += s_isnan-power7 s_isnan-power6x s_isnan-power6 \
> s_llrint-power8 s_llround-power8 s_llroundf-ppc64 \
> e_expf-power8 e_expf-ppc64 \
> s_sinf-ppc64 s_sinf-power8 \
> - s_cosf-ppc64 s_cosf-power8
> + s_cosf-ppc64 s_cosf-power8 \
> + slowpow-power7 slowpow-power8 slowpow-power9 slowpow-ppc64 \
> + e_pow-power7 e_pow-power8 e_pow-power9 e_pow-ppc64 \
> + slowexp-power7 slowexp-power8 slowexp-power9 slowexp-ppc64 \
> + e_exp-power7 e_exp-power8 e_exp-power9 e_exp-ppc64
>
> CFLAGS-s_logbf-power7.c = -mcpu=power7
> CFLAGS-s_logbl-power7.c = -mcpu=power7
> @@ -36,6 +40,18 @@ CFLAGS-s_modf-power5+.c = -mcpu=power5+
> CFLAGS-s_modff-power5+.c = -mcpu=power5+
> CFLAGS-e_hypot-power7.c = -mcpu=power7
> CFLAGS-e_hypotf-power7.c = -mcpu=power7
> +CFLAGS-slowpow-power7.c = -mcpu=power7
> +CFLAGS-slowpow-power8.c = -mcpu=power8
> +CFLAGS-slowpow-power9.c = -mcpu=power9
> +CFLAGS-e_pow-power7.c = -mcpu=power7
> +CFLAGS-e_pow-power8.c = -mcpu=power8
> +CFLAGS-e_pow-power9.c = -mcpu=power9
The default pow() implementation must not be compiled this way. It requires
to use $(config-cflags-nofma) in order to avoid increasing the error of the
function too much (165 ulp).
Unfortunately, after using it, there is no performance improvement.
--
Tulio Magno