On Tue, Feb 25, 2025 at 3:17 AM Devulapalli, Raghuveer
<raghuveer.devulapalli@intel.com> wrote:
>
> > 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
valuablefor two reasons: (1) you get everything done at load time before main and (2) you don’t have to run cpuid check
forevery feature (popcount, crc32c, or anything else you add in the future) multiple times. It keep the cpuid
functionalityin a central place that makes it a modular design.
I agree it would be preferable to make a centralized check work.
> On MSVC, we could have the first SIMD feature call pg_cpucap_initialize() which runs CPUID stores the cpu features.
Anysubsequent call can skip (because it has already been initialized) by using a static variable or some other
approach.Does this make sense?
Correct me if I'm misunderstanding, but this sounds like in every
frontend program we'd need to know what the first call was, which
seems less maintainable than just initializing at the start of every
frontend program.
--
John Naylor
Amazon Web Services