-
Couldn't load subscription status.
- Fork 6.1k
8349556: RISC-V: improve the performance when -COH and -AvoidUnalignedAccesses for UL and LU string comparison #23495
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
8349556: RISC-V: improve the performance when -COH and -AvoidUnalignedAccesses for UL and LU string comparison #23495
Conversation
|
👋 Welcome back mli! A progress list of the required criteria for merging this PR into |
|
@Hamlin-Li 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: 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 32 new commits pushed to the
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 |
|
@Hamlin-Li The following label will be automatically applied to this pull request:
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. |
Webrevs
|
| tmpL = isLU ? tmp1 : tmp2; // where to keep L for comparison | ||
|
|
||
| if (AvoidUnalignedAccesses && (base_offset1 % 8) == 0) { | ||
| if (AvoidUnalignedAccesses && (base_offset1 % 8) != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find that a similar check is in C2_MacroAssembler::string_compare for the UU/LL cases [1].
Seems more consistent if we move it into the counterpart generate_compare_long_string_same_encoding.
[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp#L1443
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, we should refactor the code a bit to make it more readable.
As it seems just a refactor, so I can do it in another pr, how do you think about it?
At the same time I can also clean the invocation of compare_string_16_bytes_same from generate_compare_long_string_same_encoding, I don't like the implicit registers passing between them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Seems the LL/UU cases are kind of different as they already emit direct 8-byte loads before the stub. So not sure if it's doable to move the check.
|
|
||
| if (AvoidUnalignedAccesses && (base_offset1 % 8) == 0) { | ||
| if (AvoidUnalignedAccesses && (base_offset1 % 8) != 0) { | ||
| // Load another 4 bytes from strL to make sure main loop is 8-byte aligned |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: You might want to update this code comment removing the word another.
// Load another 4 bytes from strL to make sure main loop is 8-byte aligned
=>
// Load 4 bytes from strL to make sure main loop is 8-byte aligned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!
Thank you! |
|
hold on a bit, let me take a look at it after the weekend |
|
I can't see how this end up improving perf, You have moved loading job for first few bytes from one place to another. |
The reason is that with -COH && -Avoid, some alignment instructions that were previously required are omitted. |
|
Thank you! |
|
/integrate |
|
Going to push as commit d104deb.
Your commit was automatically rebased without conflicts. |
|
@Hamlin-Li Pushed as commit d104deb. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Hi,
Can you help to review the patch?
It tries to improve the string compare when AvoidUnalignedAccesses == false && encoding is LU or UL (i.e. 2 strings encodings are different with each other).
The jmh test shows when
-CompactObjectHeaders(i.e. -COH) &&-AvoidUnalignedAccesses, the patch bring much better performance, and in other cases, it does not bring obvious regression. And currently by default it's -COH.Thanks
Performance
it's run on bananapi.
-COH-AvoidUnalignedAccesses
+COH-AvoidUnalignedAccesses
-COH+AvoidUnalignedAccesses
+COH+AvoidUnalignedAccesses
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23495/head:pull/23495$ git checkout pull/23495Update a local copy of the PR:
$ git checkout pull/23495$ git pull https://git.openjdk.org/jdk.git pull/23495/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 23495View PR using the GUI difftool:
$ git pr show -t 23495Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23495.diff
Using Webrev
Link to Webrev Comment