RE: Improve CRC32C performance on SSE4.2

Devulapalli, Raghuveer <raghuveer.devulapalli@intel.com>

From: "Devulapalli, Raghuveer" <raghuveer.devulapalli@intel.com>
To: John Naylor <johncnaylorls@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>, "Shankaran, Akash" <akash.shankaran@intel.com>
Date: 2025-03-26T19:55:22Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Include _mm512_zextsi128_si512() in AVX-512 configure probes.

  2. Properly fix AVX-512 CRC calculation bug

  3. Workaround code generation bug in clang

  4. Compute CRC32C using AVX-512 instructions where available

  5. Inline CRC computation for small fixed-length input on x86

  6. Be more paranoid in configure's checks for CRC and POPCNT intrinsics.

Hello John, 

v15 LGTM. Couple of minor comments: 
 
> I'm leaning towards a length limit for v15-0001 so that inlined instructions are
> likely to be unrolled. Aside from lack of commit message, I think that one is ready
> for commit soon-ish.

+1 

> I'm feeling pretty good about 0002, but since there is still room for cosmetic
> fiddling, I want to let it sit for a bit longer.

(1) zmm_regs_available() in pg_crc32c_sse42_choose.c is a duplicate of pg_popcount_avx512.c but perhaps that’s fine for now. I will propose a consolidated SIMD runtime check in a follow up patch. 
(2) Might be apt to rename pg_crc32c_sse42*.c to pg_crc32c_x86*.c  since they contain both sse42 and avx512 versions.

> I felt the previous proposals for configure.ac were unnecessarily invasive, and the
> message looked out of place, so I made configure.ac more similar to master, using
> the AVX popcount stuff as a model. 

Looks good to me. 

Raghuveer