-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8348645: IGV: visualize live ranges #23558
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
8348645: IGV: visualize live ranges #23558
Conversation
… when switching view or disabling
Commit 0016922 should fix the issue, thanks again. |
...raphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/ShowLiveRangesAction.java
Outdated
Show resolved
Hide resolved
Thanks for the fix Roberto. I noticed that the live ranges are not saved when saving the graph into an xml file ( |
@robcasloz, I was a bit puzzled by live ranges with Phi nodes but then I noticed that in the description you mention that they are treated somewhat in a special way:
I thought that variables that are joined by the Phi node are still live at the Phi node. Is this not the case? Or possibly you meant that it is better not to consider them live there (e.g. to reduce the number of live ranges in the block with the Phi node)? Irrespective of that, would it be feasible to add a "termination dash" at the bottom of the line (e.g. at the bottom of |
Good catch, thanks! No, I just overlooked this use case. Will fix. |
No, the usual "multiplex-like" liveness semantics for Phi instructions is to consider the joined variables live-out of their corresponding predecessor blocks and the resulting variable live-in in its block (and defined in parallel with other Phi definitions in the block), see e.g. Definition 4 in Ch. 21.2 in the SSA book draft. This is also in line with C2's handling of Phi nodes in liveness analysis.
Yes, that is a good idea, will do, thanks! |
Done (commit 87b31e9). |
Done (commit 31e4510). This turned out to be a bit more involved than I thought, please check that the changes meet your expectations. Here is an example of how the initial live ranges related to a phi instruction ( And here is how the live range |
Nice! I like that the live range end corresponds to the bottom of the block in the |
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.
Just a minor aesthetic thing: I noticed that in phases with no liveness information, the liveness information in each node is replaced by an empty space (instead of nothing):
instead of
Otherwise it looks good to me (I probably made more of a functionality rather than a code style/semantics kind of review). Thanks again @robcasloz.
Good catch, thanks Damon! Commit efbde14 should address that, please check that it works as you expect. |
@robcasloz This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
💓 |
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 awesome, thanks a lot for working on this Roberto! I tested it extensively and despite some layout weirdness that we discussed about off-thread and that does not seem to be related to your change, it works well.
I had a quick look at the hotspot changes and they look good to me as well.
Thank you very much for reviewing, Tobias! Will have a look at the weird layout issue and re-test before integrating. |
Thanks again for reviewing, Damon and Tobias! |
Going to push as commit 51ce312.
Your commit was automatically rebased without conflicts. |
@robcasloz Pushed as commit 51ce312. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This changeset extends IGV with live range visualization. It introduces live ranges as first-class IGV entities and displays them along with the control-flow graph in the CFG view. Visualizing liveness information should hopefully make C2's register allocator easier to understand, diagnose, debug, and enhance.
Live ranges are visible in C2 phases where liveness information is available, that is, phases
Initial liveness
toFix up spills
at IGV print level 4 or greater. For example, running a debug build of the JVM as follows:produces the following visualization for the
Initial spilling
phase:Live ranges are first-class IGV entities, meaning that the user can:
Properties
window or via tooltips;Live ranges are connected to nodes by a use-def relation: a node can define zero or one live ranges, and use multiple live ranges; a live range can be defined and used by multiple nodes. Consequently, a live range in IGV is visible if and only if all its related nodes are visible (fully or semi-transparently). Generally, the start and end of a live range are vertically aligned with the nodes that first define and last use the live range. To reflect accurately the semantics of Phi nodes w.r.t. liveness, the visualization treats live ranges related by Phi nodes specially: live ranges used by a Phi node end at the bottom of the corresponding predecessor basic blocks, whereas live ranges defined by a Phi node start at the top of the node's basic block. The following screenshot shows an example of a Phi node (
48 Phi
) joining live rangesL8
andL13
intoL15
:The changeset extends the IGV graph printing logic in HotSpot to emit basic block-level liveness information and live range properties such as associated register mask, score, and type. IGV propagates then the block-level liveness information down to individual nodes. Passing only basic block-level liveness information makes the graph serialization compact, limiting the size increase of the corresponding graphs to around 25%.
The IGV changes do not affect layout performance significantly in the sea-of-nodes view, and only introduce a moderate overhead (of around 10%) when displaying graphs with associated live ranges in the control-flow graph view.
Thanks to Damon Fenacci and Daniel Lundén for providing valuable feedback!
Testing
tier1 (windows-x64, linux-x64, linux-aarch64, and macosx-x64; release and debug mode).
Tested IGV manually on a few selected graphs. Tested automatically that displaying thousands of graphs using different views and filter combinations does not trigger any assertion failure (by enabling assertions, instrumenting IGV to display parsed graphs eagerly, and running
java -Xbatch -XX:-TieredCompilation -XX:PrintIdealGraphLevel=4
).Progress
Warnings
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23558/head:pull/23558
$ git checkout pull/23558
Update a local copy of the PR:
$ git checkout pull/23558
$ git pull https://git.openjdk.org/jdk.git pull/23558/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 23558
View PR using the GUI difftool:
$ git pr show -t 23558
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23558.diff
Using Webrev
Link to Webrev Comment