[PATCH] x86_64: Add sinh with FMA
H.J. Lu
hjl.tools@gmail.com
Thu Aug 17 19:21:50 GMT 2023
On Thu, Aug 17, 2023 at 12:15 PM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu via Libc-alpha:
>
> > On Wed, Aug 16, 2023 at 7:45 AM Paul Zimmermann
> > <Paul.Zimmermann@inria.fr> wrote:
> >>
> >> Hi H.J.,
> >>
> >> I get no improvement in accuracy. The largest known ulp error is still
> >> the same:
> >>
> >> sinh 0 -1 -0x1.633c654fee2bap+9 [2] [1.93] 1.92222 1.922214006544865
> >>
> >> Maybe the FMA is not used for large inputs?
> >>
> >
> > There is only one FMA insn in __ieee754_sinh_fma:
> >
> > 114: c4 e2 e9 9b 05 00 00 00 00 vfmsub132sd 0x0(%rip),%xmm2,%xmm0
> >
> > Since it calls __ieee754_exp and __expm1, with
> >
> > commit 1b214630ce6f7e0099b8b6f87246246739b079cf (master)
> > Author: H.J. Lu <hjl.tools@gmail.com>
> > Date: Fri Aug 11 08:04:08 2023 -0700
> >
> > x86_64: Add expm1 with FMA
> >
> > On Skylake, it improves expm1 bench performance by:
> >
> > Before After Improvement
> > max 70.204 68.054 3%
> > min 20.709 16.2 22%
> > mean 22.1221 16.7367 24%
> >
> > There is very little improvement with a single FMA insn.
>
> If you specialize the implementation for FMA, could you avoid the
> indirect call to __ieee754_exp and __expm1?
>
That is true. Performance differences are
1. Non-FMA
"sinh": {
"": {
"duration": 1.60856e+09,
"iterations": 1.248e+08,
"max": 173.747,
"min": 10.706,
"mean": 12.8891
}
}%
2. FMA
"sinh": {
"": {
"duration": 1.61017e+09,
"iterations": 1.275e+08,
"max": 100.218,
"min": 9.678,
"mean": 12.6288
}
}%
FMA is a little faster. Should I repost it with updated performance
numbers?
--
H.J.
More information about the Libc-alpha
mailing list