JDK-8226721 : Missing intrinsics for Math.ceil, floor, rint
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11.0.3,14
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux_ubuntu
  • CPU: x86_64
  • Submitted: 2019-06-24
  • Updated: 2023-07-24
  • Resolved: 2019-10-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 14
11.0.12Fixed 13.0.4Fixed 14 b17Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
Ivy Bridge (SSE4.1, SSE4.2, AVX)
11.0.3+7-Ubuntu-1ubuntu218.04.1
JDK 11.0.3, OpenJDK 64-Bit Server VM

A DESCRIPTION OF THE PROBLEM :
The Math class lacks intrinsic implementations of the double precision fp rounding methods: ceil, floor, rint.

On x86 SSE/AVX systems; It would be preferable to utilize instructions 'roundsd' rather than the default jdk implementation.
Since there's also a packed variation, '(v)roundpd', the use of intrinsics may enable auto-vectorization where currently such optimization is obstructed by the default implementations of Math.ceil, floor, rint.



Comments
Hi [~clanger], JDK-8231713 is updated to backport it to 11u. The webrev is provided as well. Thanks, Evgeny
04-05-2021

[~eastigeevich], could you please also backport JDK-8231713 together with this one?
03-05-2021

Fix Request(11u): The intrinsics will improve performance of applications using ceil, floor, rint of Math. The original patch does not apply cleanly to 11u. The update to the patch is to reposition the changes to five files. The content of the patch is not changed. 11u RFR: https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2021-April/006010.html Webrev: http://cr.openjdk.java.net/~eastigeevich/8226721/webrev.00/
30-04-2021

Fix Request [13u] Besides code alignment reasons, those intrinsics provides performance improvements on particular tasks https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-June/003278.html webrev http://cr.openjdk.java.net/~snazarki/webrev/8226721/
10-06-2020

This breaks x86_32 build, see JDK-8231713.
01-10-2019

URL: https://hg.openjdk.java.net/jdk/jdk/rev/6fc57e391539 User: neliasso Date: 2019-10-01 09:48:07 +0000
01-10-2019

Latest webrev: http://cr.openjdk.java.net/~jbhateja/8226721/webrev.08/ Also updated CheckGraalIntrinsics.java Rerunning tests.
30-09-2019

Follow up graal issues has been created https://bugs.openjdk.java.net/browse/JDK-8230835
11-09-2019

Hi Sandhya, Please find a patch with the following changes. 1) Intrinsification for Math.ceil/floor/rint. 2) Auto-vectorizer handling. 3) Benchmark. http://cr.openjdk.java.net/~jbhateja/8226721/webrev.06 Kindly sponsor the patch if the changes looks fine.
08-09-2019

Please ensure these intrinsics applied in jdk.internal.vm.compiler (Graal) either in this issue or a follow up issue. As an example of how to do this, you can look at https://github.com/oracle/graal/pull/1171
04-09-2019