-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8299962: Speed up compiler/intrinsics/unsafe/DirectByteBufferTest.java and HeapByteBufferTest.java #11944
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
Conversation
…a and HeapByteBufferTest.java
👋 Welcome back epeter! A progress list of the required criteria for merging this PR into |
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.
Default C2 compilation threshold is around 10000. So 5000 is not safe.
Instead I suggest to use -XX:CompileThresholdScaling=
together with small iterations
numbers which guarantees C2 compilation.
@vnkozlov Something I failed to mention in the description: |
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.
Thank you for explanation. Looks good.
ByteBufferTest::stepUsingAccessors()
code is not C2 friendly because it will get profiling data only for first loop before triggering OSR and full compilation. Which may cause deoptimization and recompilation when it hit following loops. That is may be why iterations
value was so high to make sure profiling data is collected for all loops.
The test should have separate methods for each type of intrinsics.
@eme64 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 38 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 |
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.
Looks good to me.
@vnkozlov I filed a follow up RFE with your suggestion for improvement: JDK-8300187 Thanks for the help and reviews @vnkozlov @TobiHartmann /integrate |
Going to push as commit 7c1ebcc.
Your commit was automatically rebased without conflicts. |
The test used a blanket
100_000
iterations to ensure C2 triggers for the relevant intrinsics ofjdk.internal.misc.Unsafe
.I experimented lowering the number of iterations, and got the following results:
100_000
(overkill, 8.5 sec)5000
(very safe, 3 sec),2000
(decent, 2.6 sec) and even200
(ok, 2.5 sec).I measured the time per
@run
statement (there are 6 over the two test files).For
5000
I got the same count of intrinsifications per intrinsic.For
2000
it dropped slightly, rarely an intrinsic was not intrinsified.For
200
it dropped a bit more, and sometimes multiple intrinsics are not intrinsified.If one uses
-Xbatch -X:-TieredCompilation
, then the cound does not change at all, even for200
.Since the marginal speedup from
5000
to200
is very small, I decided to be on the safe side.This is still a speedup of 2.7x.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11944/head:pull/11944
$ git checkout pull/11944
Update a local copy of the PR:
$ git checkout pull/11944
$ git pull https://git.openjdk.org/jdk pull/11944/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 11944
View PR using the GUI difftool:
$ git pr show -t 11944
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11944.diff