-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8313372: [JVMCI] Export vmIntrinsics::is_intrinsic_available results to JVMCI compilers. #15133
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 yzheng! A progress list of the required criteria for merging this PR into |
|
@mur47x111 The following labels 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 lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
| break; | ||
| case vmIntrinsics::_electronicCodeBook_encryptAESCrypt: | ||
| case vmIntrinsics::_electronicCodeBook_decryptAESCrypt: | ||
| case vmIntrinsics::_galoisCounterMode_AESCrypt: |
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.
Stubs for these intrinsics are generated with the following CPU features.
See
jdk/src/hotspot/cpu/x86/stubGenerator_x86_64_aes.cpp
Lines 159 to 166 in 53ca75b
| if (VM_Version::supports_avx512_vaes() && VM_Version::supports_avx512vl() && VM_Version::supports_avx512dq() ) { | |
| StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_decryptVectorAESCrypt(); | |
| StubRoutines::_electronicCodeBook_encryptAESCrypt = generate_electronicCodeBook_encryptAESCrypt(); | |
| StubRoutines::_electronicCodeBook_decryptAESCrypt = generate_electronicCodeBook_decryptAESCrypt(); | |
| StubRoutines::_galoisCounterMode_AESCrypt = generate_galoisCounterMode_AESCrypt(); | |
| } else { | |
| StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_decryptAESCrypt_Parallel(); | |
| } |
| } | ||
| break; | ||
| case vmIntrinsics::_bigIntegerRightShiftWorker: | ||
| case vmIntrinsics::_bigIntegerLeftShiftWorker: |
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.
See
jdk/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp
Lines 4169 to 4172 in 53ca75b
| if (VM_Version::supports_avx512_vbmi2()) { | |
| StubRoutines::_bigIntegerRightShiftWorker = generate_bigIntegerRightShift(); | |
| StubRoutines::_bigIntegerLeftShiftWorker = generate_bigIntegerLeftShift(); | |
| } |
| } | ||
| break; | ||
| case vmIntrinsics::_dcopySign: | ||
| case vmIntrinsics::_fcopySign: |
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.
See
jdk/src/hotspot/cpu/x86/x86.ad
Lines 1601 to 1609 in 53ca75b
| case Op_CopySignD: | |
| case Op_CopySignF: | |
| if (UseAVX < 3 || !is_LP64) { | |
| return false; | |
| } | |
| if (!VM_Version::supports_avx512vl()) { | |
| return false; | |
| } | |
| break; |
| case vmIntrinsics::_maxF_strict: | ||
| case vmIntrinsics::_minF_strict: | ||
| case vmIntrinsics::_maxD_strict: | ||
| case vmIntrinsics::_minD_strict: |
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.
See
jdk/src/hotspot/cpu/x86/x86.ad
Lines 1534 to 1543 in 53ca75b
| #ifdef _LP64 | |
| case Op_MaxD: | |
| case Op_MaxF: | |
| case Op_MinD: | |
| case Op_MinF: | |
| if (UseAVX < 1) { // enabled for AVX only | |
| return false; | |
| } | |
| break; | |
| #endif |
| break; | ||
| case vmIntrinsics::_electronicCodeBook_decryptAESCrypt: | ||
| if (StubRoutines::electronicCodeBook_decryptAESCrypt() == nullptr) return false; | ||
| break; |
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.
These two intrinsics were marked as supported on non-x86 platforms where the underlying stubs are not generated
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.
good catch
| static bool supports_avx256only() { return (supports_avx2() && !supports_evex()); } | ||
| static bool supports_avxonly() { return ((supports_avx2() || supports_avx()) && !supports_evex()); } | ||
| static bool supports_sha() { return (_features & CPU_SHA) != 0; } | ||
| static bool supports_fma() { return (_features & CPU_FMA) != 0 && supports_avx(); } |
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.
jdk/src/hotspot/cpu/x86/vm_version_x86.cpp
Lines 1154 to 1158 in 53ca75b
| if (supports_fma() && UseSSE >= 2) { // Check UseSSE since FMA code uses SSE instructions | |
| if (FLAG_IS_DEFAULT(UseFMA)) { | |
| UseFMA = true; | |
| } | |
| } else if (UseFMA) { |
implies fma intrinsic can be used without AVX
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.
https://bugs.openjdk.org/browse/JDK-8181616 added support_avx() check because new Fma vectorization needs AVX: https://cr.openjdk.org/~vdeshpande/8181616/webrev.01/
Then we hit bug https://bugs.openjdk.org/browse/JDK-8182114 and bandaid it by restoring UseSSE check.
That change came before 8296168 which switch off UseAVX if UseSSE < 4:
https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/vm_version_x86.cpp#L908
This FMA check happens after UseSSE and UseAVX are set. I suggest to remove UseSSE check here instead and keep support_avx().
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.
Saying that. You may remove support_avx() here but you need to add it to assembler vector instructions which have only support_fma() check now.
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 references! I have reverted this change and will adjust the Graal intrinsic accordingly.
|
/label remove hotspot |
|
/label add hotspot-compiler |
|
@mur47x111 |
|
@mur47x111 |
dougxc
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.
The JVMCI changes look good to me but someone else still needs to review the C1, C2 and shared assembler changes.
|
@mur47x111 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 109 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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@dougxc, @vnkozlov) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
|
I don't having the same logic in two places, because then those two places need to be kept in sync. Either the stubs should be generated based on is_intrinsic_supported(), or is_intrinsic_supported() should check if the stub was generated. |
I have dropped the redundant CPU feature checks, and for those intrinsics with stubs, I tested if the stub pointer is nullptr in |
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.
Good.
|
@mur47x111 please, rerun testing with latest version before integration. |
|
Passed tier1-3 |
|
/integrate |
|
@mur47x111 |
|
/sponsor |
|
Going to push as commit 4164693.
Your commit was automatically rebased without conflicts. |
|
@dougxc @mur47x111 Pushed as commit 4164693. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This PR exports
vmIntrinsic::is_intrinsic_available,Compiler::is_intrinsic_supported, andC2Compiler::is_intrinsic_supportedresults to JVMCI compiler. This allows JVMCI compiler to comply with-XX:DisableIntrinsic,-XX:ControlIntrinsic,-XX:-UseXXXIntrinsic, and is essential for running test that depends on these flags, e.g.,java/lang/Float/Binary16ConversionNaNthat returns different result in the interpreter with-XX:DisableIntrinsic=_float16ToFloat,_floatToFloat16.This PR also attempts to fix some of the
is_intrinsic_availableresults. Please see the inlined comments.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15133/head:pull/15133$ git checkout pull/15133Update a local copy of the PR:
$ git checkout pull/15133$ git pull https://git.openjdk.org/jdk.git pull/15133/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 15133View PR using the GUI difftool:
$ git pr show -t 15133Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15133.diff
Webrev
Link to Webrev Comment