-
Notifications
You must be signed in to change notification settings - Fork 39
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
8349814: [leyden] Reduce uncommon traps in preload code #38
base: premain
Are you sure you want to change the base?
8349814: [leyden] Reduce uncommon traps in preload code #38
Conversation
Since this avoids excess C2 (re-)compilations, the major impact is on "user" time. This impact reflects to run-to-run times when we are short on available CPU cores:
|
👋 Welcome back shade! A progress list of the required criteria for merging this PR into |
@shipilev 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 no new commits pushed to the 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 (@vnkozlov, @iwanowww) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Webrevs
|
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.
Good.
@iwanowww, is this what you had in mind when we talked at our last meeting? |
@@ -2126,6 +2126,13 @@ JRT_ENTRY_PROF(void, Deoptimization, uncommon_trap_inner, Deoptimization::uncomm | |||
Events::log_deopt_message(current, "Uncommon trap: reason=%s action=%s pc=" INTPTR_FORMAT " method=%s @ %d %s", | |||
reason_name, reason_action, pc, | |||
tm->name_and_sig_as_C_string(), trap_bci, nm->compiler_name()); | |||
|
|||
if (nm->preloaded() && (action != Action_none)) { |
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.
At some point, I added SCC-related info to TraceDeoptimization
output [1], but it turns out I didn't upstream it. (I had a script which parsed the log and aggregated information about deopts in archived code.)
Maybe it's better to upstream it instead of introducing such adhoc logging.
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.
But speaking of monitoring for uncommon traps in generated code: the ultimate goal may be to completely eliminate uncommon traps in preloaded code. In that respect, it's more interesting to monitor for all uncommon traps issued during compilation rather than those hit at runtime.
For C2 it's GraphKit::uncommon_trap()
, so I suggest to move the code there. Also, additional information about compilation (id) and location (jvms info) is useful to pin down the root cause.
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.
Yeah. I added logging at GraphKit::uncommon_trap
. That logging is super-noisy. So I left the tracing code that warns when we trigger the actual deopt by stepping on such trap.
In addition to Vladimir's comments above, I also found this greatly expands the size of generated code for preloading, which leads to expanded code buffers, which makes more methods ineligible for SCC. So the net effect can be negative. This PR is on hold until I figure out a way out of this. |
4051ce1
to
de15c2c
Compare
@shipilev 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. |
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.
// For performance reasons, preloaded nmethods should avoid deopts that lead to recompilations. | ||
// Compiler logs all uncommon traps with -Xlog:scc. That log is noisy, and some traps may be | ||
// legitimate. Here, we log the problems that really caused the deopts at runtime. | ||
log_warning(deoptimization)("In preload code: reason=%s action=%s method=%s", |
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.
Does it warrant a warning though? It can become quite noisy and users don't have any way to address the problem. log_info
looks a better fit here (and, probably, narrow the category to scc+deoptimization
).
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.
Doing these as warnings
are my habit when doing high-perf prototypes. But yeah, we can do info
instead, and I'll just enable the logging in my perf scripts.
Preload code is the C2 code we load very early, before it gets substituted by more advanced C2 code. We are seeing lots of uncommon traps from the preloaded code, though, which invalidates it too early. We can do precompile code without uncommon traps to alleviate this.
Additional testing:
runtime/cds
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/leyden.git pull/38/head:pull/38
$ git checkout pull/38
Update a local copy of the PR:
$ git checkout pull/38
$ git pull https://git.openjdk.org/leyden.git pull/38/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 38
View PR using the GUI difftool:
$ git pr show -t 38
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/leyden/pull/38.diff
Using Webrev
Link to Webrev Comment