[PATCH] x86_64: Add sinh with FMA

Florian Weimer fw@deneb.enyo.de
Sun Aug 20 14:28:31 GMT 2023


* H. J. Lu via Libc-alpha:

> On Thu, Aug 17, 2023 at 12:15 PM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> * H. J. Lu via Libc-alpha:
>> > 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?

So the baseline is the before column from the original patch?

> On Skylake, it improves sinh bench performance by:
> 
>         Before       After     Improvement
> max     64.06        60.416       7%
> min     10.874       9.674        11%
> mean    14.0546      12.2018      13%

So we go from 14.0546 to 12.6288 for the mean case?


More information about the Libc-alpha mailing list