-
Notifications
You must be signed in to change notification settings - Fork 156
8261147: C2: Node is wrongly marked as reduction resulting in a wrong execution due to wrong vector instructions #231
Conversation
… execution due to wrong vector instructions
|
👋 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. |
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.
Looks good to me.
|
@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 24 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 Tobias for your review! |
vnkozlov
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.
|
Thanks Vladimir for your review! |
|
/integrate |
|
Going to push as commit f791fdf.
Your commit was automatically rebased without conflicts. |
|
@chhagedorn Pushed as commit f791fdf. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
C2 produces a wrong result for the testcase due to treating a non-reduction
AddLnode wrongly as a reduction (Node::is_reduction()is true). This node is later part of a pack in the superword algorithm which wrongly treats it as a reduction. As a result, we create anAddReductionVLinstead of anAddVLnode, letting the test fail.The wrong reduction can be traced back to
AddNode::Idealwhere we create a clone of anAddLnode which is marked as a reduction. However, the clone itself is no longer a reduction but is still marked as such.Node::clone()simply copies theFlag_is_reductionflag inNode::_flags:jdk17/src/hotspot/share/opto/addnode.cpp
Lines 181 to 196 in 4f70759
I don't think we need to clone the
Flag_is_reductionflag by default inNode::clone(). I went through the uses ofNode::clone()and I think we only need to clone the flag when copying an entire loop body inPhaseIdealLoop::clone_loop(). That's what I propose as a fix. This approach also avoids the need to think about reductions in future uses ofNode::clone()with a special handling for it as it would be required inAddNode::Idealetc.I did some performance testing with some common benchmarks which looked good. I also ran the follwing JTreg tests which showed the same number of newly created vectors with and without the fix:
Thanks,
Christian
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk17 pull/231/head:pull/231$ git checkout pull/231Update a local copy of the PR:
$ git checkout pull/231$ git pull https://git.openjdk.java.net/jdk17 pull/231/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 231View PR using the GUI difftool:
$ git pr show -t 231Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk17/pull/231.diff