RFR: 8277358: Accelerate CRC32-C [v2]

Scott Gibbons duke at openjdk.java.net
Wed Dec 1 02:42:29 UTC 2021


On Wed, 1 Dec 2021 00:02:14 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 one additional commit since the last revision:
> 
>   Adding CRC32-C microbenchmark.

Doesn’t this just move the double nots to a different generator?  I’m not comfortable with the cost/benefit of this change.  I don’t want to impact CRC32 for the sake of CRC32C.  I’ll do it if you think it’s worth it.  Please let me know.

From: sviswa7 ***@***.***>
Sent: Tuesday, November 30, 2021 6:04 PM
To: openjdk/jdk ***@***.***>
Cc: Gibbons, Scott ***@***.***>; Mention ***@***.***>
Subject: Re: [openjdk/jdk] 8277358: Accelerate CRC32-C (PR #6595)


@sviswa7 commented on this pull request.

________________________________

In src/hotspot/cpu/x86/macroAssembler_x86.cpp<https://github.com/openjdk/jdk/pull/6595#discussion_r759798215>:

> @@ -7210,7 +7215,6 @@ void MacroAssembler::kernel_crc32_avx512(Register crc, Register buf, Register le

   // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge

   // context for the registers used, where all instructions below are using 128-bit mode

   // On EVEX without VL and BW, these instructions will all be AVX.

-  lea(key, ExternalAddress(StubRoutines::x86::crc_table_avx512_addr()));

   notl(crc);

We could do this not1(crc) in generate_updateBytesCRC32() thereby remove the need to do the double notl for crc32c.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://github.com/openjdk/jdk/pull/6595#pullrequestreview-819734780>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABTE4HJNO5UZI3QOJEXVQEDUOV67ZANCNFSM5I7J2YQQ>.
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