Skip to content

Conversation

@RealFYang
Copy link
Member

@RealFYang RealFYang commented Feb 14, 2025

Hi, please review this change resolving a timeout issue in LargeValueExceptions.squareDefiniteOverflow().

This issue only happens on platforms with slow unaligned memory accesses like Unmatched or Premier-P550 SBCs.
Async profiler shows major time was spent in multiplyToLen stub code. When AvoidUnalignedAccesses is enabled,
there is a simple alignment check, which assumes 8-byte alignment for base_offset of int arrays. But this is
not the case with COH: base_offset is 12 bytes instead of 16 bytes for int arrays.

Patch simply makes it explicit about the requirement of base_offset. Sanity tested on Premier P550.
No obvious change witnessed on JMH after this change:

-----------------------------------------------------------------------------------------------

Without COH:

Benchmark                               (maxNumbits)  Mode  Cnt        Score      Error  Units
BigIntegers.SmallShifts.testLeftShift             32  avgt   15      138.939 ±    2.246  ns/op
BigIntegers.SmallShifts.testLeftShift            128  avgt   15       88.391 ±    1.210  ns/op
BigIntegers.SmallShifts.testLeftShift            256  avgt   15      117.590 ±    1.398  ns/op
BigIntegers.SmallShifts.testRightShift            32  avgt   15      150.338 ±    1.961  ns/op
BigIntegers.SmallShifts.testRightShift           128  avgt   15      104.540 ±    5.636  ns/op
BigIntegers.SmallShifts.testRightShift           256  avgt   15      126.082 ±    1.756  ns/op
BigIntegers.testAdd                              N/A  avgt   15       97.513 ±   40.746  ns/op
BigIntegers.testGcd                              N/A  avgt   15  5409222.706 ± 5934.667  ns/op
BigIntegers.testHugeLargeDivide                  N/A  avgt   15      246.904 ±    1.552  ns/op
BigIntegers.testHugeSmallDivide                  N/A  avgt   15      248.997 ±    1.374  ns/op
BigIntegers.testHugeToString                     N/A  avgt   15     2421.432 ±   62.208  ns/op
BigIntegers.testLargeSmallDivide                 N/A  avgt   15      216.859 ±    1.760  ns/op
BigIntegers.testLargeToString                    N/A  avgt   15      425.653 ±   13.305  ns/op
BigIntegers.testLeftShift                        N/A  avgt   15     2265.137 ±   24.319  ns/op
BigIntegers.testMultiply                         N/A  avgt   15    15862.412 ±  417.880  ns/op <========
BigIntegers.testRightShift                       N/A  avgt   15      936.071 ±   15.247  ns/op
BigIntegers.testSmallToString                    N/A  avgt   15      322.350 ±   16.075  ns/op

-----------------------------------------------------------------------------------------------

With COH:

Benchmark                               (maxNumbits)  Mode  Cnt        Score       Error  Units
BigIntegers.SmallShifts.testLeftShift             32  avgt   15      117.991 ±     1.306  ns/op
BigIntegers.SmallShifts.testLeftShift            128  avgt   15      150.202 ±     0.922  ns/op
BigIntegers.SmallShifts.testLeftShift            256  avgt   15      105.895 ±     0.779  ns/op
BigIntegers.SmallShifts.testRightShift            32  avgt   15      127.582 ±     1.765  ns/op
BigIntegers.SmallShifts.testRightShift           128  avgt   15      171.976 ±     0.611  ns/op
BigIntegers.SmallShifts.testRightShift           256  avgt   15      118.938 ±     2.882  ns/op
BigIntegers.testAdd                              N/A  avgt   15       73.390 ±     1.368  ns/op
BigIntegers.testGcd                              N/A  avgt   15  5409885.951 ± 11493.243  ns/op
BigIntegers.testHugeLargeDivide                  N/A  avgt   15      135.854 ±    38.272  ns/op
BigIntegers.testHugeSmallDivide                  N/A  avgt   15      130.308 ±    24.959  ns/op
BigIntegers.testHugeToString                     N/A  avgt   15     2525.327 ±     8.116  ns/op
BigIntegers.testLargeSmallDivide                 N/A  avgt   15      158.357 ±     0.676  ns/op
BigIntegers.testLargeToString                    N/A  avgt   15      333.591 ±   102.890  ns/op
BigIntegers.testLeftShift                        N/A  avgt   15     2283.509 ±    22.843  ns/op
BigIntegers.testMultiply                         N/A  avgt   15    15635.504 ±   414.156  ns/op <========
BigIntegers.testRightShift                       N/A  avgt   15      927.502 ±    26.892  ns/op
BigIntegers.testSmallToString                    N/A  avgt   15      313.170 ±     6.514  ns/op
Finished running test 'micro:java.math.BigIntegers'

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-8350093: RISC-V: java/math/BigInteger/LargeValueExceptions.java timeout with COH (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23631

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@RealFYang RealFYang marked this pull request as draft February 14, 2025 13:22
@bridgekeeper
Copy link

bridgekeeper bot commented Feb 14, 2025

👋 Welcome back fyang! 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

openjdk bot commented Feb 14, 2025

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

8350093: RISC-V: java/math/BigInteger/LargeValueExceptions.java timeout with COH

Reviewed-by: mli, fjiang

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

  • 8b2aa51: 8349780: AIX os::get_summary_cpu_info support Power 11
  • 650d0d9: 8348865: JButton/bug4796987.java never runs because Windows XP is unavailable
  • 906358d: 8294155: Exception thrown before awaitAndCheck hangs PassFailJFrame
  • 2bd8f02: 8342524: Use latch in AbstractButton/bug6298940.java instead of delay
  • 7f3ecb4: 8346664: C2: Optimize mask check with constant offset
  • b3a4026: 8349764: RISC-V: C1: Improve Class.isInstance intrinsic
  • 071c8f5: 8349909: jdk.internal.jimage.decompressor.ZipDecompressor does not close the Inflater in exceptional cases
  • f1258f9: 8349755: Fix corner case issues in async UL
  • b1b4828: 8350086: Inline hot Method accessors for faster task selection
  • 5e9d72e: 8350094: Linux gcc 13.2.0 build fails when ubsan is enabled
  • ... and 11 more: https://git.openjdk.org/jdk/compare/db42a48dc5d49783545757bd34aeead851f9288e...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.

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

@openjdk
Copy link

openjdk bot commented Feb 14, 2025

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

  • hotspot

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 hotspot hotspot-dev@openjdk.org label Feb 14, 2025
@RealFYang RealFYang marked this pull request as ready for review February 14, 2025 13:26
@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 14, 2025
@mlbridge
Copy link

mlbridge bot commented Feb 14, 2025

Webrevs

Copy link

@Hamlin-Li Hamlin-Li left a comment

Choose a reason for hiding this comment

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

Nice catch.
Have one question.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 17, 2025
Copy link
Member

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

@RealFYang
Copy link
Member Author

@Hamlin-Li @feilongjiang : Thanks!
/integrate

@openjdk
Copy link

openjdk bot commented Feb 18, 2025

Going to push as commit 8df8040.
Since your change was applied there have been 23 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 Feb 18, 2025
@openjdk openjdk bot closed this Feb 18, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Feb 18, 2025
@openjdk
Copy link

openjdk bot commented Feb 18, 2025

@RealFYang Pushed as commit 8df8040.

💡 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 hotspot-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants