Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8288933: Improve the implementation of Double/Float.isInfinite #9238

Closed
wants to merge 1 commit into from

Conversation

merykitty
Copy link
Member

@merykitty merykitty commented Jun 22, 2022

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)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

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

Reviewers

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 22, 2022

👋 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.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 22, 2022
@openjdk
Copy link

openjdk bot commented Jun 22, 2022

@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 openjdk bot added the core-libs core-libs-dev@openjdk.org label Jun 22, 2022
@mlbridge
Copy link

mlbridge bot commented Jun 22, 2022

Webrevs

@jddarcy
Copy link
Member

jddarcy commented Jul 14, 2022

@merykitty, the proposed change is functionally correct.

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

@cl4es
Copy link
Member

cl4es commented Jul 17, 2022

@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?

@merykitty
Copy link
Member Author

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

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 15, 2022

@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!

@merykitty
Copy link
Member Author

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

Copy link
Member

@cl4es cl4es left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

(Sorry for the long delay, I've been out for a while and forgot to formally review this.)

@openjdk
Copy link

openjdk bot commented Sep 9, 2022

@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:

  • 00befdd: 8292675: Add identity transformation for removing redundant AndV/OrV nodes
  • 7169ee5: 8293477: IGV: Upgrade to Netbeans Platform 15
  • 3dd94f3: 8292671: Hotspot Style Guide should allow covariant returns
  • 9d6b028: 8234315: GTK LAF does not gray out disabled JMenu
  • 812d805: 6447816: Provider filtering (getProviders) is not working with OR'd conditions
  • 43e191d: 8293524: RISC-V: Use macro-assembler functions as appropriate
  • 14eb5ad: 8291753: Add JFR event for GC CPU Time
  • 30d4145: 8293230: x86_64: Move AES and GHASH stub definitions into separate source files
  • 4c5501c: 8293548: ProblemList sun/management/jmxremote/bootstrap/RmiBootstrapTest.java#id1 on linux-x64
  • 46e6e41: 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 openjdk bot added the ready Pull request is ready to be integrated label Sep 9, 2022
@merykitty
Copy link
Member Author

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

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Sep 9, 2022
@openjdk
Copy link

openjdk bot commented Sep 9, 2022

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

@jddarcy
Copy link
Member

jddarcy commented Sep 9, 2022

/sponsor

@openjdk
Copy link

openjdk bot commented Sep 9, 2022

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

  • 00befdd: 8292675: Add identity transformation for removing redundant AndV/OrV nodes
  • 7169ee5: 8293477: IGV: Upgrade to Netbeans Platform 15
  • 3dd94f3: 8292671: Hotspot Style Guide should allow covariant returns
  • 9d6b028: 8234315: GTK LAF does not gray out disabled JMenu
  • 812d805: 6447816: Provider filtering (getProviders) is not working with OR'd conditions
  • 43e191d: 8293524: RISC-V: Use macro-assembler functions as appropriate
  • 14eb5ad: 8291753: Add JFR event for GC CPU Time
  • 30d4145: 8293230: x86_64: Move AES and GHASH stub definitions into separate source files
  • 4c5501c: 8293548: ProblemList sun/management/jmxremote/bootstrap/RmiBootstrapTest.java#id1 on linux-x64
  • 46e6e41: 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 openjdk bot added the integrated Pull request has been integrated label Sep 9, 2022
@openjdk openjdk bot closed this Sep 9, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Sep 9, 2022
@openjdk
Copy link

openjdk bot commented Sep 9, 2022

@jddarcy @merykitty Pushed as commit a14c3a4.

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

@merykitty merykitty deleted the isinf branch April 27, 2023 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
3 participants