> 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


Reply via email to