-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8295948: Support for Zicbop/prefetch instructions on RISC-V #10884
Conversation
The OpenJDK supports generating prefetch instructions on most platforms. RISC-V supports through the Zicbop extension the use of prefetch instructions. We want to make sure we use these instructions whenever they are available.
👋 Welcome back luhenry! A progress list of the required criteria for merging this PR into |
Webrevs
|
@RealFYang let me know what you think. Thanks! |
@luhenry : Sorry for late reply. I am looking this this now. |
@RealFYang perfect, thank you |
void (*stub)(const void*, intptr_t) = | ||
(void (*)(const void*, intptr_t))StubRoutines::riscv::prefetch_r(); | ||
if (interval >= 0 && stub != NULL) { | ||
stub(loc, interval); |
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 am not sure if it really worth it to call a stub for read / write here. It looks to me not a big issue for the case the stub tries to catch and resolve. And I see aarch64 simply plant a 'prfm' instruction for prefetching [1]. I guess we might can do the same?
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.
We would need to check for UseZicbop
in any case; the access to a global variable is then required.
It would be the same issue as https://github.com/openjdk/jdk/pull/10884/files/e968f7164124dcf560807c9ff7765e6f82b64cdd#diff-e3c18b8b83898e82b5a3069319df6a47468e91cc2527bf065e704a685a20f26bR5196 without the stub.
I've to admit that the interval
naming here is confusing since no implementation ever uses it as an interval but alway as an offset. Also, the callers assume it to be an offset, like ContiguousSpace::prepare_for_compaction
for example.
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, I agree that a check for UseZicbop option would be necessary. But I still don't understand why we should implement this through a stub here. It looks to me that CPP code with inline assembly would also do. At least this could help eliminate the prologue & epilogue cost of calling the stub.
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.
We can definitely go with inline assembly here, just not sure that prefetch.r
or prefetch.w
would be recognized by the assembler. However, given that prefetch.*
is an ori
under the hood, we can simply use that.
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.
Updated changes looks good except for the indentation issue.
@luhenry 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 144 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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@RealFYang) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
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.
Still looks good. Thanks.
/integrate |
/integrate |
@RealFYang @yadongw could you please review+sponsor if it looks all good to you? Thanks! |
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.
lgtm
/sponsor |
@RealFYang The PR has been updated since the change author (@luhenry) issued the |
/integrate |
/sponsor |
Going to push as commit 4465361.
Your commit was automatically rebased without conflicts. |
@RealFYang @luhenry Pushed as commit 4465361. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The OpenJDK supports generating prefetch instructions on most platforms. RISC-V supports through the Zicbop extension the use of prefetch instructions. We want to make sure we use these instructions whenever they are available.
It passes
hotspot:tier1
test suiteProgress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10884/head:pull/10884
$ git checkout pull/10884
Update a local copy of the PR:
$ git checkout pull/10884
$ git pull https://git.openjdk.org/jdk pull/10884/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10884
View PR using the GUI difftool:
$ git pr show -t 10884
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10884.diff