RFR: 8322179: RISC-V: Implement SHA-1 intrinsic [v3]
Fei Yang
fyang at openjdk.org
Wed Jan 10 03:05:27 UTC 2024
On Tue, 19 Dec 2023 17:54:51 GMT, Hamlin Li <mli at openjdk.org> wrote:
>> Hi,
>> Can you review this patch to implement SHA-1 intrinsic for riscv?
>> Thanks!
>>
>>
>> ## Test
>>
>> ### Functionality
>>
>> tests under `test/hotspot/jtreg/compiler/intrinsics/sha`
>> tests found via `find test/jdk -iname "*SHA1*.java"`
>>
>> ### Performance
>>
>> tested on `T-HEAD Light Lichee Pi 4A`
>>
>> benchmark tests `MessageDigests.java GetMessageDigest.java MessageDigestBench.java MacBench.java` which are under `test/micro/org/openjdk/bench/`.
>>
>>
>> **perf data summary**
>>
>> tests intrinsic (ns/op) base (ns/op) speed up (times)
>> o.o.b.java.security.MessageDigests.digest (64) 3454.207 12026.787 3.48
>> o.o.b.java.security.MessageDigests.digest (16384) 184063.834 1307913.534 7.11
>> o.o.b.java.security.MessageDigests.getAndDigest (64) 8260.011 17707.156 2.14
>> o.o.b.java.security.MessageDigests.getAndDigest (16384) 191325.246 1379660.864 7.21
>> o.o.b.javax.crypto.full.MacBench.mac (128) 8220.886 34101.577 4.15
>> o.o.b.javax.crypto.full.MacBench.mac (1024) 18006.955 107906.128 5.99
>> o.o.b.javax.crypto.small.MessageDigestBench.digest 11688843.558 82834313.280 7.09
>>
>>
>>
>> **raw perf data - when intrinsic is enabled**
>>
>> o.o.b.java.security.GetMessageDigest.cloneInstance N/A N/A SHA-1 N/A N/A avgt 10 489.860 ? 6.277 ns/op
>> o.o.b.java.security.GetMessageDigest.getInstance N/A N/A SHA-1 N/A N/A avgt 10 3477.197 ? 204.203 ns/op
>> o.o.b.java.security.GetMessageDigest.getInstanceWithProvider N/A N/A SHA-1 N/A N/A avgt 10 4111.164 ? 108.861 ns/op
>> o.o.b.java.security.MessageDigests.digest N/A N/A SHA-1 64 DEFAULT avgt 10 3454.207 ? 53.924 ns/op
>> o.o.b.java.security.MessageDigests.digest N/A N/A SHA-1 16384 DEFAULT avgt 10 184063.834 ? 677.635 ns/op
>> o.o.b.java.security.MessageDigests.getAndDigest N/A N/A SHA-1 64 DEFAULT avgt 10 8260.011 ? ...
>
> Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:
>
> round 1 review
Simply ran `micro:java.security.MessageDigests` JMH on my Lichee-pi-4a board, seems there is a small regression for the `MessageDigests.getAndDigest` (length = 64) case:
Before:
MessageDigests.digest SHA-1 64 DEFAULT thrpt 15 417.311 ? 2.686 ops/ms
MessageDigests.digest SHA-1 16384 DEFAULT thrpt 15 5.206 ? 0.008 ops/ms
MessageDigests.getAndDigest SHA-1 64 DEFAULT thrpt 15 404.769 ? 14.810 ops/ms
MessageDigests.getAndDigest SHA-1 16384 DEFAULT thrpt 15 5.106 ? 0.046 ops/ms
After:
MessageDigests.digest SHA-1 64 DEFAULT thrpt 15 518.057 ? 5.935 ops/ms
MessageDigests.digest SHA-1 16384 DEFAULT thrpt 15 5.569 ? 0.009 ops/ms
MessageDigests.getAndDigest SHA-1 64 DEFAULT thrpt 15 378.184 ? 37.425 ops/ms
MessageDigests.getAndDigest SHA-1 16384 DEFAULT thrpt 15 5.515 ? 0.017 ops/ms
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17130#issuecomment-1884116242
More information about the hotspot-dev
mailing list