An update... I discovered that the CPUID instruction, despite its name, is the
exactly wrong way to get the cpu ID. It is for reading features, not processor identity,
and it completely serializes everything, flushes your CPU pipeline, does a memory fence, and makes rude
noises to your grandma's face (not sure actually about that last one...)
It takes like 150 nsec.
What we actually want to get a cpu ID and not stomp on the cache coherency protocol's toes
is to use RDPID (1-2 nsec), or RDTSCP (15-20 nsec), with the first, faster,
RDPID being preferred if it is available...
If the LLM is to be believed...
"RDPID (Read Processor ID) was introduced with:
AMD: Zen 2 architecture in 2019 (starting with Ryzen 3000 series)
Intel: Ice Lake architecture in 2019 (10th gen Core processors)"
Turns out, I can get those to work, on Linux, on a 2019 Rhyzen 3960X chip.
But on a 2020 Intel i7-1068NG7 Mac running MacOS? nope.
Apparently (according to my unreliable LLM source...) Apple would have to help me out here by
actually setting up the IA32_TSC_AUX MSR... more commentary from the LLM:
"However, I notice something interesting about your earlier message - you mentioned having an Ice Lake i7-1068NG7, which should support RDPID according to Intel's documentation. The fact that we're seeing zeros from both RDTSCP and RDPID on your machine strongly suggests that macOS isn't initializing the IA32_TSC_AUX MSR (0xC0000103) with CPU IDs, rather than any instruction restriction.
This makes sense from Apple's perspective since they were already planning their transition to Apple Silicon around that time (announced in 2020), so they might not have added support for setting up this newer x86 feature in macOS."
A very snarky AI, that.
Does anyone have a clever, way to get the fast RDPID to work on Darwin?
Thanks!