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

Support Java Behaviour w.r.t Math.max and Math.min for Floating Points #20185

Merged
merged 3 commits into from
Oct 30, 2024

Conversation

matthewhall2
Copy link
Contributor

@matthewhall2 matthewhall2 commented Sep 18, 2024

  • Enables inlining of Math.max/Math.min functions for floats and doubles

  • Implements Java standard found while testing

    • +0 compares as strictly greater than -0
    • if the first arg is a NaN, returns the corresponding quiet NaN, same for if only the second arg is a NaN
  • Depends on OMR PR:Support IEEE-754 for fmin/fmax/dmin/dmax nodes eclipse-omr/omr#7464

    • Differs from this in that it returns the first NaN argument unchanged if present (the omr pr implements the IEEE-754 standard which returns the corresponding quiet NaN)

https://hyc-runtimes-jenkins.swg-devops.com/job/jvm.29.personal/34248/

@r30shah
Copy link
Contributor

r30shah commented Oct 25, 2024

jenkins test sanity zlinux jdk11

} else {
// Normal number (non NaN)
farg1 = r.nextFloat() * 1000000.0f + 1.0f;
message = message + "(" + String.valueOf(farg1) + "f, ";
Copy link
Contributor

Choose a reason for hiding this comment

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

You forgot to clean this one - this has caused the functional tests I launched fail. Can you fix this and launch the sanitytests on internal jenkins and share link on slack with me? Once they finish, I will launch test again and then merge.

@matthewhall2 matthewhall2 force-pushed the fmin_fmax_dmin_dmax branch 4 times, most recently from e54e704 to 63ee962 Compare October 28, 2024 15:29
matthewhall2 and others added 3 commits October 28, 2024 11:58
Add functional tests for `Math.max` and `Math.min`:
- to test specific float and double corner cases
- test with NaN, +0, & -0, values to confirm respective omr changes
- test all possible execution paths

Signed-off-by: Matthew Hall <[email protected]>
- Adds java_lang_Math_max/min_float/double as a recognized method
- Adds a SupportsInlineMath_MaxMin_FD flag to the Z code generator
- Flag is only set in Z if the TR_disableInlineMath_MaxMin_FD
  environment variable is not set
- If the flag is set, call nodes are transformed to a functionally
  equivalent tree that uses fmin/fmax/dmin/dmax nodes

Signed-off-by: Sarwat Shaheen <[email protected]>
- spearate evaluators for J9 vs OMR to support differing behaviour (OMR
  complies with IEEE_754, while J9 returns the first NaN (if present)
- +0.0 compares as strictly greater than -0.0

Signed-off-by: Matthew Hall <[email protected]>
@r30shah
Copy link
Contributor

r30shah commented Oct 28, 2024

jenkins test sanity zlinux jdk11

Copy link
Contributor

@r30shah r30shah left a comment

Choose a reason for hiding this comment

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

Given the change was fixed and internal builds are progressing, launching another build

@r30shah
Copy link
Contributor

r30shah commented Oct 29, 2024

jenkins test sanity zlinux,xlinux jdk21

@r30shah
Copy link
Contributor

r30shah commented Oct 29, 2024

@matthewhall2 Can you triage the failure seen in https://openj9-jenkins.osuosl.org/job/Test_openjdk21_j9_sanity.openjdk_x86-64_linux_Personal/52/ and see if it is related to this change or not? You can run grinder internally with just failing test.

@r30shah
Copy link
Contributor

r30shah commented Oct 29, 2024

While @matthewhall2 is looking into the failures through, internal jenkins, I have launched a grinder here : https://openj9-jenkins.osuosl.org/job/Grinder/3923 to see how it failed. Going through JIT change once again, I do not think this would cause issue on x86.

@matthewhall2
Copy link
Contributor Author

internal Grinder build passed @r30shah view/Test_grinder/job/Grinder/44484/

@r30shah
Copy link
Contributor

r30shah commented Oct 29, 2024

I see most of the iterations in grinder I launched passing as well. Given that grinders are passing, and the JIT changes will not impact x86, relaunching the sanity.openjdk test on x86.

@r30shah
Copy link
Contributor

r30shah commented Oct 29, 2024

jenkins test sanity.openjdk xlinux jdk21

@r30shah
Copy link
Contributor

r30shah commented Oct 29, 2024

@matthewhall2 Seems like it is consistently failing on this machine, and I picked up last nightly and ran grinder - https://openj9-jenkins.osuosl.org/job/Grinder/3928/console which passes. May be some odd issue. Can you take a look? I Would recommend you to open up issue on runtimes/infrstructure to get access to this system

@hzongaro
Copy link
Member

I think the x86 failures are due to issue #20435

@r30shah
Copy link
Contributor

r30shah commented Oct 30, 2024

I think the x86 failures are due to issue #20435

Okk, so in that case, I think this one is good to merge. @matthewhall2 please disregard my comment #20185 (comment). Merging this one now.

@r30shah r30shah merged commit c0eabdd into eclipse-openj9:master Oct 30, 2024
10 of 12 checks passed
@pshipton
Copy link
Member

This is causing a lot of failures in the internal build. I'm going to revert it.
http://vmfarm.rtp.raleigh.ibm.com/jobs_by_status.php?build_id=80696&status=FAILED&categories=17

@pshipton
Copy link
Member

Reverted via #20452

@r30shah
Copy link
Contributor

r30shah commented Oct 30, 2024

@matthewhall2 We did initially tested your change so not sure what went wrong. Can you take a look ?

@pshipton
Copy link
Member

See also the alinux failures found in PR testing today, which seem related.
https://openj9-jenkins.osuosl.org/job/Test_openjdk11_j9_sanity.functional_aarch64_linux_Personal/310/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants