-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8373114: Redundant MethodCounters in the preimage generated by training run #28670
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 asmehra! A progress list of the required criteria for merging this PR into |
|
@ashu-mehra 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 165 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 |
|
@ashu-mehra 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. |
…ng run Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
ae1c841 to
f741349
Compare
|
@ashu-mehra Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information. |
Webrevs
|
|
I did a force-push to fix the bug id in the commit message. |
|
I'm not an expert in CDS, but the fix doesn't look right. It breaks Metadata traversal CDS relies on. Instead, if you don't want to keep around |
Right, this is not the correct fix. It breaks the Method->MethodCounters link for all the methods. We need to preserve the links for the MethodCounters that get added through MTD. |
hmm, I think I am wrong here again. We don't need to preserve the Method->MCS link. We only need the MTD->MCS link. |
|
I looked at the code again and unless I missed something it looks like the MCS from MTD are not used at all. I don't see their usage either in mainline or in leyden premain branch. Why do we even care to store MCS at all then? @veresov can you please comment about this? |
|
They are not used right now but @vnkozlov is going to use them for the A4 recompilation strategy. |
yes, I need it for A4 entry counter. Also I thought MC is used to cache MTD pointer: |
|
Yes, but caching is a runtime thing it's not really need in the archive. But for your work we probably do need it. |
Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
|
Okay, I updated the fix. Idea is the same as before - add MethodCounters reachable from MethodTrainingData, not from Method. But the new fix relies on updating Another approach I thought of was to add the filtering in |
|
What's the percentage of the memory usage in the archive do you typically see attributed to MCs? |
|
Before the patch with mainline: In final AOTCache: After the new fix, I see following stats: In pre-image: In final AOTCache: So the size of MethodCounters is 2.6% (before fix) vs 0.6% (after fix) in the preimage, and 1% (before fix) vs 0.6% (after fix) in the AOTCache. |
Hi Ashutosh, I've created a patch for finding the type of the enclosing obj: Could you try to see if that works for you? Thanks |
@iklam thanks for the changes. This is indeed what I wanted and updated the patch with the following change: But it seems like this is not sufficient. With this approach number of MethodCounters are only 1142 while the MTDs are around 4k. This is because in |
Currently I am not sure if there's a compatibility issue -- probably not. Currently, we have never had a situation where the follow-mode of a referenced object is sometimes However, the implementation will be more complicated, as we have to remember the decision on each reference (currently the decision is remembered on the referenced object). Maybe we should go with your first approach for now, and experiment with the second approach in a later RFE. |
iklam
left a comment
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
Details are mentioned in the bug report and this mail thread https://mail.openjdk.org/pipermail/leyden-dev/2025-December/002843.html
After this patch the number of MethodCounters in the preimage are much less than before this patch. Also the number of MethodCounters in the preimage is the same as in the final AOTCache (these numbers are obtained using -Xlog:aot=trace).
Before this patch for the training run:
Before this patch for the assembly phase:
After this patch for the training run:
After this patch for the assembly phase:
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28670/head:pull/28670$ git checkout pull/28670Update a local copy of the PR:
$ git checkout pull/28670$ git pull https://git.openjdk.org/jdk.git pull/28670/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28670View PR using the GUI difftool:
$ git pr show -t 28670Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28670.diff
Using Webrev
Link to Webrev Comment