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

8310268: RISC-V: misaligned memory access in String.Compare intrinsic #1876

Closed
wants to merge 1 commit into from

Conversation

omikhaltsova
Copy link

@omikhaltsova omikhaltsova commented Oct 13, 2023

I'd like to backport JDK-8310268 to jdk17u. This fix is related only to RISC-V.

The patch applies cleanly.

Testing: tier1 tests successfully passed on a RISC-V HiFive board with Linux.

As it's described in the original fix, this performance improvement can be observed by running the StringCompareToDifferentLength benchmark. The results for jdk17u are as follow:

Before

Benchmark                                   (delta)  (size)  Mode  Cnt   Score   Error  Units
StringCompareToDifferentLength.compareToLL        2       7  avgt    9   4.703 ± 0.090  ms/op
StringCompareToDifferentLength.compareToLL        2       8  avgt    9   4.896 ± 0.059  ms/op
StringCompareToDifferentLength.compareToLL        2      15  avgt    9  97.280 ± 2.008  ms/op
StringCompareToDifferentLength.compareToLL        2      24  avgt    9   3.685 ± 0.031  ms/op
StringCompareToDifferentLength.compareToLL        2      36  avgt    9  97.924 ± 1.230  ms/op
StringCompareToDifferentLength.compareToLU        2       7  avgt    9  85.896 ± 3.747  ms/op
StringCompareToDifferentLength.compareToLU        2       8  avgt    9   5.095 ± 0.065  ms/op
StringCompareToDifferentLength.compareToLU        2      15  avgt    9  87.073 ± 0.639  ms/op
StringCompareToDifferentLength.compareToLU        2      24  avgt    9   9.631 ± 0.021  ms/op
StringCompareToDifferentLength.compareToLU        2      36  avgt    9  13.416 ± 0.088  ms/op
StringCompareToDifferentLength.compareToUL        2       7  avgt    9  86.940 ± 0.923  ms/op
StringCompareToDifferentLength.compareToUL        2       8  avgt    9   7.155 ± 0.068  ms/op
StringCompareToDifferentLength.compareToUL        2      15  avgt    9  89.326 ± 0.864  ms/op
StringCompareToDifferentLength.compareToUL        2      24  avgt    9  11.678 ± 0.104  ms/op
StringCompareToDifferentLength.compareToUL        2      36  avgt    9  15.966 ± 0.344  ms/op
StringCompareToDifferentLength.compareToUU        2       7  avgt    9  97.076 ± 0.818  ms/op
StringCompareToDifferentLength.compareToUU        2       8  avgt    9   3.625 ± 0.035  ms/op
StringCompareToDifferentLength.compareToUU        2      15  avgt    9  97.576 ± 1.118  ms/op
StringCompareToDifferentLength.compareToUU        2      24  avgt    9   4.825 ± 0.070  ms/op
StringCompareToDifferentLength.compareToUU        2      36  avgt    9   6.221 ± 0.035  ms/op

After

Benchmark                                   (delta)  (size)  Mode  Cnt   Score   Error  Units
StringCompareToDifferentLength.compareToLL        2       7  avgt    9   4.642 ± 0.074  ms/op
StringCompareToDifferentLength.compareToLL        2       8  avgt    9   4.885 ± 0.011  ms/op
StringCompareToDifferentLength.compareToLL        2      15  avgt    9   5.225 ± 0.057  ms/op
StringCompareToDifferentLength.compareToLL        2      24  avgt    9   5.514 ± 0.073  ms/op
StringCompareToDifferentLength.compareToLL        2      36  avgt    9   6.376 ± 0.081  ms/op
StringCompareToDifferentLength.compareToLU        2       7  avgt    9   5.759 ± 0.039  ms/op
StringCompareToDifferentLength.compareToLU        2       8  avgt    9   5.781 ± 0.069  ms/op
StringCompareToDifferentLength.compareToLU        2      15  avgt    9   7.914 ± 0.132  ms/op
StringCompareToDifferentLength.compareToLU        2      24  avgt    9  10.063 ± 0.103  ms/op
StringCompareToDifferentLength.compareToLU        2      36  avgt    9  13.274 ± 0.101  ms/op
StringCompareToDifferentLength.compareToUL        2       7  avgt    9   7.360 ± 0.057  ms/op
StringCompareToDifferentLength.compareToUL        2       8  avgt    9   7.369 ± 0.042  ms/op
StringCompareToDifferentLength.compareToUL        2      15  avgt    9   9.374 ± 0.063  ms/op
StringCompareToDifferentLength.compareToUL        2      24  avgt    9  11.415 ± 0.197  ms/op
StringCompareToDifferentLength.compareToUL        2      36  avgt    9  14.468 ± 0.317  ms/op
StringCompareToDifferentLength.compareToUU        2       7  avgt    9   4.359 ± 0.049  ms/op
StringCompareToDifferentLength.compareToUU        2       8  avgt    9   4.365 ± 0.078  ms/op
StringCompareToDifferentLength.compareToUU        2      15  avgt    9   4.897 ± 0.073  ms/op
StringCompareToDifferentLength.compareToUU        2      24  avgt    9   5.450 ± 0.097  ms/op
StringCompareToDifferentLength.compareToUU        2      36  avgt    9   6.521 ± 0.091  ms/op

Progress

  • JDK-8310268 needs maintainer approval
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8310268: RISC-V: misaligned memory access in String.Compare intrinsic (Enhancement - P4 - Approved)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk17u-dev.git pull/1876/head:pull/1876
$ git checkout pull/1876

Update a local copy of the PR:
$ git checkout pull/1876
$ git pull https://git.openjdk.org/jdk17u-dev.git pull/1876/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1876

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk17u-dev/pull/1876.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 13, 2023

👋 Welcome back omikhaltcova! 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 changed the title Backport d6245b6832ccd1da04616e8ba4b90321b2551971 8310268: RISC-V: misaligned memory access in String.Compare intrinsic Oct 13, 2023
@openjdk
Copy link

openjdk bot commented Oct 13, 2023

This backport pull request has now been updated with issue from the original commit.

@openjdk
Copy link

openjdk bot commented Oct 13, 2023

⚠️ @omikhaltsova This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 13, 2023
@mlbridge
Copy link

mlbridge bot commented Oct 13, 2023

Webrevs

@openjdk openjdk bot added the approval label Oct 13, 2023
Copy link

@VladimirKempik VladimirKempik 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, gets speed of String.Compare to expected level

@openjdk
Copy link

openjdk bot commented Oct 16, 2023

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

8310268: RISC-V: misaligned memory access in String.Compare intrinsic

Reviewed-by: vkempik

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

  • 18d61ea: 8041447: Test javax/swing/dnd/7171812/bug7171812.java fails with java.lang.RuntimeException: Test failed, scroll on drag doesn't work
  • 7c26fd8: 8297640: Increase buffer size for buf (insert_features_names) in Abstract_VM_Version::insert_features_names

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 ready Pull request is ready to be integrated and removed approval labels Oct 16, 2023
@omikhaltsova
Copy link
Author

/integrate

@openjdk
Copy link

openjdk bot commented Oct 17, 2023

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

  • 1c5d92f: 8315062: [GHA] get-bootjdk action should return the abolute path
  • 1b858f1: 8302525: Write a test to check various components send Events while mouse and key are used simultaneously
  • 111b523: 8300259: Add test coverage for processing of pending block files in signed JARs
  • 7c3e0d4: 8301570: Test runtime/jni/nativeStack/ needs to detach the native thread
  • f7fb52b: 8300272: Improve readability of the test JarWithOneNonDisabledDigestAlg
  • 436f148: 8296275: Write a test to verify setAccelerator method of JMenuItem
  • b07d8c2: 8313691: use close after failing os::fdopen in vmError and ciEnv
  • 052a05d: 8310321: make JDKOPT_CHECK_CODESIGN_PARAMS more verbose
  • 3637245: 8317772: NMT: Make peak values available in release builds
  • 18d61ea: 8041447: Test javax/swing/dnd/7171812/bug7171812.java fails with java.lang.RuntimeException: Test failed, scroll on drag doesn't work
  • ... and 1 more: https://git.openjdk.org/jdk17u-dev/compare/c17878a93b6b2c52380f8240a88f463adadba1c2...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Oct 17, 2023

@omikhaltsova Pushed as commit 80460e3.

💡 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
backport clean integrated Pull request has been integrated
2 participants