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
8267125: AES Galois CounterMode (GCM) interleaved implementation using AVX512 + VAES instructions #4019
Conversation
…using AVX512 + VAES instructions
👋 Welcome back svkamath! A progress list of the required criteria for merging this PR into |
@smita-kamath this pull request can not be integrated into git checkout aes-gcm
git fetch https://git.openjdk.java.net/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
@smita-kamath |
@smita-kamath |
@smita-kamath 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
|
Added hotspot-compiler label |
@neliasso Unknown command |
/label add hotspot-compiler |
@neliasso |
With JDK-8255557 integrated, I'll provide you a merged copy of your java side changes. |
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.
Do you plan to implement decrypt
intrinsic too?
@@ -543,6 +543,9 @@ bool LibraryCallKit::try_to_inline(int predicate) { | |||
case vmIntrinsics::_counterMode_AESCrypt: | |||
return inline_counterMode_AESCrypt(intrinsic_id()); | |||
|
|||
case vmIntrinsics::_galoisCounterMode_AESCrypt: | |||
return inline_galoisCounterMode_AESCrypt(intrinsic_id()); |
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.
You don't need to pass intrinsic_id()
for this implementation unless you plan to add decrypt intrinsic later.
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 your comments Vladimir. The intrinsic is called for encrypt as well as decrypt operation.
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.
Only one intrinsic is declared in this change: _galoisCounterMode_AESCrypt
. Other AES intrinsics have 2 that is why they have to pass intrinsic_id(). See lines before this.
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.
Note, _counterMode_AESCrypt is not example - it has the same issue.
top_ct != NULL && top_ct->klass() != NULL && | ||
top_out != NULL && top_out->klass() != NULL, "args are strange"); | ||
|
||
// checks are the responsibility of the caller |
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.
Do you have all NULL for all objects and range checks in Java code for this intrinsic?
Node* counter = load_field_from_object(gctr_object, "counter", "[B"); | ||
Node* subkeyHtbl = load_field_from_object(ghash_object, "subkeyHtbl", "[J"); | ||
Node* state = load_field_from_object(ghash_object, "state", "[J"); | ||
if (embeddedCipherObj == NULL || counter == NULL || subkeyHtbl == NULL || state == NULL) return false; |
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.
Follow coding style for such long condition:
if () {
return false;
}
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.
I will make the change. Thanks.
@smita-kamath 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 add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
Looks like you have some issues: wrong file property. |
StubRoutines::x86::_counter_mask_addr = counter_mask_addr(); | ||
StubRoutines::x86::_ghash_poly512_addr = ghash_polynomial512_addr(); | ||
StubRoutines::x86::_ghash_long_swap_mask_addr = generate_ghash_long_swap_mask(); |
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.
_counter_mask_addr = counter_mask_addr()
and _ghash_long_swap_mask_addr = generate_ghash_long_swap_mask()
are called by other intrinsics too. Which duplicates code in codeCache.
They should be called only once when they are used. May be counter_mask_addr()
and generate_ghash_long_swap_mask()
method should check that addresses already recorded and return it.
For the record, I withdraw my request to put this on hold until Lazy stub generation is complete. Second, when final changes are ready before push, please, ask Oracle engineer to run tier1-3 in our testing infrastructure. |
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.
I will test it.
/contributor add ascarpino |
@smita-kamath Could not parse
|
Tier 1-3 passed on linux-x64, windows-x64, macosx-x64, linux-aarch64 |
/contributor add Anthony Scarpino ascarpino@openjdk.org |
1 similar comment
/contributor add Anthony Scarpino ascarpino@openjdk.org |
@smita-kamath Could not parse
|
@smita-kamath Could not parse
|
/contributor add ascarpino |
@smita-kamath |
Yes, my testing during weekend passed too. |
/integrate |
@smita-kamath |
@ascarpino Looks like AES-GCM is ready to be integrated. Can you sponsor this patch? Thank you. |
/sponsor |
Checking to see if the bot is awake (it should reject my attempt). /sponsor |
Going to push as commit 0e7288f.
Your commit was automatically rebased without conflicts. |
@ascarpino @smita-kamath Pushed as commit 0e7288f. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
@kevinrushforth The command |
I would like to submit AES-GCM optimization for x86_64 architectures supporting AVX3+VAES (Evex encoded AES). This optimization interleaves AES and GHASH operations.
Performance gain of ~1.5x - 2x for message sizes 8k and above.
/contributor add svkamath
/contributor add Tomasz Kantecki tomasz.kantecki@intel.com
Progress
Issue
Reviewers
Contributors
<svkamath@openjdk.org>
<tomasz.kantecki@intel.com>
<ascarpino@openjdk.org>
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4019/head:pull/4019
$ git checkout pull/4019
Update a local copy of the PR:
$ git checkout pull/4019
$ git pull https://git.openjdk.java.net/jdk pull/4019/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 4019
View PR using the GUI difftool:
$ git pr show -t 4019
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4019.diff