-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8371536: C2: VerifyIterativeGVN should assert on first detected failure #28295
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 bmaillard! A progress list of the required criteria for merging this PR into |
|
@benoitmaillard 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 394 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 |
|
@benoitmaillard 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. |
chhagedorn
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.
Good idea, looks good to me!
eme64
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.
@benoitmaillard Thanks for working on this, it will be really helpful for triaging :)
| if (is_verify_Value()) { | ||
| bool failure = verify_Value_for(n); | ||
| assert(!failure, "Missed Value optimization opportunity in PhaseIterGVN for %s", n->Name()); | ||
| } | ||
| if (is_verify_Ideal()) { | ||
| bool failure = verify_Ideal_for(n, false) || verify_Ideal_for(n, true); | ||
| assert(!failure, "Missed Ideal optimization opportunity in PhaseIterGVN for %s", n->Name()); | ||
| } | ||
| if (is_verify_Identity()) { | ||
| bool failure = verify_Identity_for(n); | ||
| assert(!failure, "Missed Identity optimization opportunity in PhaseIterGVN for %s", n->Name()); | ||
| } |
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 alternative would be to directly assert in the verify methods, but I suppose that would be a bigger code change.
Hmm, I did see some cases in the verify methods that are maybe not directly "missed optimization opportunity" but some other kind of issue. Maybe we should assert directly for those, rather than returning and ending up at this assert.
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.
Look at:
Ideal optimization did not make progress but created new unused nodes.
And
Ideal optimization did not make progress but node hash changed.
That's all I could find now, but you should double check ;)
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 alternative would be to directly assert in the verify methods, but I suppose that would be a bigger code change.
Yes, I also considered it. I don't really have a strong opinion, but maybe you do. Asserting directly in the verify methods would allow us to have more targeted asserts, and more accurate reports for triaging. On the other side, as you mentioned, this would be more code changes.
Hmm, I did see some cases in the verify methods that are maybe not directly "missed optimization opportunity" but some other kind of issue. Maybe we should assert directly for those, rather than returning and ending up at this assert.
These are not labelled as such in the printing, but I would argue these are still missed optimization opportunities, aren't they? I mean if things are still moving when calling Ideal, it means that this could have been done earlier.
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.
Honestly, I would do the changes, and just assert in the specific methods. That also helps us with more precise stack traces. The required changes are not that large and surely not that complicated, and we may actually end up with less code over all.
Ideal optimization did not make progress but created new unused nodes.
This one could get triggered even if we don't make progress at all. It may be that some Ideal optimization always generates nodes but then does not actually insert them into the graph. That could be considered wasteful, and that is really all that assert tells us. What do you think?
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, doing the changes sounds quite reasonable and is definitely worth it if it gives us more information.
This one could get triggered even if we don't make progress at all. It may be that some Ideal optimization always generates nodes but then does not actually insert them into the graph. That could be considered wasteful, and that is really all that assert tells us. What do you think?
Mmh, I never saw that assert actually getting triggered, interesting. I agree as well, in this case it's a bit different. I will do the changes, thanks for the suggestions!
This PR introduces changes in the detection of missing IGVN optimizations. As explained in the JBS issue description, when
-XX:VerifyIterativeGVNwas introduced, it was helpful to list all the missing optimizations. Such failures occur less frequently now, and the focus has changed to being able to debug such failure quickly and identifying similar or related failures during bug triaging.In summary, this PR brings the following changes:
verify_Optimizeinstead of attemtping to process all the nodes in the graph. This makes the output easier to parse, and also decreases the overhead of getting to the actual optimization site with a debugger.Need to remove from hash before changing edgesassert messages by removing the verified node from the hash table before attempting to optimize the node in question.Example outputs
JDK-8371534: C2: Missed Ideal optimization opportunity with AndL and URShiftL
Before the change, we would get two missed optimizations (the second one is only a consequence of the first one). After the change, we only get the first one, which is the one that actually needs to be fixed. We also get the name of the node in the assert message.
Before
After
JDK-8371558: C2: Missing optimization opportunity in AbsNode::Ideal
Before, we get a confusing
Need to remove from hash before changing edgesassert.After, we get the actual cause of the failure as well as the name of the node in the assert itself.
Before
After
Testing
Thank you for reviewing!
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28295/head:pull/28295$ git checkout pull/28295Update a local copy of the PR:
$ git checkout pull/28295$ git pull https://git.openjdk.org/jdk.git pull/28295/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28295View PR using the GUI difftool:
$ git pr show -t 28295Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28295.diff
Using Webrev
Link to Webrev Comment