-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8295166: IGV: dump graph at more locations #16120
Conversation
👋 Welcome back dlunde! 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.
Nice enhancement! Looks good to me overall. Some comments below.
Please add an IGV screenshot of how the new phases look in the phase list.
Could you summarize which of the ideas / proposals from the RFE are not covered? We should file a follow-up RFE for them.
Many of the proposed dump locations are educated guesses. Should we adjust any of them?
They look good to me but let's see what others think.
Are the proposed levels (for PrintIdealGraphLevel) reasonable or should we adjust them? I put the loop optimization dumps at level 4 and adjusted IdealGraphVisualizer/README.md accordingly.
I think that's reasonable.
I put most new calls to print_method/print_method_iter within a NOT_PRODUCT. Is this OK?
Existing calls to print_method
are not guarded because the method also commits a JFR event and updates Compile::_latest_stage_start_counter
, so I think your new code should behave similar.
And please make sure that you verify that the 'optimized' build (--with-debug-level optimized
) still works. It's a level between fastdebug and release where both #ifdef ASSERT
and #ifdef PRODUCT
are false.
src/hotspot/share/opto/compile.cpp
Outdated
int iter = ++_igv_phase_iter[cpt]; | ||
print_method(cpt, level, n, iter); | ||
#else | ||
print_method(cpt, level, n); |
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.
This is dead code because all calls are guarded by NOT_PRODUCT
, right?
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.
Not quite, there is one unguarded call for PHASE_PHASEIDEALLOOP_ITERATIONS
at level 2. This is an existing phase that I converted from print_method
to print_method_iter
(as suggested by @chhagedorn in the issue corresponding to this PR).
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 current rule seems to be that we always want to emit a JFR event when dumping a graph - regardless of whether we dump a graph or not. I think we should follow this convention and remove the NOT_PRODUCT
from the calls to print_method_iter()
.
On a separate note, I'm wondering how useful it is to always dump all events when calling print_method()
. Should this be revisited again in general?
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 have now incorporated the functionality of print_method_iter
directly into print_method
, and also removed all the NOT_PRODUCT
wrappers.
I'm resolving this thread now, should we move the discussion regarding JFR event dumping somewhere else?
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.
Maybe we can mention it as a side node in the PR description that it is something we should think about at some point. But it should not block this PR.
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.
Sure, I'll add it to the final (non-draft) PR description.
Thanks for the review Tobias!
I've attached two sample screenshots of the phase list (from running one of the tests in
I believe I have covered everything in the RFE.
Ah, I see. Note, however, that the existing call to
I'll make sure to include this when testing. |
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.
Hi Daniel, thanks for working on this! The code changes themselves look good, I have a few comments/suggestions:
- It might make sense to create a new print level between current 3 and 4 including the new loop transformation dumps but not the individual IGVN step dumps.
- I see the value in numbering the
PHASE_PHASEIDEALLOOP_ITERATIONS
dumps, but I am not sure numbering the new loop transformations is worth the additional complexity (_igv_phase_iter
array, etc.). Limiting numbering toPHASE_PHASEIDEALLOOP_ITERATIONS
dumps would not require any additional state inCompile
. - In my opinion, it would be clearer to only dump loop transformations if they actually take place. I find it a bit confusing to see e.g.
Before/After superword ...
graph dumps when vectorization has actually failed and the graph has not changed at all. Dumping only after effective transformations would also match better the output ofTraceLoopOpts
. Enforcing this invariant would require getting rid of theBefore...
dumps though, but this is acceptable (and perhaps even preferable) in my opinion.
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.
Thanks for working on this! This is a good addition and helps to better debug with IGV. I left a few comments with some suggestion and improvement ideas. I gave it some more thought to improve some of the places where we dump the phases and how. But this is of course open for discussion.
src/hotspot/share/opto/compile.cpp
Outdated
int iter = ++_igv_phase_iter[cpt]; | ||
print_method(cpt, level, n, iter); | ||
#else | ||
print_method(cpt, level, n); |
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 current rule seems to be that we always want to emit a JFR event when dumping a graph - regardless of whether we dump a graph or not. I think we should follow this convention and remove the NOT_PRODUCT
from the calls to print_method_iter()
.
On a separate note, I'm wondering how useful it is to always dump all events when calling print_method()
. Should this be revisited again in general?
src/hotspot/share/opto/compile.cpp
Outdated
if (iter > 0) { | ||
ss.print(" %d", iter); | ||
} |
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 so sure about having an extra method print_method_iter()
where the user need to keep track if a method is possibly repeated or not. I therefore suggest to only keep print_method()
with its original signature and do the increment here like this:
int iter = ++_igv_phase_iter[cpt];
if (iter > 1) {
ss.print(" %d", iter);
}
Doing it this way we only add a number for the second time a phase is dumped again. I guess that's fine. But I'm open for other opinions about that.
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 agree with just having a print_method
. I initially hesitated to modify print_method
in the way you suggest, as it would then add iteration numbering to all phases with no exceptions. But, it seems this is a feature we want then?
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 it could be useful for any repeated phase, if others also agree with that. And we would still keep the same name for phases that are only printed once and only add a number for the repeated dumps.
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 changed it for now. If anyone does not agree, please let us know.
2e763a2
to
b80215f
Compare
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.
Otherwise, it looks good to me! Thanks for addressing all the comments and suggestions.
Co-authored-by: Christian Hagedorn <christian.hagedorn@oracle.com>
Co-authored-by: Christian Hagedorn <christian.hagedorn@oracle.com>
Co-authored-by: Christian Hagedorn <christian.hagedorn@oracle.com>
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.
Thanks for addressing all the comments and thanks for this nice contribution! The additional dumps, in combination with the CFG view in IGV, make C2 loop optimizations much more approachable.
Thanks for the comments and reviews! The tests are now finished, integrating (and I need a sponsor). /integrate |
/sponsor |
Going to push as commit 701bc3b.
Your commit was automatically rebased without conflicts. |
@robcasloz @dlunde Pushed as commit 701bc3b. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This changeset
Example phase list screenshots in IGV (first at level 6, second at level 4)

Some notes:
Testing
Platforms: windows-x64, linux-x64, linux-aarch64, macosx-x64, macosx-aarch64
--with-debug-level optimized
) still work.Platforms: linux-x64
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16120/head:pull/16120
$ git checkout pull/16120
Update a local copy of the PR:
$ git checkout pull/16120
$ git pull https://git.openjdk.org/jdk.git pull/16120/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 16120
View PR using the GUI difftool:
$ git pr show -t 16120
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16120.diff
Webrev
Link to Webrev Comment