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

JDK-8301833: Add wide-ranging tests for FDLIBM porting #12430

Closed
wants to merge 6 commits into from

Conversation

jddarcy
Copy link
Member

@jddarcy jddarcy commented Feb 6, 2023

To help add assurances that the main-line port of FDLIBM to Java is working correctly, added some long-running manual tests to probe that the transliteration port and the corresponding StrictMath method are in agreement on a large number of argument, say, all float values.

To test the transliteration port, this test can be run against a build where the JDK has not had the FDLIBM code used for StrictMath ported to Java.


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-8301833: Add wide-ranging tests for FDLIBM porting

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12430

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 6, 2023

👋 Welcome back darcy! 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 Feb 6, 2023
@openjdk
Copy link

openjdk bot commented Feb 6, 2023

@jddarcy 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 Feb 6, 2023
@mlbridge
Copy link

mlbridge bot commented Feb 6, 2023

Webrevs

@jddarcy
Copy link
Member Author

jddarcy commented Feb 6, 2023

PS The manual test passes when run against a JDK 20 build, helping to validate the new-in-21 transliteration ports done so far in JDK 21 (log10, log1p, expm1).

@AlanBateman
Copy link
Contributor

Manual tests are the tests of last resort :-) This test may be useful for the current transliteration work but it's not clear how this manual test would be run by someone tasked with running the manual tests. Right now, it looks like it's more of a long running stress test but I think the expectation is that someone running this test needs to do a special build or somehow compare results with an older JDK release. Have you explored alternatives to adding a manual test? Long running HotSpot stress tests run in higher tiers. For comparison, I'm wondering if samples could be captured in a golden file for the test to use.

If we are adding a manual test here then I think it will need good instructions. @bwhuang-us has done work in recent times on making sure that the manual tests are in test groups with instructions.

@jddarcy
Copy link
Member Author

jddarcy commented Feb 6, 2023

Manual tests are the tests of last resort :-) This test may be useful for the current transliteration work but it's not clear how this manual test would be run by someone tasked with running the manual tests. Right now, it looks like it's more of a long running stress test but I think the expectation is that someone running this test needs to do a special build or somehow compare results with an older JDK release. Have you explored alternatives to adding a manual test? Long running HotSpot stress tests run in higher tiers. For comparison, I'm wondering if samples could be captured in a golden file for the test to use.

If we are adding a manual test here then I think it will need good instructions. @bwhuang-us has done work in recent times on making sure that the manual tests are in test groups with instructions.

To add some quick background: the FDLIBM porting effort is now doing two ports per method:

  • A transliteration port that is as close to the original FDLIBM C as possible
  • A (more) idiomatic port closed to regular Java coding
    In the future, there may be further changes to the idiomatic port to enhance performance or clarity while returning the same results, etc.

These exhaustive tests are helpful now to provide another layer of checking to the transliteration port (by validating it against say, a JDK 20 build) and also helpful in the future to validate any implementation optimization to the idiomatic port when run against the transliteration port.

The tests are long-running (one of the order of at least a minute or two per method under test) and in my estimation don't provide enough utility for their cost to be run all the time. However, they have much higher utility to help validate this initial port and for future refactorings. Therefore, I think these tests should be included in the repository, but not run all the time, which led me to declare them as a manual jtreg test.

@openjdk
Copy link

openjdk bot commented Feb 7, 2023

@AlanBateman Unknown command manual - for a list of valid commands use /help.

@AlanBateman
Copy link
Contributor

Therefore, I think these tests should be included in the repository, but not run all the time, which led me to declare them as a manual jtreg test.

Manual tests are run at each release. There are a couple of examples in the repo with tests that don't have @test tags. There are easily forgotten but they have been useful in a few areas for cases like this where the maintainer wants something in the repo doesn't doesn't want it run by regular testing. If you do decide to make this a manual test then I think it will need instructions so that someone knows what to do.

import java.util.function.DoubleBinaryOperator;
import java.util.function.DoubleUnaryOperator;

public class ExhaustingTests {
Copy link
Member

Choose a reason for hiding this comment

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

Great name!

private static long testUnaryMethods() {
long failures = 0;
UnaryTestCase[] testCases = {
// new UnaryTestCase("sqrt", FdlibmTranslit::sqrt, StrictMath::sqrt),
Copy link
Member

Choose a reason for hiding this comment

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

Maybe not include the TBD cases as part of this initial PR?

@@ -86,6 +86,10 @@ public static double log1p(double x) {
return Log1p.compute(x);
}

public static double exp(double x) {
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps leave out of this PR any FdlibmTranslit changes and later include ExhaustingTest changes in each separate PR for the functions being ported?

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay; I'll roll the addition of the exp method into the PR for the hyperbolics since exp is used in the hyperbolics implementation.

@jddarcy
Copy link
Member Author

jddarcy commented Feb 10, 2023

Changed to the tests to by default just check every 1024th float value, which puts running the test into the usual tier 1 test time guidelines. Dedicated math library work can temporarily dial up the testing density for particular efforts.

@bplb
Copy link
Member

bplb commented Feb 10, 2023

This look reasonable.

Copy link
Member

@bplb bplb left a comment

Choose a reason for hiding this comment

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

This looks all right.

@openjdk
Copy link

openjdk bot commented Feb 11, 2023

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

8301833: Add wide-ranging tests for FDLIBM porting

Reviewed-by: bpb, alanb

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 4 new commits pushed to the master branch:

  • 6a44120: 8301269: Update Commons BCEL to Version 6.7.0
  • 6f9f2b5: 8301737: java/rmi/server/UnicastRemoteObject/serialFilter/FilterUROTest.java fail with -Xcomp
  • 1ef9f65: 8302172: [JVMCI] HotSpotResolvedJavaMethodImpl.canBeInlined must respect ForceInline
  • 74b167b: 8301819: Enable continuations code by default

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 11, 2023
@jddarcy jddarcy changed the title JDK-8301833: Add manual tests for FDLIBM porting JDK-8301833: Add wide-ranging tests for FDLIBM porting Feb 11, 2023
Copy link
Contributor

@AlanBateman AlanBateman left a comment

Choose a reason for hiding this comment

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

The move to make this an automated tests and test every 1024th float is good.

@jddarcy
Copy link
Member Author

jddarcy commented Feb 12, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Feb 12, 2023

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

  • 6a44120: 8301269: Update Commons BCEL to Version 6.7.0
  • 6f9f2b5: 8301737: java/rmi/server/UnicastRemoteObject/serialFilter/FilterUROTest.java fail with -Xcomp
  • 1ef9f65: 8302172: [JVMCI] HotSpotResolvedJavaMethodImpl.canBeInlined must respect ForceInline
  • 74b167b: 8301819: Enable continuations code by default

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Feb 12, 2023
@openjdk openjdk bot closed this Feb 12, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Feb 12, 2023
@openjdk
Copy link

openjdk bot commented Feb 12, 2023

@jddarcy Pushed as commit 8049e59.

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

@jddarcy jddarcy deleted the JDK-8301833 branch October 26, 2024 19:27
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
Development

Successfully merging this pull request may close these issues.

3 participants