Re: RFR: 8267125: AES Galois CounterMode (GCM) interleaved implementation using AVX512 + VAES instructions [v2]

2021-06-11 Thread Vladimir Kozlov
On Fri, 11 Jun 2021 17:54:02 GMT, Vladimir Kozlov  wrote:

>> Thanks for your comments Vladimir. The intrinsic is called for encrypt as 
>> well as decrypt operation.
>
> 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.

Note, _counterMode_AESCrypt is not example - it has the same issue.

-

PR: https://git.openjdk.java.net/jdk/pull/4019


Re: RFR: 8267125: AES Galois CounterMode (GCM) interleaved implementation using AVX512 + VAES instructions [v2]

2021-06-11 Thread Vladimir Kozlov
On Fri, 11 Jun 2021 17:19:37 GMT, Smita Kamath  wrote:

>> src/hotspot/share/opto/library_call.cpp line 547:
>> 
>>> 545: 
>>> 546:   case vmIntrinsics::_galoisCounterMode_AESCrypt:
>>> 547: return inline_galoisCounterMode_AESCrypt(intrinsic_id());
>> 
>> You don't need to pass `intrinsic_id()` for this implementation unless you 
>> plan to add decrypt intrinsic later.
>
> Thanks for your comments Vladimir. The intrinsic is called for encrypt as 
> well as decrypt operation.

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.

-

PR: https://git.openjdk.java.net/jdk/pull/4019


Re: RFR: 8267125: AES Galois CounterMode (GCM) interleaved implementation using AVX512 + VAES instructions [v2]

2021-06-11 Thread Smita Kamath
On Fri, 11 Jun 2021 15:45:02 GMT, Vladimir Kozlov  wrote:

>> Smita Kamath has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   8267125:Updated intrinsic signature to remove copies of counter, state and 
>> subkeyHtbl
>
> src/hotspot/share/opto/library_call.cpp line 547:
> 
>> 545: 
>> 546:   case vmIntrinsics::_galoisCounterMode_AESCrypt:
>> 547: return inline_galoisCounterMode_AESCrypt(intrinsic_id());
> 
> You don't need to pass `intrinsic_id()` for this implementation unless you 
> plan to add decrypt intrinsic later.

Thanks for your comments Vladimir. The intrinsic is called for encrypt as well 
as decrypt operation.

> src/hotspot/share/opto/library_call.cpp line 6564:
> 
>> 6562:   Node* subkeyHtbl = load_field_from_object(ghash_object, 
>> "subkeyHtbl", "[J");
>> 6563:   Node* state = load_field_from_object(ghash_object, "state", "[J");
>> 6564:   if (embeddedCipherObj == NULL || counter == NULL || subkeyHtbl == 
>> NULL || state == NULL) return false;
> 
> Follow coding style for such long condition:
> 
> if () {
>   return false;
> }

I will make the change. Thanks.

-

PR: https://git.openjdk.java.net/jdk/pull/4019


Re: RFR: 8267125: AES Galois CounterMode (GCM) interleaved implementation using AVX512 + VAES instructions [v2]

2021-06-11 Thread Vladimir Kozlov
On Fri, 4 Jun 2021 23:49:31 GMT, Smita Kamath  wrote:

>> 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.
>
> Smita Kamath has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8267125:Updated intrinsic signature to remove copies of counter, state and 
> subkeyHtbl

Do you plan to implement `decrypt` intrinsic too?

src/hotspot/share/opto/library_call.cpp line 547:

> 545: 
> 546:   case vmIntrinsics::_galoisCounterMode_AESCrypt:
> 547: return inline_galoisCounterMode_AESCrypt(intrinsic_id());

You don't need to pass `intrinsic_id()` for this implementation unless you plan 
to add decrypt intrinsic later.

src/hotspot/share/opto/library_call.cpp line 6545:

> 6543:  top_out != NULL && top_out->klass() != NULL, "args are 
> strange");
> 6544: 
> 6545:   // checks are the responsibility of the caller

Do you have all NULL for all objects and range checks in Java code for this 
intrinsic?

src/hotspot/share/opto/library_call.cpp line 6564:

> 6562:   Node* subkeyHtbl = load_field_from_object(ghash_object, "subkeyHtbl", 
> "[J");
> 6563:   Node* state = load_field_from_object(ghash_object, "state", "[J");
> 6564:   if (embeddedCipherObj == NULL || counter == NULL || subkeyHtbl == 
> NULL || state == NULL) return false;

Follow coding style for such long condition:

if () {
  return false;
}

-

PR: https://git.openjdk.java.net/jdk/pull/4019


Re: RFR: 8267125: AES Galois CounterMode (GCM) interleaved implementation using AVX512 + VAES instructions [v2]

2021-06-09 Thread Anthony Scarpino
On Fri, 4 Jun 2021 23:49:31 GMT, Smita Kamath  wrote:

>> 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.
>
> Smita Kamath has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8267125:Updated intrinsic signature to remove copies of counter, state and 
> subkeyHtbl

With JDK-827 integrated, I'll provide you a merged copy of your java side 
changes.

-

PR: https://git.openjdk.java.net/jdk/pull/4019


Re: RFR: 8267125: AES Galois CounterMode (GCM) interleaved implementation using AVX512 + VAES instructions [v2]

2021-06-04 Thread Smita Kamath
> 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.

Smita Kamath has updated the pull request incrementally with one additional 
commit since the last revision:

  8267125:Updated intrinsic signature to remove copies of counter, state and 
subkeyHtbl

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/4019/files
  - new: https://git.openjdk.java.net/jdk/pull/4019/files/433176d1..2ac209e3

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=4019&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=4019&range=00-01

  Stats: 58 lines in 10 files changed: 3 ins; 28 del; 27 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4019.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4019/head:pull/4019

PR: https://git.openjdk.java.net/jdk/pull/4019