Skip to content

crc: add AVX+PCLMUL for crc32_iscsi on Hygon CPU#406

Closed
MaodiMa wants to merge 1 commit into
intel:masterfrom
MaodiMa:crc32c_hygon_avx_pclmul
Closed

crc: add AVX+PCLMUL for crc32_iscsi on Hygon CPU#406
MaodiMa wants to merge 1 commit into
intel:masterfrom
MaodiMa:crc32c_hygon_avx_pclmul

Conversation

@MaodiMa
Copy link
Copy Markdown
Contributor

@MaodiMa MaodiMa commented Apr 28, 2026

On Hygon CPUs, AVX+PCLMUL implementation shows better performance than CRC32. Select it based on CPUID vendor check.

crc32_iscsi_by8_02.asm is adapted from v2.32.0 and updated to match the current code style.
Performance improvement on Hygon 7490:

  • 7921.14 MB/s -> 24033.88 MB/s

This commit does no affet on other platforms, such as Intel or AMD.

Comment thread crc/crc_multibinary.asm


mbin_interface crc32_iscsi
mbin_dispatch_init_clmul crc32_iscsi, crc32_iscsi_base, crc32_iscsi_01, crc32_iscsi_01, crc32_iscsi_avx2, crc32_iscsi_by16_10
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to do this. It's OK for Intel processors to use crc32_iscsi_by8_02 for systems without AVX2+VPCLMUL ISA. So you can just restore the by8_02 implementation and plug it in mbin_dispatch_init_clmul

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I just did some tests. It seems that AVX+PCLMUL also works well on Intel CPUs.
I added this because we do perf test when AVX+PCLMUL implementation first added into ISA-L in commit 0ed6660. And we found CRC32 works better than AVX+PCLMUL on Intel CPUs. This gap seems to be covered by later added prefetch in AVX+PCLMUL now.

@MaodiMa MaodiMa force-pushed the crc32c_hygon_avx_pclmul branch from 8cf7758 to 4545baa Compare April 29, 2026 07:15
@pablodelara
Copy link
Copy Markdown
Contributor

Thanks for the PR. You need to also add the file in Makefile.nmake and cmake/crc.make. Thanks!

Signed-off-by: Maodi Ma <mamaodi@hygon.cn>
@MaodiMa MaodiMa force-pushed the crc32c_hygon_avx_pclmul branch from 4545baa to e99a150 Compare April 29, 2026 07:42
@pablodelara
Copy link
Copy Markdown
Contributor

This is now merged, thanks!

@pablodelara pablodelara closed this May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants