RFR: 8322179: RISC-V: Implement SHA-1 intrinsic [v14]
Hamlin Li
mli at openjdk.org
Mon Feb 26 10:32:10 UTC 2024
> 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`
>
> JMH_PARAMS="-f 1 -wi 10 -i 20" // for every loop of jmh test
>
> benchmark tests `MessageDigests.java GetMessageDigest.java MessageDigestBench.java MacBench.java` which are under `test/micro/org/openjdk/bench/`, more spcifically `TESTS="MessageDigests.digest MessageDigests.getAndDigest MessageDigestBench.digest"`
>
>
> // After
> o.o.b.java.security.MessageDigests.digest N/A N/A SHA-1 64 DEFAULT avgt 20 1845.446 ? 27.052 ns/op
> o.o.b.java.security.MessageDigests.digest N/A N/A SHA-1 16384 DEFAULT avgt 20 181455.350 ? 532.258 ns/op
> o.o.b.java.security.MessageDigests.getAndDigest N/A N/A SHA-1 64 DEFAULT avgt 20 2447.674 ? 10.239 ns/op
> o.o.b.java.security.MessageDigests.getAndDigest N/A N/A SHA-1 16384 DEFAULT avgt 20 182896.083 ? 1242.774 ns/op
> o.o.b.javax.crypto.small.MessageDigestBench.digest SHA1 1048576 N/A N/A avgt 20 11599227.792 ? 121442.390 ns/op
> // Before
> o.o.b.java.security.MessageDigests.digest N/A N/A SHA-1 64 DEFAULT avgt 20 2352.475 ? 11.198 ns/op
> o.o.b.java.security.MessageDigests.digest N/A N/A SHA-1 16384 DEFAULT avgt 20 188495.684 ? 1467.942 ns/op
> o.o.b.java.security.MessageDigests.getAndDigest N/A N/A SHA-1 64 DEFAULT avgt 20 2437.347 ? 6.398 ns/op
> o.o.b.java.security.MessageDigests.getAndDigest N/A N/A SHA-1 16384 DEFAULT avgt 20 196086.570 ? 1140.998 ns/op
> o.o.b.javax.crypto.small.MessageDigestBench.digest SHA1 1048576 N/A N/A avgt 20 12362160.119 ? 38788.109 ns/op
>
>
> **getAndDigest when size == 64**
> The data is not stable for test getAndDigest when size == 64, which I think is introduced by j.s.MessageDigest.getInstance itself, which we don't touch in this patch.
> Check more details at [1](https://github.com/openjdk/jdk/pull/17130#issuecomment-1886805614)
>
>
> loop ... ...
Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:
refine code
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/17130/files
- new: https://git.openjdk.org/jdk/pull/17130/files/3bba2b8d..7278076f
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=17130&range=13
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=17130&range=12-13
Stats: 27 lines in 1 file changed: 8 ins; 11 del; 8 mod
Patch: https://git.openjdk.org/jdk/pull/17130.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/17130/head:pull/17130
PR: https://git.openjdk.org/jdk/pull/17130
More information about the hotspot-dev
mailing list