From: "H.J. Lu" <hjl.tools@gmail.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>,
Paul Zimmermann <Paul.Zimmermann@inria.fr>
Subject: Re: [PATCH] x86_64: Add sinh with FMA
Date: Thu, 17 Aug 2023 12:21:50 -0700 [thread overview]
Message-ID: <CAMe9rOrfesG-bNTe4BdySCjHXpRtW9misb2rv3dhHS25j_0O9A@mail.gmail.com> (raw)
In-Reply-To: <87bkf5pjjp.fsf@oldenburg.str.redhat.com>
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.
next prev parent reply other threads:[~2023-08-17 19:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 15:16 H.J. Lu
2023-08-14 15:50 ` Andreas Schwab
2023-08-14 15:57 ` H.J. Lu
2023-08-14 16:06 ` Andreas Schwab
2023-08-16 14:45 ` Paul Zimmermann
2023-08-16 17:23 ` H.J. Lu
2023-08-17 19:15 ` Florian Weimer
2023-08-17 19:21 ` H.J. Lu [this message]
2023-08-20 14:28 ` Florian Weimer
2023-08-20 14:29 ` H.J. Lu
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=CAMe9rOrfesG-bNTe4BdySCjHXpRtW9misb2rv3dhHS25j_0O9A@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=Paul.Zimmermann@inria.fr \
--cc=fweimer@redhat.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).