Re: Improve CRC32C performance on SSE4.2

John Naylor <johncnaylorls@gmail.com>

From: John Naylor <johncnaylorls@gmail.com>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: "Devulapalli, Raghuveer" <raghuveer.devulapalli@intel.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>, "Shankaran, Akash" <akash.shankaran@intel.com>
Date: 2025-04-02T07:10:40Z
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.

On Tue, Apr 1, 2025 at 11:25 PM Nathan Bossart <nathandbossart@gmail.com> wrote:
>
> On Tue, Apr 01, 2025 at 05:33:02PM +0700, John Naylor wrote:
> > On Thu, Mar 27, 2025 at 2:55 AM Devulapalli, Raghuveer <raghuveer.devulapalli@intel.com> wrote:

> >> (2) Might be apt to rename pg_crc32c_sse42*.c to pg_crc32c_x86*.c  since
> >> they contain both sse42 and avx512 versions.
> >
> > The name is now not quite accurate, but it's not exactly misleading
> > either. I'm leaning towards keeping it the same, so for now I've just
> > updated the header comment.
>
> I'm not too worried about this one either.  FWIW I'm likely going to look
> into moving all the x86_64 popcount stuff into pg_popcount_avx512.c and
> renaming it to pg_popcount_x86_64.c for v19.  This would parallel
> pg_popcount_aarch64.c a bit better, and a file per architecture seems like
> a logical way to neatly organize things.

Seems like a good idea.

> I read through the code a couple of times and nothing stood out to me.

Thanks for looking, I plan to commit this over the weekend unless
there are objections.

-- 
John Naylor
Amazon Web Services