jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8288933: Improve the implementation of Double/Float.isInfinite

Open merykitty opened this issue 3 years ago • 7 comments

Improve the implementation of Double/Float.isInfinite to reduce branching. Using > comparison with MAX_VALUE instead of == with POSITIVE_INFINITY improves code emission on x86 and produces similar code for arm. This is also the way gcc implements std::isinf on x86 and arm (clang uses the pattern Math.abs(v) == POSITIVE_INFINITY on arm).

test/micro/org/openjdk/bench/java/lang/FPComparison.java has been added in #8525, the results are reshown here:

Benchmark                      Mode  Cnt     Score     Error    Score     Error   Unit   Ratio
FPComparison.isInfiniteDouble  avgt    5  1232.800 ±  31.677  621.185 ±  11.935  ns/op    1.98
FPComparison.isInfiniteFloat   avgt    5  1234.708 ±  70.239  623.566 ±  15.206  ns/op    1.98

Thank you very much.


Progress

  • [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue

Issue

  • JDK-8288933: Improve the implementation of Double/Float.isInfinite

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9238/head:pull/9238
$ git checkout pull/9238

Update a local copy of the PR:
$ git checkout pull/9238
$ git pull https://git.openjdk.org/jdk pull/9238/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9238

View PR using the GUI difftool:
$ git pr show -t 9238

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9238.diff

merykitty avatar Jun 22 '22 12:06 merykitty

:wave: Welcome back merykitty! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

bridgekeeper[bot] avatar Jun 22 '22 12:06 bridgekeeper[bot]

@merykitty The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

openjdk[bot] avatar Jun 22 '22 12:06 openjdk[bot]

Webrevs

mlbridge[bot] avatar Jun 22 '22 12:06 mlbridge[bot]

@merykitty, the proposed change is functionally correct.

@cl4es, what set of platforms do we usually consider for evaluating performance changes like this?

jddarcy avatar Jul 14 '22 05:07 jddarcy

@cl4es, what set of platforms do we usually consider for evaluating performance changes like

A mix of x86 and aarch64 systems, some old, some new. We could run the microbenchmark on our internal performance system to verify the reported performance gain. I assume the first score column is the baseline and the second the patched version, so a 2x gain on x86, right @merykitty?

cl4es avatar Jul 17 '22 10:07 cl4es

@cl4es yes the former numbers are the baseline and the latters are of this patch

merykitty avatar Jul 18 '22 02:07 merykitty

@merykitty This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

bridgekeeper[bot] avatar Aug 15 '22 07:08 bridgekeeper[bot]

May I have a review for this patch, please? Thanks a lot.

merykitty avatar Aug 24 '22 04:08 merykitty

@merykitty This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8288933: Improve the implementation of Double/Float.isInfinite

Reviewed-by: redestad, darcy

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 964 new commits pushed to the master branch:

  • 00befddd7ce97d324250807824469daaa9434eef: 8292675: Add identity transformation for removing redundant AndV/OrV nodes
  • 7169ee5c73c130aacce73cbd3f88377ec07c8311: 8293477: IGV: Upgrade to Netbeans Platform 15
  • 3dd94f33b2dddf8ea28805499d110c2347476c19: 8292671: Hotspot Style Guide should allow covariant returns
  • 9d6b0285f53599816c30393b87d16772ef6314b7: 8234315: GTK LAF does not gray out disabled JMenu
  • 812d805a488597cb9ab6b375869bc6748fd7fa94: 6447816: Provider filtering (getProviders) is not working with OR'd conditions
  • 43e191d64b0094cc1ece61929c32e017ee90c0c8: 8293524: RISC-V: Use macro-assembler functions as appropriate
  • 14eb5ad0dc987ffe3621f4eeeebeb6b5a2cd691b: 8291753: Add JFR event for GC CPU Time
  • 30d4145e2edd2d3e4cbaa8b01f7639ab53bc0991: 8293230: x86_64: Move AES and GHASH stub definitions into separate source files
  • 4c5501c31c7ab8fa7d1a6ce479060a899514c671: 8293548: ProblemList sun/management/jmxremote/bootstrap/RmiBootstrapTest.java#id1 on linux-x64
  • 46e6e41b9a35c8665eb31be2f8c36bbdcc90564a: 8293051: Further refactor javac after removal of -source/-target/--release 7
  • ... and 954 more: https://git.openjdk.org/jdk/compare/2bf5c9a6877b51377a535c6021a9e38549c89029...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@cl4es, @jddarcy) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

openjdk[bot] avatar Sep 09 '22 13:09 openjdk[bot]

@cl4es Thanks very much for your review, I believe this change is trivial, right? /integrate

merykitty avatar Sep 09 '22 15:09 merykitty

@merykitty Your change (at version ece55f40c0db9b5974643c2b702257ed0f22112b) is now ready to be sponsored by a Committer.

openjdk[bot] avatar Sep 09 '22 15:09 openjdk[bot]

/sponsor

jddarcy avatar Sep 09 '22 16:09 jddarcy

Going to push as commit a14c3a493a98792a61de253920bb177a5c35fd8e. Since your change was applied there have been 964 commits pushed to the master branch:

  • 00befddd7ce97d324250807824469daaa9434eef: 8292675: Add identity transformation for removing redundant AndV/OrV nodes
  • 7169ee5c73c130aacce73cbd3f88377ec07c8311: 8293477: IGV: Upgrade to Netbeans Platform 15
  • 3dd94f33b2dddf8ea28805499d110c2347476c19: 8292671: Hotspot Style Guide should allow covariant returns
  • 9d6b0285f53599816c30393b87d16772ef6314b7: 8234315: GTK LAF does not gray out disabled JMenu
  • 812d805a488597cb9ab6b375869bc6748fd7fa94: 6447816: Provider filtering (getProviders) is not working with OR'd conditions
  • 43e191d64b0094cc1ece61929c32e017ee90c0c8: 8293524: RISC-V: Use macro-assembler functions as appropriate
  • 14eb5ad0dc987ffe3621f4eeeebeb6b5a2cd691b: 8291753: Add JFR event for GC CPU Time
  • 30d4145e2edd2d3e4cbaa8b01f7639ab53bc0991: 8293230: x86_64: Move AES and GHASH stub definitions into separate source files
  • 4c5501c31c7ab8fa7d1a6ce479060a899514c671: 8293548: ProblemList sun/management/jmxremote/bootstrap/RmiBootstrapTest.java#id1 on linux-x64
  • 46e6e41b9a35c8665eb31be2f8c36bbdcc90564a: 8293051: Further refactor javac after removal of -source/-target/--release 7
  • ... and 954 more: https://git.openjdk.org/jdk/compare/2bf5c9a6877b51377a535c6021a9e38549c89029...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Sep 09 '22 17:09 openjdk[bot]

@jddarcy @merykitty Pushed as commit a14c3a493a98792a61de253920bb177a5c35fd8e.

:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

openjdk[bot] avatar Sep 09 '22 17:09 openjdk[bot]