8365570: C2 fails assert(false) failed: Unexpected node in SuperWord truncation: CastII#26827
8365570: C2 fails assert(false) failed: Unexpected node in SuperWord truncation: CastII#26827jaskarth wants to merge 8 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back jkarthikeyan! A progress list of the required criteria for merging this PR into |
|
@jaskarth 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 26 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 |
Webrevs
|
src/hotspot/share/opto/superword.cpp
Outdated
| // Vector nodes should not truncate. | ||
| if (type->isa_vect() != nullptr || type->isa_vectmask() != nullptr || in->is_Reduction()) { | ||
| // Vector nodes and casts should not truncate. | ||
| if (type->isa_vect() != nullptr || type->isa_vectmask() != nullptr || in->is_Reduction() || in->is_ConstraintCast()) { |
There was a problem hiding this comment.
Why should we not truncate a CastII? What can go wrong?
There was a problem hiding this comment.
My thinking was that since casts specifically change the type of a node, they may not be safe to truncate. In practice it might not matter because after the CastII pack is created, it's discarded because there is no backend implementation for vectorized CastII. I've opted to mark them as non-truncating to stay on the safer side.
There was a problem hiding this comment.
I see. Ok. Can you add a comment to the code for that?
Because imagine we come along later and actually implement a backend vectorized version of CastII (no-op?). Maybe because we implement if-conversion. Then it would be nice to know if this was just a "to be on the safe side" check, or if it would run into issues when removed.
There was a problem hiding this comment.
Because the current comment says "should not truncate". That sounds more strong than "to be on the safe side".
There was a problem hiding this comment.
I think this is fair, I've pushed a commit that changes the comment wording. Let me know what you think!
There was a problem hiding this comment.
We have CastVV which should be the packed version of CastII. The thing that is I think the most difficult is to properly wire it. In the simplest situation of all elements in the pack having the same control input can be easily handled, though.
There was a problem hiding this comment.
Right. I don't think there is currently any case where CastII would actually be useful to pack in superword. They usually originate from some control-flow. For example a comparison on a variable if (x < 5) and then we can CastII the variable x on the branches. But that only becomes relevant with if-conversion.
Or do you see a case that could happen without if-conversion where CastII needs to be handled?
|
@jaskarth Thanks for the fix, it looks good to me now :) |
|
Thanks a lot for the testing @eme64! I think I need another review to merge it. |
chhagedorn
left a comment
There was a problem hiding this comment.
The fix looks good to me, too! I only have one comment about the test.
| return new Object[] { in, res }; | ||
| } | ||
|
|
||
| @Test(compLevel = CompLevel.C2) |
There was a problem hiding this comment.
Any particular reason you've chosen C2 here and not let the IR framework handle it? (by default it's ANY which will compile at the highest available tier). I'm also wondering if this test would fail if someone ran the test with a build without C2.
There was a problem hiding this comment.
Thanks for the comment! I used CompLevel.C2 here to simulate an -Xcomp environment, since unfortunately I couldn't replicate the crash without it with the IR framework. I'll do some investigation to find a way to ensure that it won't fail without C2.
There was a problem hiding this comment.
When you specify @Warmup(0), the IR framework should directly compile it at the highest level which should be C2 if you are not running with a client build. So, I would have expected that it makes no difference. Can you double-check if you can reproduce it with CompLevel.C2 but not without?
There was a problem hiding this comment.
After taking a closer look, I think you're correct- I can reproduce the crash using just @Warmup(0) and @Test. I think I used both while debugging and didn't test whether it worked without CompLevel.C2. I've removed it in the latest commit.
However, I noticed that after that I merged from master neither the test nor the reproducer failed compilation before the fix is added. I think another commit must have changed the generated graph so that it no longer tries to vectorize the CastII, leading to the crash not being triggered. I looked at the JBS entry and saw that there wasn't another reproducer for this, so I was a bit unsure on what to do. Should this patch be merged with the current test?
There was a problem hiding this comment.
@jaskarth Thanks for looking into it!
I would still add the fix, just in case. And I think the test as well, even if it does not reproduce any more.
I was wondering: before the merge, when the test still reproduced:
If you removed the @Warmup(0) and CompLevel.C2, and instead just do framework.addFlags with -Xcomp, would that reproduce too? If so, you could have a framework run with and one without Xcomp, the one with Xcomp also should have a compileonly. What do you think?
Or we just push the patch as is, to be sure this is done and integrated. What do you think @chhagedorn ?
There was a problem hiding this comment.
Yep, I can replicate the crash on the old commit with TestFramework.runWithFlags("-Xcomp", "-XX:CompileCommand=compileonly,*TestSubwordTruncation::*"); instead of @Warmup(0). I think this would also be a good option, as it would let you get coverage with Xcomp on the other tests as well.
There was a problem hiding this comment.
I've pushed a commit that changes the Warmup(0) to the second test run.
There was a problem hiding this comment.
Given the timeout reported by Tobias, I would rather opt for @Warmup(0) with one run() only. We will eventually run the test with -Xcomp on higher tiers, for example at tier6, so we get Xcomp coverage at some point.
There was a problem hiding this comment.
I think that's a good point, I've reverted this change.
|
@jaskarth 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 issue a |
|
@jaskarth This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the |
|
Hi @jaskarth: Any plans to pick this back up? Thanks! |
|
Hi @TobiHartmann, I haven't had a chance to take a look at this due to being busy with my studies but I'm hoping to pick it back up in a week. |
|
/open |
|
@jaskarth This pull request is now open |
|
Sounds good, thanks for the update! |
|
@jaskarth 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 issue a |
|
@TobiHartmann @chhagedorn May I have some reviews on the updated patch? Thank you! |
chhagedorn
left a comment
There was a problem hiding this comment.
Update looks good! Thanks for coming back to this.
TobiHartmann
left a comment
There was a problem hiding this comment.
Looks good to me too, thanks! I re-submitted some quick testing and will report back once it passed.
|
I see timeouts with the test in various configurations, maybe the default timeout should be increased? |
This reverts commit 50bc132.
|
Thank you for running testing @TobiHartmann! I've pushed a commit that reverts the change made to run with |
|
Sounds good, I re-submitted testing. |
chhagedorn
left a comment
There was a problem hiding this comment.
Looks good, thanks for the update! Let's wait for the testing to be completed.
|
All tests passed. |
|
Thank you for the review and testing! /integrate |
|
Going to push as commit 775f48d.
Your commit was automatically rebased without conflicts. |
|
/backport :jdk26 |
|
@TobiHartmann the backport was successfully created on the branch backport-TobiHartmann-775f48de-jdk26 in my personal fork of openjdk/jdk. To create a pull request with this backport targeting openjdk/jdk:jdk26, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk: |
Hi all,
This is a quick patch for the assert failure in superword truncation with CastII. I've added a check for all constraint cast nodes, and attached a reduced version of the fuzzer test. Thanks!
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26827/head:pull/26827$ git checkout pull/26827Update a local copy of the PR:
$ git checkout pull/26827$ git pull https://git.openjdk.org/jdk.git pull/26827/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26827View PR using the GUI difftool:
$ git pr show -t 26827Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26827.diff
Using Webrev
Link to Webrev Comment