On Wed, 5 Oct 2022 21:28:26 GMT, vpaprotsk <d...@openjdk.org> wrote:

> Handcrafted x86_64 asm for Poly1305. Main optimization is to process 16 
> message blocks at a time. For more details, left a lot of comments in 
> `macroAssembler_x86_poly.cpp`.
> 
> - Added new KAT test for Poly1305 and a fuzz test to compare intrinsic and 
> java.
>   - Would like to add an `InvalidKeyException` in `Poly1305.java` (see 
> commented out block in that file), but that conflicts with the KAT. I do 
> think we should detect (R==0 || S ==0) so would like advice please.
> - Added a JMH perf test.
>    - JMH test had to use reflection (instead of existing `MacBench.java`), 
> since Poly1305 is not 'properly' registered with the provider.
> 
> Perf before:
> 
> Benchmark                   (dataSize)  (provider)   Mode  Cnt        Score   
>      Error  Units
> Poly1305DigestBench.digest          64              thrpt    8  2961300.661 ± 
> 110554.162  ops/s
> Poly1305DigestBench.digest         256              thrpt    8  1791912.962 ± 
>  86696.037  ops/s
> Poly1305DigestBench.digest        1024              thrpt    8   637413.054 ± 
>  14074.655  ops/s
> Poly1305DigestBench.digest       16384              thrpt    8    48762.991 ± 
>    390.921  ops/s
> Poly1305DigestBench.digest     1048576              thrpt    8      769.872 ± 
>      1.402  ops/s
> 
> and after:
> 
> Benchmark                   (dataSize)  (provider)   Mode  Cnt        Score   
>      Error  Units
> Poly1305DigestBench.digest          64              thrpt    8  2841243.668 ± 
> 154528.057  ops/s
> Poly1305DigestBench.digest         256              thrpt    8  1662003.873 ± 
>  95253.445  ops/s
> Poly1305DigestBench.digest        1024              thrpt    8  1770028.718 ± 
> 100847.766  ops/s
> Poly1305DigestBench.digest       16384              thrpt    8   765547.287 ± 
>  25883.825  ops/s
> Poly1305DigestBench.digest     1048576              thrpt    8    14508.458 ± 
>     56.147  ops/s

I executed some quick testing and this fails with:


[2022-10-21T09:54:28,696Z] # A fatal error has been detected by the Java 
Runtime Environment:
[2022-10-21T09:54:28,696Z] #
[2022-10-21T09:54:28,696Z] #  Internal Error 
(/opt/mach5/mesos/work_dir/slaves/0c72054a-24ab-4dbb-944f-97f9341a1b96-S8380/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/5903b026-cdbd-4aa4-8433-6a45fb7ee593/runs/f75b29aa-40ef-46a5-b323-3a80aaa9aa6b/workspace/open/src/hotspot/cpu/x86/assembler_x86.cpp:5358),
 pid=2385300, tid=2385302
[2022-10-21T09:54:28,696Z] #  Error: assert(vector_len == AVX_128bit ? 
VM_Version::supports_avx() : vector_len == AVX_256bit ? 
VM_Version::supports_avx2() : vector_len == AVX_512bit ? 
VM_Version::supports_avx512bw() : 0) failed
[2022-10-21T09:54:28,696Z] #
[2022-10-21T09:54:28,696Z] # JRE version:  (20.0) (fastdebug build )
[2022-10-21T09:54:28,696Z] # Java VM: Java HotSpot(TM) 64-Bit Server VM 
(fastdebug 20-internal-2022-10-21-0733397.tobias.hartmann.jdk2, mixed mode, 
sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
[2022-10-21T09:54:28,696Z] # Problematic frame:
[2022-10-21T09:54:28,696Z] # V  [libjvm.so+0x6e3bf0]  
Assembler::vpslldq(XMMRegister, XMMRegister, int, int)+0x190

-------------

PR: https://git.openjdk.org/jdk/pull/10582

Reply via email to