-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8371964: C2 compilation asserts with "Unexpected load/store size" #28410
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
Conversation
|
👋 Welcome back qamai! A progress list of the required criteria for merging this PR into |
|
@merykitty 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 231 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 |
|
@merykitty 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. |
Webrevs
|
| assert(load_sz <= MaxVectorSize, "Unexpected load size"); | ||
| if (load_sz > MaxVectorSize) { | ||
| // Dead node, should go away | ||
| return nullptr; | ||
| } |
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.
Do I understand correctly that this widening/removal of the CastLL node is happening on an actual dead path that is going to be removed anyway?
It sounds like this problem is specific to post loop opts IGVN phases where we are allowed to widen CastII/LL nodes. Could we assert that this bailout only happens after post loop opts?
Apart from that, I think your fix is reasonable. Were you able to also extract a reproducer?
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.
Done, running compiler/arraycopy/TestArrayCopyDisjoint.java with -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation -XX:+StressArrayCopyMacroNode -XX:+StressLCM -XX:+StressGCM -XX:+StressIGVN -XX:+StressCCP -XX:+StressMacroExpansion -XX:+StressMethodHandleLinkerInlining -XX:+StressCompiledExceptionHandlers -XX:VerifyConstraintCasts=1 -XX:+StressLoopPeeling encounters this issue. Do you think it is necessary to add a separate case for that test, 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.
Thanks for the update! If it's a short running test/config, then I think it would be good to have this extra config to cover the changes of this patch.
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.
Is it truly specific to post-loop opts phase? Isn't it yet another paradoxical IR shape occurring in effectively dead code?
In the longer term, it would be good to ensure such effectively dead nodes eventually go away. Or, better, eagerly trigger their elimination. Otherwise, it could cause issues later in compilation process unless the problematic conditions are explicitly handled everywhere (e.g., during matching or code generation for vmask_gen_imm on x64 and AArch64).
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.
That's a good idea, so I change the function to returning top in those cases. For the VectorMaskGenNode itself, the situation seems harder, because it can float anywhere, so after loop opts and cast node removal, GVN may common multiple different instances of VectorMaskGenNode, and it is inevitable that it may be executed with an out-of-bounds input value. I think we just need to make sure that its uses can live with the fact that the result would be unspecified then.
|
Is this issue at all related to #24575? It seems we remove a If I remember correctly from #24575, if a CastLL is narrowing, we don't want to remove it, see Can you elaborate a bit more on where the |
|
@eme64 Yes, it is indeed similar. The issue here is that after loop opts, we try to remove almost all
Macro expansion tries to be smart for an array copy and does this: As you can see, the masked accesses are only meaningful if |
|
@merykitty Thanks for the explanations! Any opinions from @rwestrel ? |
But the type of the CastLL is widened after loop opts, right? |
|
@rwestrel Ok, thanks for the clarifying details. That makes sense. I missed the widening after loop-opts: before the constant input lay outside the range, now it is inside and so the |
|
@rwestrel Is there any conflict with your solution? If not, we can go ahead with @merykitty 's solution here. |
No, no conflict. |
|
Are we moving forward with this? Still too many failures in local testing without this fix :) |
|
We either need this fix or a backout of whatever caused the problem. The fork is this week and this causes a lot of failures in testing. |
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.
Otherwise, looks good to me.
test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyDisjoint.java
Outdated
Show resolved
Hide resolved
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.
Looks good to me, thanks for fixing this @merykitty !
|
@merykitty Hold off with integration for a few hours, @chhagedorn just launched some internal testing. |
|
Thanks a lot for your reviews, please reapprove when the tests pass. |
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.
Testing passed!
|
Let's go then? I am eager to try and enable deeper CTW testing again :) |
|
Thanks for the approval! |
|
Going to push as commit ca4ae80.
Your commit was automatically rebased without conflicts. |
|
@merykitty Pushed as commit ca4ae80. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Hi,
This fixes the crash in
Load/StoreVectorMaskedNode::Ideal. The issue here is that the graph is not canonical during idealization, which leads to us processing a dead node. The fix I propose is to bail-out when that happens.To be more specific, for this issue, we have the graph that looks like:
with
ConIbeing 45 andMaxVectorSizebeing 32. In this instance,CastLLis processed beforeConvI2L, and when it is processed, it sees that the type ofConvI2Lbeing its bottom type. As a result, it does not know that it is top, and since we are after macro expansion, which is after loop opts, theCastLLgoes away, leaving us with:After
ConvI2Lis processed, we know that the input ofVectorMaskGenis a constant 45, which is larger thanMaxVectorSize, leading to the assert failure.Please take a look and leave your thoughts, thanks a lot.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28410/head:pull/28410$ git checkout pull/28410Update a local copy of the PR:
$ git checkout pull/28410$ git pull https://git.openjdk.org/jdk.git pull/28410/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28410View PR using the GUI difftool:
$ git pr show -t 28410Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28410.diff
Using Webrev
Link to Webrev Comment