Skip to content

8377808: compiler/c2/irTests/TestFloat16ScalarOperations.java is fragile in the presence of special constants#31370

Closed
mhaessig wants to merge 4 commits into
openjdk:masterfrom
mhaessig:JDK-8377808-fragile-fp16-test
Closed

8377808: compiler/c2/irTests/TestFloat16ScalarOperations.java is fragile in the presence of special constants#31370
mhaessig wants to merge 4 commits into
openjdk:masterfrom
mhaessig:JDK-8377808-fragile-fp16-test

Conversation

@mhaessig
Copy link
Copy Markdown
Contributor

@mhaessig mhaessig commented Jun 3, 2026

TestFlaot16ScalarOperations.java is fragile when it comes to unexpected constant folding. Previously, #28678 addressed constant folding for addition with zero. This PR addresses the optimization of division by constants that are reciprocals of powers of two. This is done by reducing the range further to 0.6 to 0.9 as this excludes those reciprocals, which are <= 0.5. In this test we mainly care about the IR matching, so the further reduction of the input space is fine.

Testing:

  • Gitub Actions
  • tier1,tier2 and additional stress testing
  • 250 repetitions of TestFlaot16ScalarOperations.java on aarch64


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

  • JDK-8377808: compiler/c2/irTests/TestFloat16ScalarOperations.java is fragile in the presence of special constants (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 31370

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@mhaessig
Copy link
Copy Markdown
Contributor Author

mhaessig commented Jun 3, 2026

@eme64 and @jatin-bhateja, may I kindly ask for your review?

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper Bot commented Jun 3, 2026

👋 Welcome back mhaessig! 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
Copy link
Copy Markdown

openjdk Bot commented Jun 3, 2026

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

8377808: compiler/c2/irTests/TestFloat16ScalarOperations.java is fragile in the presence of special constants

Reviewed-by: qamai, epeter, syan, jbhateja

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 19 new commits pushed to 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 hotspot-compiler hotspot-compiler-dev@openjdk.org label Jun 3, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Jun 3, 2026

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

  • hotspot-compiler

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
Copy link
Copy Markdown

openjdk Bot commented Jun 3, 2026

The total number of required reviews for this PR has been set to 2 based on the presence of this label: hotspot-compiler. This can be overridden with the /reviewers command.

@openjdk openjdk Bot added the rfr Pull request is ready for review label Jun 3, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge Bot commented Jun 3, 2026

Webrevs

Comment thread test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java Outdated
@mhaessig
Copy link
Copy Markdown
Contributor Author

mhaessig commented Jun 3, 2026

Thank you for taking a look, @sendaoYan! I addressed your comments in the latest commit.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this missed addScenarios(s0)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It does, but I also do not see the point of running an IR test with value validation with -Xint. Perhaps @jatin-bhateja remembers from back when he wrote that test?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I just went ahead and refactored it.

Copy link
Copy Markdown
Member

@merykitty merykitty 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, thanks for making the change.

Comment thread test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java Outdated
Copy link
Copy Markdown
Contributor

@eme64 eme64 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, thanks for fixing this!

Comment on lines -102 to +101
Scenario s0 = new Scenario(0, "--add-modules=jdk.incubator.vector", "-Xint");
Scenario s1 = new Scenario(1, "--add-modules=jdk.incubator.vector");
new TestFramework().addScenarios(s1).start();
new TestFramework().addFlags("--add-modules=jdk.incubator.vector").start();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like we actually never ran the Xint path! Thanks for cleaning that up.

@eme64
Copy link
Copy Markdown
Contributor

eme64 commented Jun 4, 2026

@jatin-bhateja just tagging you here, this is a test we had designed together, and it has now been flaky multiple times. Just so you are aware ;)

@openjdk openjdk Bot added the ready Pull request is ready to be integrated label Jun 4, 2026
@mhaessig
Copy link
Copy Markdown
Contributor Author

mhaessig commented Jun 4, 2026

Thank you all for reviewing!

/integrate

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Jun 4, 2026

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

Your commit was automatically rebased without conflicts.

@openjdk openjdk Bot added the integrated Pull request has been integrated label Jun 4, 2026
@openjdk openjdk Bot closed this Jun 4, 2026
@openjdk openjdk Bot removed the ready Pull request is ready to be integrated label Jun 4, 2026
@openjdk openjdk Bot removed the rfr Pull request is ready for review label Jun 4, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Jun 4, 2026

@mhaessig Pushed as commit 8fad96d.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

5 participants