Skip to content
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

8257531: Super word not applied to a loop of simple Buffer operations #1618

Closed
wants to merge 3 commits into from

Conversation

@vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Dec 4, 2020

In Buffer case there is additional (loop invariant) load from java/nio/IntBuffer.offset field.
SuperWord did not handle loop's invariants in complex address expressions (only when vectorization is forced):

AddP(addr, AddP(addr, addr, LShiftL(ConvI2L(CastII(AddI(AddI(iv_phi, invariant_LoadI), incr))), shift)), 16)

Invariant reference is used to make sure all memory accesses in vectors use the same one. And only when alignment code is generated in pre-loop it is used for code generatin. But that code did not take into account that invariant have to be scaled if needed as in this example (invariant_LoadI << shift).

I propose to record scaling (left shift) for invariant when it is present and use it to compare invariants and in pre-loop alignment code generation. I also slightly modified tracing output code for invariants.

This allow vectorize Java code which uses Buffer.

I added new test based on @PaulSandoz example. It tests presence of new vectors and correctness of vectorized code.
I included case (ByteBuffer.allocateDirect()) which is not vectorized because it uses Unsafe access - SuperWord complains about CastX2P(AddL) nodes which it sees instead of AddP. We may consider vectorizing such code too later.

Testing: tier1-4, precheckin-comp (-Xcomp), renaissance test


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8257531: Super word not applied to a loop of simple Buffer operations

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/1618/head:pull/1618
$ git checkout pull/1618

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Dec 4, 2020

👋 Welcome back kvn! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr label Dec 4, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Dec 4, 2020

@vnkozlov The following label will be automatically applied to this pull request:

  • hotspot-compiler

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.

@openjdk openjdk bot added the hotspot-compiler label Dec 4, 2020
@mlbridge
Copy link

@mlbridge mlbridge bot commented Dec 4, 2020

Webrevs

Copy link
Contributor

@rwestrel rwestrel left a comment

Looks good to me.

@openjdk
Copy link

@openjdk openjdk bot commented Dec 4, 2020

@vnkozlov 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:

8257531: Super word not applied to a loop of simple Buffer operations

Reviewed-by: roland, psandoz

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 22 new commits pushed to the master branch:

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Dec 4, 2020
Copy link
Member

@PaulSandoz PaulSandoz left a comment

Java test looks good.

@vnkozlov
Copy link
Contributor Author

@vnkozlov vnkozlov commented Dec 4, 2020

Thank you @PaulSandoz and @rwestrel for reviews.

@vnkozlov
Copy link
Contributor Author

@vnkozlov vnkozlov commented Dec 4, 2020

/integrate

@openjdk openjdk bot closed this Dec 4, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Dec 4, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Dec 4, 2020

@vnkozlov Since your change was applied there have been 22 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

Pushed as commit dd0b945.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@vnkozlov vnkozlov deleted the vnkozlov:JDK-8257531 branch Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants