RFR: 8210416: [linux] Poor StrictMath performance due to non-optimized compilation
Gustavo Romero
gromero at linux.vnet.ibm.com
Wed Sep 5 19:43:21 UTC 2018
Hello,
On 09/05/2018 04:15 PM, joe darcy wrote:
> Hello,
>
>
> On 9/5/2018 6:12 AM, Severin Gehwolf wrote:
>> Hi,
>>
>> Cross-posting this review-thread on core-libs-dev and build-dev as this
>> is a build change, but affects fdlibm which is core-libs.
>>
>> With JDK-8170153 optimization for fdlibm code has been turned on for
>> ppc64 s390 and aarch64. This patch intends to turn it on on all arches
>> on Linux. I've not observed any precision issues. Is there a good
>> reason to not use -O3 -ffp-contract=off everywhere?
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8210416
>> webrev: http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8210416/webrev.01/
>>
>> Testing: - java/lang/Math, java/lang/StrictMath tests (all pass).
>> - Currently running through submit repo.
>>
>> A simple micro benchmark from JDK-8170153[1] shows these numbers for
>> StrictMath:
>>
>> Function | before | after
>> ----------------------------------------------
>> sin | 0m33.382s | 0m18.731s
>> cos | 0m31.562s | 0m18.796s
>> tan | 0m33.657s | 0m21.093s
>> atan | 0m5.714s | 0m4.902s
>> log | 0m6.212s | 0m4.439s
>> log10 | 0m7.946s | 0m5.543s
>> sqrt | 0m0.481s | 0m0.449s
>> cbrt | 0m5.295s | 0m5.214s
>> tanh | 0m1.404s | 0m1.307s
>> log1p | 0m6.457s | 0m5.131s
>> IEEEremainder | 0m10.629s | 0m6.048s
>> atan2 | 0m8.037s | 0m5.668s
>> hypot | 0m2.171s | 0m2.147s
>>
>>
>
> Note that pow (JDK-8134795), hypot (JDK-7130085), cbrt (JDK-8136799), and exp (JDK-8139688), have been ported to Java as of JDK 9. The sqrt method is commonly handled as an intrinsic.
>
> Testing that was not geared toward finding precision/rounding issues would be unlikely to find them.
>
> I don't see the sources of the microbenchmark in JDK-8170153.
The microbench can be found on the first email I sent discussing that issue on Power.
Check it at the end, but there is nothing special in there:
http://mail.openjdk.java.net/pipermail/ppc-aix-port-dev/2016-November/002738.html
There is also some discussing on the formal RFR:
http://mail.openjdk.java.net/pipermail/ppc-aix-port-dev/2016-November/002751.html
Severin, the precision issues were quite conspicuous on Power when -O3 was turned on.
There are some discussions about it in the threads above IIRC. SAP helped to test the
change against additional tests, like TCK.
HTH.
Best regards,
Gustavo
> Cheers,
>
> -Joe
>
More information about the core-libs-dev
mailing list