RE: Improve CRC32C performance on SSE4.2

From: "Devulapalli, Raghuveer" <raghuveer(dot)devulapalli(at)intel(dot)com>
To: John Naylor <johncnaylorls(at)gmail(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Shankaran, Akash" <akash(dot)shankaran(at)intel(dot)com>
Subject: RE: Improve CRC32C performance on SSE4.2
Date: 2025-02-24 20:16:28
Message-ID: PH8PR11MB828602D3AE9A19531E42A2DBFBC02@PH8PR11MB8286.namprd11.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Here's another idea to make it more automatic: Give up on initializing every
> capability at once.

I'm not sure I like giving up this. Initializing and running CPUID check with the attribute constructor is very valuable for two reasons: (1) you get everything done at load time before main and (2) you don’t have to run cpuid check for every feature (popcount, crc32c, or anything else you add in the future) multiple times. It keep the cpuid functionality in a central place that makes it a modular design.

On MSVC, we could have the first SIMD feature call pg_cpucap_initialize() which runs CPUID stores the cpu features. Any subsequent call can skip (because it has already been initialized) by using a static variable or some other approach. Does this make sense?

Raghuveer

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2025-02-24 20:20:41 Re: Statistics Import and Export
Previous Message Tom Lane 2025-02-24 20:15:59 Re: pgbench client-side performance issue on large scripts