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

8271515: Integration of JEP 417: Vector API (Third Incubator) #5873

Closed
wants to merge 16 commits into from

Conversation

PaulSandoz
Copy link
Member

@PaulSandoz PaulSandoz commented Oct 8, 2021

This PR improves the performance of vector operations that accept masks on architectures that support masking in hardware, specifically Intel AVX512 and ARM SVE.

On architectures that do not support masking in hardware the same technique as before is applied to most operations, specifically composition using blend.

Masked loads/stores are a special form of masked operation that require additional care to ensure out-of-bounds access throw exceptions. The range checking has not been fully optimized and will require further work.

No API enhancements were required and only a few additional tests were needed.


Progress

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

Issue

  • JDK-8271515: Integration of JEP 417: Vector API (Third Incubator)

Reviewers

Contributors

  • Sandhya Viswanathan <sviswanathan@openjdk.org>
  • Jatin Bhateja <jbhateja@openjdk.org>
  • Ningsheng Jian <njian@openjdk.org>
  • Xiaohong Gong <xgong@openjdk.org>
  • Eric Liu <eliu@openjdk.org>
  • Jie Fu <jiefu@openjdk.org>
  • Vladimir Ivanov <vlivanov@openjdk.org>
  • John R Rose <jrose@openjdk.org>
  • Paul Sandoz <psandoz@openjdk.org>
  • Rado Smogura <mail@smogura.eu>

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5873/head:pull/5873
$ git checkout pull/5873

Update a local copy of the PR:
$ git checkout pull/5873
$ git pull https://git.openjdk.java.net/jdk pull/5873/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5873

View PR using the GUI difftool:
$ git pr show -t 5873

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5873.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Oct 8, 2021

👋 Welcome back psandoz! 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
Copy link

@openjdk openjdk bot commented Oct 8, 2021

@PaulSandoz The following labels will be automatically applied to this pull request:

  • core-libs
  • hotspot

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added hotspot core-libs labels Oct 8, 2021
@PaulSandoz
Copy link
Member Author

@PaulSandoz PaulSandoz commented Oct 8, 2021

/contributor add sviswanathan
/contributor add jbhateja
/contributor add njian
/contributor add xgong
/contributor add eliu
/contributor add jiefu
/contributor add vlivanov
/contributor add jrose
/contributor add psandoz

@openjdk
Copy link

@openjdk openjdk bot commented Oct 8, 2021

@PaulSandoz
Contributor Sandhya Viswanathan <sviswanathan@openjdk.org> successfully added.

@openjdk
Copy link

@openjdk openjdk bot commented Oct 8, 2021

@PaulSandoz
Contributor Jatin Bhateja <jbhateja@openjdk.org> successfully added.

@openjdk
Copy link

@openjdk openjdk bot commented Oct 8, 2021

@PaulSandoz
Contributor Ningsheng Jian <njian@openjdk.org> successfully added.

@openjdk
Copy link

@openjdk openjdk bot commented Oct 8, 2021

@PaulSandoz
Contributor Xiaohong Gong <xgong@openjdk.org> successfully added.

@openjdk
Copy link

@openjdk openjdk bot commented Oct 8, 2021

@PaulSandoz
Contributor Eric Liu <eliu@openjdk.org> successfully added.

@openjdk
Copy link

@openjdk openjdk bot commented Oct 8, 2021

@PaulSandoz
Contributor Jie Fu <jiefu@openjdk.org> successfully added.

@openjdk
Copy link

@openjdk openjdk bot commented Oct 8, 2021

@PaulSandoz
Contributor Vladimir Ivanov <vlivanov@openjdk.org> successfully added.

@openjdk
Copy link

@openjdk openjdk bot commented Oct 8, 2021

@PaulSandoz
Contributor John R Rose <jrose@openjdk.org> successfully added.

@openjdk
Copy link

@openjdk openjdk bot commented Oct 8, 2021

@PaulSandoz
Contributor Paul Sandoz <psandoz@openjdk.org> successfully added.

@PaulSandoz
Copy link
Member Author

@PaulSandoz PaulSandoz commented Oct 13, 2021

/contributor add Rado Smogura mail@smogura.eu

@openjdk
Copy link

@openjdk openjdk bot commented Oct 13, 2021

@PaulSandoz
Contributor Rado Smogura <mail@smogura.eu> successfully added.

@PaulSandoz PaulSandoz marked this pull request as ready for review Oct 13, 2021
@openjdk openjdk bot added the rfr label Oct 13, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Oct 13, 2021

@PaulSandoz
Copy link
Member Author

@PaulSandoz PaulSandoz commented Oct 13, 2021

/csr

@openjdk openjdk bot added the csr label Oct 13, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Oct 13, 2021

@PaulSandoz this pull request will not be integrated until the CSR request JDK-8274028 for issue JDK-8271515 has been approved.

Copy link
Contributor

@vnkozlov vnkozlov left a comment

C2 and x86 changes seems fine.

@sviswa7
Copy link

@sviswa7 sviswa7 commented Oct 19, 2021

The Java changes look good to me.

Copy link
Member

@nick-arm nick-arm left a comment

AArch64 changes look ok apart from some minor comments.

}

const int num_of_regs = PRegisterImpl::number_of_saved_registers;
unsigned char regs[num_of_regs];
Copy link
Member

@nick-arm nick-arm Oct 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems clearer to use PRegisterImpl::number_of_saved_registers directly rather than introducing num_of_regs.

return total_push_bytes / 8;
}

// Return the number of dwords poped
Copy link
Member

@nick-arm nick-arm Oct 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

popped

@@ -243,6 +243,10 @@ class PRegisterImpl: public AbstractRegisterImpl {
enum {
number_of_registers = 16,
number_of_governing_registers = 8,
// AArch64 has 8 governing predicate registers, but p7 is used as an
// all-1s register so the predicates to save are from p0 to p6 if we
// don't have non-governing predicate registers support.
Copy link
Member

@nick-arm nick-arm Oct 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is a bit difficult to read. How about:

    // AArch64 has 8 governing predicate registers, but p7 is used as an
    // all-1s register so the predicates to save are from p0 to p6. We
    // don't support non-governing predicate registers.

@@ -39,20 +39,18 @@ inline bool is_PRegister() {
}

inline Register as_Register() {
assert( is_Register(), "must be");
// Yuk
assert(is_Register(), "must be");
Copy link
Member

@nick-arm nick-arm Oct 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to leave this file as it was if you're only making whitespace changes here.

Address AArch64 review comments from Nick.
@openjdk
Copy link

@openjdk openjdk bot commented Oct 20, 2021

⚠️ @PaulSandoz This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@nsjian
Copy link

@nsjian nsjian commented Oct 21, 2021

AArch64 changes look ok apart from some minor comments.

Thank you @nick-arm for the review! All your comments have been addressed.

__ sve_$5(as_FloatRegister($dst$$reg), __ $6, as_FloatRegister($dst$$reg));
BasicType to_bt = Matcher::vector_element_basic_type(this);
Assembler::SIMD_RegVariant to_size = __ elemType_to_regVariant(to_bt);
__ sve_fcvtzs(as_FloatRegister($dst$$reg), __ D, ptrue, as_FloatRegister($src$$reg), __ D);
Copy link

@nsjian nsjian Nov 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting from double to long and then narrow to target types did not follow JLS. I will fix it. Thanks to @fg1417 for helping to find out this issue.

Copy link

@nsjian nsjian Nov 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting from double to long and then narrow to target types did not follow JLS. I will fix it. Thanks to @fg1417 for helping to find out this issue.

Fixed in the new commit. Thanks to @PaulSandoz for integrating the fix!

Hi Nick @nick-arm ,

Could you please help to review the new commit, which fixes the same issue as JDK-8276151 for SVE? Thanks!

nsjian and others added 2 commits Nov 3, 2021
Like JDK-8276151, SVE vector double to int and float to long
conversions have similar issue. According to Java language
specification [1], we should convert double/float to
integer/long directly, instead of converting to long/int and then
narrowing/extending to target types. Test cases will be updated in
JDK-8276151.

[1] https://docs.oracle.com/javase/specs/jls/se17/html/jls-5.html#jls-5.1.3
AArch64: Incorrect SVE double to int and float to long vector conversion
@openjdk openjdk bot removed the csr label Nov 11, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 11, 2021

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

8271515: Integration of JEP 417: Vector API (Third Incubator)

Co-authored-by: Sandhya Viswanathan <sviswanathan@openjdk.org>
Co-authored-by: Jatin Bhateja <jbhateja@openjdk.org>
Co-authored-by: Ningsheng Jian <njian@openjdk.org>
Co-authored-by: Xiaohong Gong <xgong@openjdk.org>
Co-authored-by: Eric Liu <eliu@openjdk.org>
Co-authored-by: Jie Fu <jiefu@openjdk.org>
Co-authored-by: Vladimir Ivanov <vlivanov@openjdk.org>
Co-authored-by: John R Rose <jrose@openjdk.org>
Co-authored-by: Paul Sandoz <psandoz@openjdk.org>
Co-authored-by: Rado Smogura <mail@smogura.eu>
Reviewed-by: kvn, sviswanathan, ngasson

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

  • 0ca0acf: 8276947: Clarify how DateTimeFormatterBuilder.appendFraction handles value ranges
  • b0d7a9d: 8276994: java/nio/channels/Channels/TransferTo.java leaves multi-GB files in /tmp
  • 8aae88b: 8276763: java/nio/channels/SocketChannel/AdaptorStreams.java fails with "SocketTimeoutException: Read timed out"

Please see this link for an up-to-date comparison between the source branch of this pull request and 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 Nov 11, 2021
@PaulSandoz
Copy link
Member Author

@PaulSandoz PaulSandoz commented Nov 15, 2021

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Nov 15, 2021

Going to push as commit a59c9b2.
Since your change was applied there have been 32 commits pushed to the master branch:

  • 9326eb1: 8276095: ciReplay: replay failure due to incomplete ciMethodData information
  • 7a87041: 8275385: Change nested classes in jdk.jdi to static nested classes
  • db0c8d5: 8274232: Cleanup unnecessary null comparison before instanceof check in jdk.jdi
  • 1830b8d: 8275056: Virtualize G1CardSet containers over heap region
  • fe45835: 8274856: Failing jpackage tests with fastdebug/release build
  • 9046077: 8276084: Linux DEB Bundler: release number in outputted .deb file should be optional
  • 7fc344d: 8277028: Use service type documentation as fallback for @provides
  • 35a831d: 8272170: Missing memory barrier when checking active state for regions
  • 02f7900: 8276932: G1: Annotate methods with override explicitly in g1CollectedHeap.hpp
  • fdcd16a: 8277048: Tiny improvements to the specification text for java.util.Properties.load
  • ... and 22 more: https://git.openjdk.java.net/jdk/compare/6f35eede4576b6252544f553c3651312b024e7ea...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Nov 15, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Nov 15, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 15, 2021

@PaulSandoz Pushed as commit a59c9b2.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs hotspot integrated
5 participants