How to tell a CPU model, When Running Under a Hypervisor that Hides a Real CPUID

When running in a virtual machine, you may never be sure which physical CPU you are running on - a hypervisor can pass anything as CPUID to its guests. Many private clouds are configured so that for easier orchestration, all virtual machines think they run on Sandy Bridge CPU, even if real physical CPUs in servers are newer.

For best performance, it helps to use the best instruction set supported by a physical CPU - be it AVX512, AVX2, AVX, SSE4.1, AES-NI, or other accelerated instructions. Enhanced Platform Awareness features use top-down approach to close this gap by optimal orchestration, but bottom-up approach is also possible.

From within a virtual machine, it is possible to make several measurements, that would identify a CPU generation. Some platform invariants cannot be changed by a hypervisor for user mode applications. For example, between Nehalem and Sandy Bridge, Sandy Bridge and Haswell, Haswell and Skylake L1 data cache throughput was doubling (in each "Tock"). Also in Westmere, Ivy Bridge and Broadwell several new instructions were added and minor microarchitectural improvements were made (in each "Tick").

"Physical CPU Model ID Tool" is a simple open source tool that makes several measurements and reports a CPU generation. It checks if CPU supports ADCX, CMUL, what is the throughput of DIVPS, and L1D throughput. This is enough to identify a Xeon generation. As a bonus, the tool checks if it runs under an hypervisor that oversubscribes its cores.


Есть файлы для загрузки, доступные на условиях лицензии BSD 3-clause License. Загрузить сейчас
Для получения подробной информации о возможностях оптимизации компилятора обратитесь к нашему Уведомлению об оптимизации.
Возможность комментирования русскоязычного контента была отключена. Узнать подробнее.