-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8300257: C2: vectorization fails on some simple Memory Segment loops #12942
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 roland! A progress list of the required criteria for merging this PR into |
|
So the final expression should be seen by superword as next since First, I think you messed up with |
I left the constant part of the address out of the expressions. So that was on purpose but confusing, sorry. |
|
So we need to check all AddP to find base offset. No short cuts then :( |
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.
My tier1-4,xcomp and stress testing passed.
I looked and changes and they seems fine.
May be we need to run performance testing too.
|
@rwestrel this pull request can not be integrated into git checkout JDK-8300257
git fetch https://git.openjdk.org/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
|
@rwestrel 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 33 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 |
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. I'll run some perf testing and report back.
test/hotspot/jtreg/compiler/c2/irTests/TestVectorizationMultiInvar.java
Outdated
Show resolved
Hide resolved
test/hotspot/jtreg/compiler/c2/irTests/TestVectorizationMultiInvar.java
Outdated
Show resolved
Hide resolved
src/hotspot/share/opto/superword.cpp
Outdated
| if (n->in(2)->is_Con() && invariant(n->in(1))) { | ||
| _negate_invar = negate; | ||
| _invar = n->in(1); | ||
| maybe_add_to_invar(maybe_negate_invar(negate, n->in(1))); |
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.
It feels like maybe_negate_invar should be moved into maybe_add_to_invar and be controlled by a negate argument.
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 review. I applied your suggestions and made that change too.
|
Performance and correctness testing looks good. |
Co-authored-by: Tobias Hartmann <tobias.hartmann@oracle.com>
…nvar.java Co-authored-by: Tobias Hartmann <tobias.hartmann@oracle.com>
…nvar.java Co-authored-by: Tobias Hartmann <tobias.hartmann@oracle.com>
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.
Thanks for making these changes. SWPointer::maybe_negate_invar could now be removed as it has only one user but I'm also fine with leaving it as is.
Thanks for looking at this again. |
|
/integrate |
|
Going to push as commit 6b2a86a.
Your commit was automatically rebased without conflicts. |
In the test case
testByteLong1(that's extracted from a memorysegment micro benchmark), the address of the store is initially:
(#numbers are node numbers to help the discussion).
iv#101is thePhiof a counted loop.invar#163is thebaseOffsetload.To eliminate the range check, the loop is transformed into a loop nest
and as a consequence the address above becomes:
invar#308is some expression from aPhiof the outer loop.That
AddPis transformed multiple times to push the invariants out of loop:then:
and finally:
AddP#855is out of the inner loop.This doesn't vectorize because:
there are 2 invariants in the address expression but superword only
support one (tracked by
_invarinSWPointer)there are more levels of
AddP(4) than superword supports (3)To fix that, I propose to no longer track the address elements in
_invar,_negate_invarand_invar_scalebut instead to have asingle
_invarwhich is an expression built by superword as itfollows chains of
addPnodes. I kept the previous_invar,_negate_invarand_invar_scaleas debugging and use them to checkthat what vectorized with the previous scheme still does.
I also propose lifting the restriction on 3 levels of
AddPentirely.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/12942/head:pull/12942$ git checkout pull/12942Update a local copy of the PR:
$ git checkout pull/12942$ git pull https://git.openjdk.org/jdk.git pull/12942/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 12942View PR using the GUI difftool:
$ git pr show -t 12942Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12942.diff
Webrev
Link to Webrev Comment