cpuinfo - Pytorch
https://github.com/pytorch/cpuinfo#cpu-information-library
- 1 Information is needed by cpu info
- 1.1 Concept
- 1.2 Data representation
- 2 Information is available through MSDN API
- 2.1 Concept
- 2.2 Data representation
- 3 Concerns
- 3.1 Cluster as a missing entity on x86 (respectively on Windows)
- 3.2 Missing topology APIs for Arm on Windows
- 3.2.1 Get vendor and SoC name
- 3.2.1.1 Registry
- 3.2.2 wmic
- 3.2.3 Read MIDR
- 3.2.4 Get processor type per core
- 3.2.5 big - little topology per core: uarch in cpuinfo
- 3.2.6 Get Cache Partitions and Set
- 3.2.1 Get vendor and SoC name
Information is needed by cpu info
Concept
Data representation
Information is available through MSDN API
Concept
Data representation
Background:
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX (winnt.h) - Win32 apps
Logical processor
one logical computing engine from the perspective of the operating system, application or driver
Core
one processor unit, which can consist of one or more logical processors
Physical processor
A physical processor is the same as a processor package, a socket, or a CPU.
can consist of one or more cores
Concerns
Cluster as a missing entity on x86 (respectively on Windows)
Current implementations of x86 Windows and MacOS set cluster count (per package) to fixed 1.
CPU Info fills 3 container layers (package, cluster, core), but queries only 2:
RelationProcessorPackage
RelationProcessorCore
Cluster on Arm-Linux, the cluster count is detected
The higher level of ProcessorPackage in MSDN API is ProcessorGroup, but it’s not equal to cluster.
cpuinfo reporting demo tool doesn’t report the number of clusters: https://github.com/pytorch/cpuinfo/blob/master/tools/cpu-info.c
Missing topology APIs for Arm on Windows
Get vendor and SoC name
Registry
PS C:\kg\python_test\github_packages\cpuinfo> reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v ProcessorNameString
HKEY_LOCAL_MACHINE\Hardware\Description\System\CentralProcessor\0
ProcessorNameString REG_SZ Microsoft SQ2 @ 3.15 GHz
wmic
It reads information about the currently used core only, no direct connection with system logical information reported processors.
https://docs.microsoft.com/en-us/windows/win32/wmisdk/example-creating-a-wmi-application
wmic cpu list /format:list
AddressWidth=64
Architecture=12
Availability=3
Caption=ARMv8 (64-bit) Family 8 Model 805 Revision D0E
ConfigManagerErrorCode=
ConfigManagerUserConfig=
CpuStatus=1
CreationClassName=Win32_Processor
CurrentClockSpeed=3148
CurrentVoltage=11
DataWidth=64
Description=ARMv8 (64-bit) Family 8 Model 805 Revision D0E
DeviceID=CPU0
ErrorCleared=
ErrorDescription=
ExtClock=
Family=280
InstallDate=
L2CacheSize=1280
L2CacheSpeed=
LastErrorCode=
Level=2053
LoadPercentage=7
Manufacturer=Qualcomm Technologies Inc
MaxClockSpeed=3148
Name=Microsoft SQ2 @ 3.15 GHz
OtherFamilyDescription=
PNPDeviceID=
PowerManagementCapabilities=
PowerManagementSupported=FALSE
ProcessorId=0000000000000000
ProcessorType=3
Revision=3342
Role=CPU
SocketDesignation=Qualcomm
Status=OK
StatusInfo=3
Stepping=14
SystemCreationClassName=Win32_ComputerSystem
SystemName=040644303253
UniqueId=
UpgradeMethod=6
Version=Model 13, Stepping 14
VoltageCaps=
Read MIDR
Not available in userspace in WoA
https://developer.arm.com/documentation/ddi0595/2021-06/AArch64-Registers/MIDR-EL1--Main-ID-Register
Get processor type per core
GetSystemInformation reports information on the currently used core only, so not system wide and no direct connection with system logical information reported processors.
big - little topology per core: uarch in cpuinfo
EfficiencyClass can mean bigger numbers are big cores while the rest are little cores currently. In the future it can be changed.
PROCESSOR_RELATIONSHIP (winnt.h) - Win32 apps | Microsoft Docs
Get Cache Partitions and Set
Cpuinfo would need cache partitions and sets, while these are not reported by https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-cache_relationship
https://github.com/pytorch/cpuinfo/blob/master/include/cpuinfo.h#L101