-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8254108: ciReplay: Support incremental inlining #6413
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
|
👋 Welcome back chagedorn! A progress list of the required criteria for merging this PR into |
|
@chhagedorn 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
|
src/hotspot/share/ci/ciReplay.cpp
Outdated
| if (had_error()) { | ||
| // Pending exception? | ||
| break; | ||
| } |
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 don't see how a pending exception is possible here, given the check at L763, and parse_int() doesn't throw any.
What do you think about not calling parse_int() if _version < 2, that way there is no error to ignore?
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 think that's a better idea to not parse it at all now that we have version numbers available.
| build_inline_tree_for_callee(callee_method, jvms, caller_bci); | ||
| InlineTree* callee_tree = build_inline_tree_for_callee(callee_method, jvms, caller_bci); | ||
| if (should_delay || AlwaysIncrementalInline) { | ||
| callee_tree->set_late_inline(); |
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.
It took me a while to figure out why this is needed: for replay. It bothers me a little that AlwaysIncrementalInline is check here and again in the caller. If the replay file sets should_delay to false, then we shouldn't let AlwaysIncrementalInline to force it to true, right? So I'm wondering if it would be better to pre-set should_delay to true in the caller if AlwaysIncrementalInline is true.
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've added a comment to make it more clear. So, this code is only to record the late inlining decision to later dump it to the replay file. I think initializing should_delay = AlwaysIncrementalInline is a good idea. should_delay can only become true but not false anymore during normal compilation.
But I think we need to leave || AlwaysIncrementalInline in here https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/doCall.cpp#L192 in case someone wants to replay compile with that flag even though the replay file recorded a different late inlining decision.
I also fixed the test if run with -XX:+AlwaysIncrementalInline.
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.
Shouldn't the recorded inlining decision always override flags like -XX:+AlwaysIncrementalInline?
This brings up the question of how to handle flags. If we stored them in the replay file, then the replay compile could compare those to the current flags and if they don't match:
- give a warning and continue, correct replay not guaranteed
- give an error and refuse to continue
- override current flags with saved flags (this could be implemented by having the "ci" layer cache flags settings for each compile)
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.
As we have discussed offline, it's best not to treat AlwaysIncrementalInline specially given that we are already enforcing the general inlining decisions based on the replay data. I will therefore remove || AlwaysIncrementalInline from L192.
About the flag handling in general, as you have suggested offline, I also think it's a good option to put the used flags in the replay file in the future and enforce them. If the user wants to run a different set of flags for any reasons then the replay file can be adapted accordingly.
| return false; | ||
| } | ||
| if (should_not_inline(callee_method, caller_method, caller_bci, profile)) { | ||
| if (should_not_inline(callee_method, caller_method, caller_bci, NOT_PRODUCT_ARG(should_delay) profile)) { |
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.
How about a comment for these two calls saying replay may override "should_delay"?
…n with -XX:+AlwaysIncrementalInline
| build_inline_tree_for_callee(callee_method, jvms, caller_bci); | ||
| InlineTree* callee_tree = build_inline_tree_for_callee(callee_method, jvms, caller_bci); | ||
| if (should_delay || AlwaysIncrementalInline) { | ||
| callee_tree->set_late_inline(); |
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.
Shouldn't the recorded inlining decision always override flags like -XX:+AlwaysIncrementalInline?
This brings up the question of how to handle flags. If we stored them in the replay file, then the replay compile could compare those to the current flags and if they don't match:
- give a warning and continue, correct replay not guaranteed
- give an error and refuse to continue
- override current flags with saved flags (this could be implemented by having the "ci" layer cache flags settings for each compile)
| bool& should_delay) { | ||
| assert(callee_method != NULL, "caller checks for optimized virtual!"); | ||
| assert(!should_delay, "should be initialized to false"); | ||
| assert(!should_delay || AlwaysIncrementalInline, "should be initialized to false"); |
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'm not sure how useful this assert is now. It could be changed to should_delay == AlwaysIncrementalInline, or maybe just removed?
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.
Agreed, removed.
|
@chhagedorn 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 88 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 |
|
Thanks Dean for the careful review! |
TobiHartmann
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.
The changes look good to me. Nice test!
|
Thanks Tobias for your review! |
|
/integrate |
|
Going to push as commit 38802ad.
Your commit was automatically rebased without conflicts. |
|
@chhagedorn Pushed as commit 38802ad. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This patch adds support to explicitly apply incremental inlining when replay compiling a method if the original compilation of the method was also incrementally inlined. We write a new value when dumping the inline tree to indicate if an inlinee was incrementally inlined (
= 1) or not (= 0).To implement this, I updated the
REPLAY_VERSIONto 2 and additionally added a test to verify that old replay file versions are still working. I added some support to modify/remove version numbers of generated replay files in tests. I also refactored the test added by JDK-8275868 to reuse some of the methods.Thanks,
Christian
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6413/head:pull/6413$ git checkout pull/6413Update a local copy of the PR:
$ git checkout pull/6413$ git pull https://git.openjdk.java.net/jdk pull/6413/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 6413View PR using the GUI difftool:
$ git pr show -t 6413Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6413.diff