RFR: 8265768 [aarch64] Use glibc libm impl for dlog, dlog10, dexp iff 2.29 or greater on AArch64.
Joe Darcy
joe.darcy at oracle.com
Tue Apr 27 19:06:44 UTC 2021
Assuming the intention is to replace the current code/intrinsics used
for Math.{log, log10, exp} etc., this review should also be sent to
core-libs.
Thanks,
-Joe
On 4/23/2021 2:22 AM, gregcawthorne wrote:
> Glibc 2.29 onwards provides optimised versions of log,log10,exp.
> These functions have an accuracy of 0.9ulp or better in glibc
> 2.29.
>
> Therefore this patch adds code to parse, store and check
> the runtime glibcs version in os_linux.cpp/hpp.
> This is then used to select the glibcs implementation of
> log, log10, exp at runtime for c1 and c2, iff we have
> glibc 2.29 or greater.
>
> This will ensure OpenJDK can benefit from future improvements
> to glibc.
>
> Glibc adheres to the ieee754 standard, unless stated otherwise
> in its spec.
>
> As there are no stated exceptions in the current glibc spec
> for dlog, dlog10 and dexp, we can assume they currently follow
> ieee754 (which testing confirms). As such, future version of
> glibc are unlikely to lose this compliance with ieee754 in
> future.
>
> W.r.t performance this patch sees ~15-30% performance improvements for
> log and log10, with ~50-80% performance improvements for exp for the
> common input ranged (which output real numbers). However for the NaN
> and inf output ranges we see a slow down of up to a factor of 2 for
> some functions and architectures.
>
> Due to this being the uncommon case we assert that this is a
> worthwhile tradeoff.
>
> -------------
>
> Commit messages:
> - Use glibc libm impl for dlog,dlog10,dexp iff 2.29 or greater on AArch64.
>
> Changes: https://git.openjdk.java.net/jdk/pull/3510/files
> Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3510&range=00
> Issue: https://bugs.openjdk.java.net/browse/JDK-8265768
> Stats: 85 lines in 7 files changed: 79 ins; 5 del; 1 mod
> Patch: https://git.openjdk.java.net/jdk/pull/3510.diff
> Fetch: git fetch https://git.openjdk.java.net/jdk pull/3510/head:pull/3510
>
> PR: https://git.openjdk.java.net/jdk/pull/3510
More information about the hotspot-dev
mailing list