-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8372701: Randomized profile counters #28541
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
base: master
Are you sure you want to change the base?
Conversation
|
👋 Welcome back aph! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
@theRealAph this pull request can not be integrated into git checkout JDK-8134940
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
|
|
|
@theRealAph 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. |
|
Impressive work. Clashes a bit with #25305, which commons the type profile check and makes it more robust. It would be trivial to resolve, as that PR has only one place where counter is updated. Also gives you some additional budget to spare for more instructions in profiled code. So it would be nice if that PR (and probably its AArch64 version) lands first. |
Thanks. Sure, it can wait for that PR. |
|
The inlined profile update code is moved to a stub, then in its place we put: At the moment, several C2 IR tests fail with randomized profile counters because they are acutely sensitive to small changes in profile counts. I think this can probably be fixed. Also, I believe there are some kinds of event that should never be missed, even when subsampling profile counters in this way. I'd like people to advise me which events these are. |
|
I have only made the back-end changes to AArch64 and x86. The back-end changes are simple to make for other architectures, and will need to be done if this PR is to be merged into mainline. |
One other thing that comes into mind: the initial swing from |
OK, all useful thoughts. I'll have a look. |
|
Happy to see a serious contender for a resolution to this long-standing issue. While it's a bit unclear how problematic it is in practice we see issues related to this in thread-heavy benchmarks (such as SPECjvm2008) regularly.
I assume you mean interpreter counters? |
Oops. yes, of course, thanks! |
Please use this link to view the files changed.
Profile counters scale very badly.
The overhead for profiled code isn't too bad with one thread, but as the thread count increases, things go wrong very quickly.
For example, here's a benchmark from the OpenJDK test suite, run at TieredLevel 3 with one thread, then three threads:
This slowdown is caused by high memory contention on the profile counters. Not only is this slow, but it can also lose profile counts.
This patch is for C1 only. It'd be easy to randomize C1 counters as well in another PR, if anyone thinks it's worth doing.
One other thing to note is that randomized profile counters degrade very badly with small decimation ratios. For example, using a ratio of 2 with
-XX:ProfileCaptureRatio=2with a single thread results inThe problem is that the branch prediction rate drops away very badly, leading to many mispredictions. It only really makes sense to use higher decimation ratios, e.g. 64.
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28541/head:pull/28541$ git checkout pull/28541Update a local copy of the PR:
$ git checkout pull/28541$ git pull https://git.openjdk.org/jdk.git pull/28541/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28541View PR using the GUI difftool:
$ git pr show -t 28541Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28541.diff
Using Webrev
Link to Webrev Comment