RFR: 8277358: Accelerate CRC32-C [v4]

Scott Gibbons duke at openjdk.java.net
Thu Dec 2 00:34:27 UTC 2021


On Thu, 2 Dec 2021 00:20:52 GMT, Scott Gibbons <duke at openjdk.java.net> wrote:

>> Accelerates CRC32-C by utilizing vpclmulqdq similarly to CRC32.  This change achieves ~4x throughput improvement.
>> 
>> 5986.947899319073 MB/s => 24041.05203089616 MB/s
>> 5840.02689336947 MB/s => 24898.781468710356 MB/s
>> 
>> ********** Original ***********
>> 
>> 
>> scottgi at 96974-ICX32:~/crc/jdk (asgibbons-crc32c)$ java test/hotspot/jtreg/compiler/intrinsics/zip/TestCRC32C.java 20000000
>>  offset = 0
>> msgSize = 512 bytes
>>   iters = 20000000
>> -------------------------------------------------------
>> CRCs: crc = ae10ee5a, crcReference = ae10ee5a
>> CRC32C.update(byte[]) runtime = 1.710387358 seconds
>> CRC32C.update(byte[]) throughput = 5986.947899319073 MB/s
>> CRCs: crc = ae10ee5a, crcReference = ae10ee5a
>> -------------------------------------------------------
>> CRCs: crc = ae10ee5a, crcReference = ae10ee5a
>> CRC32C.update(ByteBuffer) runtime = 1.753416583 seconds
>> CRC32C.update(ByteBuffer) throughput = 5840.02689336947 MB/s
>> CRCs: crc = ae10ee5a, crcReference = ae10ee5a
>> -------------------------------------------------------
>> 
>> 
>> 
>> 
>> *********** With my changes: *************
>> 
>> 
>> 
>> scottgi at 96974-ICX32:~/crc/jdk (asgibbons-crc32c)$ java test/hotspot/jtreg/compiler/intrinsics/zip/TestCRC32C.java 20000000
>>  offset = 0
>> msgSize = 512 bytes
>>   iters = 20000000
>> -------------------------------------------------------
>> CRCs: crc = ae10ee5a, crcReference = ae10ee5a
>> CRC32C.update(byte[]) runtime = 0.425938099 seconds
>> CRC32C.update(byte[]) throughput = 24041.05203089616 MB/s
>> CRCs: crc = ae10ee5a, crcReference = ae10ee5a
>> -------------------------------------------------------
>> CRCs: crc = ae10ee5a, crcReference = ae10ee5a
>> CRC32C.update(ByteBuffer) runtime = 0.411265106 seconds
>> CRC32C.update(ByteBuffer) throughput = 24898.781468710356 MB/s
>> CRCs: crc = ae10ee5a, crcReference = ae10ee5a
>> -------------------------------------------------------
>
> Scott Gibbons has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - MICRO to MILLI as requested.
>  - Fixing benchmark to throughput with default iterations.

Hi, Eric.  Thanks for the suggestions.  I’ve made the changes.

Thanks,
--Scott Gibbons
Software Development Engineer, Runtime Engineering
***@***.***  DEVELOPER SOFTWARE ENGINEERING
Ph: 1-503-456-7756
Cell: 1-469-450-8390
2501 NE Century Blvd
Hillsboro, OR 97124
Intel Corporation | www.intel.com<https://webmail.intel.com/owa/redir.aspx?SURL=WYr7qZDpIv3m1SKFmeHJuzsfCBuGN-jwkBYQUSRR6yrupkscpgzUCGgAdAB0AHAAOgAvAC8AdwB3AHcALgBpAG4AdABlAGwALgBjAG8AbQA.&URL=http%3a%2f%2fwww.intel.com>

From: mlbridge[bot] ***@***.***>
Sent: Wednesday, December 1, 2021 4:02 PM
To: openjdk/jdk ***@***.***>
Cc: Gibbons, Scott ***@***.***>; Mention ***@***.***>
Subject: Re: [openjdk/jdk] 8277358: Accelerate CRC32-C (PR #6595)


Mailing list message from eric.caspole at ***@***.***> on ***@***.***>:

Hi Scott,
Thanks for the JMH. I would like to use Mode.Throughput (i.e. 9368.786
?? 96.956? ops/ms) so the scores are not very tiny numbers, and just use
the default iterations so the runs are about 35 minutes instead of 1h30,
what do you think? The iterations are very stable so the defaults are
fine in my testing.
Regards,
Eric

diff --git a/test/micro/org/openjdk/bench/java/util/TestCRC32C.java
b/test/micro/org/openjdk/bench/java/util/TestCRC32C.java
index 10681e19bbf..0c3b39fc59a 100644
--- a/test/micro/org/openjdk/bench/java/util/TestCRC32C.java
+++ b/test/micro/org/openjdk/bench/java/util/TestCRC32C.java
@@ -27,12 +27,10 @@ import java.util.concurrent.TimeUnit;
?import java.util.zip.CRC32C;
?import org.openjdk.jmh.annotations.*;

- at BenchmarkMode(Mode.AverageTime)
- at OutputTimeUnit(TimeUnit.MICROSECONDS)
+ at BenchmarkMode(Mode.Throughput)
+ at OutputTimeUnit(TimeUnit.MILLISECONDS)
***@***.******@***.***(Scope.Benchmark)>
***@***.***(value = 2)
- at Warmup(iterations = 2, time = 30, timeUnit = TimeUnit.SECONDS)
- at Measurement(iterations = 3, time = 60, timeUnit = TimeUnit.SECONDS)

?public class TestCRC32C {

On 11/30/21 7:13 PM, Scott Gibbons wrote:

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://github.com/openjdk/jdk/pull/6595#issuecomment-984167387>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABTE4HNM2EFQQYNCAY5LMKLUO2ZPVANCNFSM5I7J2YQQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.

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

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


More information about the hotspot-compiler-dev mailing list