pytorch / cpuinfo

CPU INFOrmation library (x86/x86-64/ARM/ARM64, Linux/Windows/Android/macOS/iOS)
BSD 2-Clause "Simplified" License
962 stars 306 forks source link

detect Meteor Lake CPU model #247

Open xujuntwt95329 opened 1 month ago

xujuntwt95329 commented 1 month ago

This PR add support for detecting Intel Meteor Lake CPU through its model number and extended model.

mingfeima commented 1 month ago

CC @malfet @jgong5

@xujuntwt95329 do we have a test plan for this one ?

xujuntwt95329 commented 1 month ago

@mingfeima Thanks for the suggestion! Test plan updated:

Tested using Intel SDE:

#!/bin/bash

bash scripts/local-build.sh

OPTIONS=()
PLATFORMS=()

OPTIONS+=(-quark); PLATFORMS+=("Quark")
OPTIONS+=(-p4); PLATFORMS+=("Pentium4")
OPTIONS+=(-p4p); PLATFORMS+=("Pentium4 Prescott")
OPTIONS+=(-mrm); PLATFORMS+=("Merom")
OPTIONS+=(-pnr); PLATFORMS+=("Penryn")
OPTIONS+=(-nhm); PLATFORMS+=("Nehalem")
OPTIONS+=(-wsm); PLATFORMS+=("Westmere")
OPTIONS+=(-snb); PLATFORMS+=("Sandy Bridge")
OPTIONS+=(-ivb); PLATFORMS+=("Ivy Bridge")
OPTIONS+=(-hsw); PLATFORMS+=("Haswell")
OPTIONS+=(-bdw); PLATFORMS+=("Broadwell")
OPTIONS+=(-slt); PLATFORMS+=("Saltwell")
OPTIONS+=(-slm); PLATFORMS+=("Silvermont")
OPTIONS+=(-glm); PLATFORMS+=("Goldmont")
OPTIONS+=(-glp); PLATFORMS+=("Goldmont Plus")
OPTIONS+=(-tnt); PLATFORMS+=("Tremont")
OPTIONS+=(-snr); PLATFORMS+=("Snow Ridge")
OPTIONS+=(-skl); PLATFORMS+=("Skylake")
OPTIONS+=(-cnl); PLATFORMS+=("Cannon Lake")
OPTIONS+=(-icl); PLATFORMS+=("Ice Lake")
OPTIONS+=(-skx); PLATFORMS+=("Skylake server")
OPTIONS+=(-clx); PLATFORMS+=("Cascade Lake")
OPTIONS+=(-cpx); PLATFORMS+=("Cooper Lake")
OPTIONS+=(-icx); PLATFORMS+=("Ice Lake server")
OPTIONS+=(-tgl); PLATFORMS+=("Tiger Lake")
OPTIONS+=(-adl); PLATFORMS+=("Alder Lake")
OPTIONS+=(-rpl); PLATFORMS+=("Raptor Lake")
OPTIONS+=(-spr); PLATFORMS+=("Sapphire Rapids")
OPTIONS+=(-gnr); PLATFORMS+=("Granite Rapids")
OPTIONS+=(-srf); PLATFORMS+=("Sierra Forest")
OPTIONS+=(-future); PLATFORMS+=("Future chip")

SDE_BIN="path/to/sde"

for I in "${!PLATFORMS[@]}"; do
  echo "${PLATFORMS["${I}"]}"
  "${SDE_BIN}" "${OPTIONS[$I]}" -- ./build/local/cpu-info | grep -A 1 Microarchitectures
done

# Don't use -mtl option of SDE, the cpuid returned in that is wrong. Below is the cpuid content
# from MTL
echo "
00000000 ******** => 00000023 756E6547 6C65746E 49656E69 #
00000001 ******** => 000A06A4 11800800 7FFAFBFF BFEBFBFF #
00000002 ******** => 00FEFF01 000000F0 00000000 00000000 #
00000003 ******** => 00000000 00000000 00000000 00000000 #
00000004 00000000 => FC004121 02C0003F 0000003F 00000000 #
00000004 00000001 => FC004122 03C0003F 0000003F 00000000 #
00000004 00000002 => FC01C143 03C0003F 000007FF 00000000 #
00000004 00000003 => FC0FC163 02C0003F 00007FFF 00000004 #
00000005 ******** => 00000040 00000040 00000003 11112020 #
00000006 ******** => 00DFCFF7 00000002 00000409 00010003 #
00000007 00000000 => 00000002 239C27EB 994007AC FC18C410 #
00000007 00000001 => 40400910 00000001 00000000 00040000 #
00000007 00000002 => 00000000 00000000 00000000 0000003F #
00000008 ******** => 00000000 00000000 00000000 00000000 #
00000009 ******** => 00000000 00000000 00000000 00000000 #
0000000A ******** => 07300805 00000000 00000007 00008603 #
0000000B 00000000 => 00000001 00000002 00000100 00000018 #
0000000B 00000001 => 00000007 00000016 00000201 00000011 #
0000000C ******** => 00000000 00000000 00000000 00000000 #
0000000D ******** => 00000207 00000340 00000A88 00000000 #
0000000E ******** => 00000000 00000000 00000000 00000000 #
0000000F ******** => 00000000 00000000 00000000 00000000 #
00000010 ******** => 00000000 00000000 00000000 00000000 #
00000011 ******** => 00000000 00000000 00000000 00000000 #
00000013 ******** => 00000000 00000000 00000000 00000000 #
00000014 00000000 => 00000001 0000005F 00000007 00000000 #
00000014 00000001 => 02490002 003F003F 00000000 00000000 #
00000015 ******** => 00000002 0000009C 0249F000 00000000 #
00000016 ******** => 00000BB8 000012C0 00000064 00000000 #
00000017 ******** => 00000000 00000000 00000000 00000000 #
00000018 ******** => 00000008 00000000 00000000 00000000 #
00000019 ******** => 00000000 00000000 00000000 00000000 #
0000001A ******** => 40000002 00000000 00000000 00000000 #
0000001B ******** => 00000000 00000000 00000000 00000000 #
0000001C ******** => 4000000B 00000007 00000007 00000000 #
0000001D ******** => 00000000 00000000 00000000 00000000 #
0000001E ******** => 00000000 00000000 00000000 00000000 #
0000001F ******** => 00000001 00000002 00000100 00000018 #
00000020 ******** => 00000000 00000001 00000000 00000000 #
00000021 ******** => 00000000 00000000 00000000 00000000 #
00000022 ******** => 00000000 00000000 00000000 00000000 #
00000023 ******** => 0000000B 00000000 00000000 00000000 #
80000000 ******** => 80000008 00000000 00000000 00000000 #
80000001 ******** => 00000000 00000000 00000121 2C100800 #
80000002 ******** => 65746E49 2952286C 726F4320 4D542865 #
80000003 ******** => 6C552029 20617274 35312037 00004835 #
80000004 ******** => 00000000 00000000 00000000 00000000 #
80000005 ******** => 00000000 00000000 00000000 00000000 #
80000006 ******** => 00000000 00000000 08007040 00000000 #
80000007 ******** => 00000000 00000000 00000000 00000100 #
80000008 ******** => 0000302E 00000000 00000000 00000000 #
" > mtl.def

echo "Meteor Lake"
"${SDE_BIN}" -cpuid_in mtl.def -- ./build/local/cpu-info | grep -A 1 Microarchitectures

Result:

Quark
SDE-ERROR: 64 bits applications are not supported by input chip: PENTIUM or by the input cpuid definition file
Pentium4
SDE-ERROR: 64 bits applications are not supported by input chip: PENTIUM4 or by the input cpuid definition file
Pentium4 Prescott
Microarchitectures:
        8x Prescott
Merom
Microarchitectures:
        8x Conroe
Penryn
Microarchitectures:
        8x Penryn
Nehalem
Microarchitectures:
        8x Nehalem
Westmere
Microarchitectures:
        8x Nehalem
Sandy Bridge
Microarchitectures:
        8x Sandy Bridge
Ivy Bridge
Microarchitectures:
        8x Ivy Bridge
Haswell
Microarchitectures:
        8x Haswell
Broadwell
Microarchitectures:
        8x Haswell
Saltwell
Microarchitectures:
        8x Bonnell
Silvermont
Microarchitectures:
        8x Silvermont
Goldmont
Microarchitectures:
        8x Goldmont
Goldmont Plus
Microarchitectures:
        8x Goldmont
Tremont
Microarchitectures:
        8x unknown
Snow Ridge
Microarchitectures:
        8x unknown
Skylake
Microarchitectures:
        8x Sky Lake
Cannon Lake
Microarchitectures:
        8x Palm Cove
Ice Lake
Microarchitectures:
        8x Sunny Cove
Skylake server
Microarchitectures:
        8x Sky Lake
Cascade Lake
Microarchitectures:
        8x Sky Lake
Cooper Lake
Microarchitectures:
        8x Sky Lake
Ice Lake server
Microarchitectures:
        8x Sunny Cove
Tiger Lake
Microarchitectures:
        8x unknown
Alder Lake
Microarchitectures:
        8x unknown
Raptor Lake
Microarchitectures:
        8x unknown
Sapphire Rapids
Microarchitectures:
        8x unknown
Granite Rapids
Microarchitectures:
        8x unknown
Sierra Forest
Microarchitectures:
        8x unknown
Future chip
Microarchitectures:
        8x unknown
Meteor Lake
Microarchitectures:
        8x Meteor Lake
fbarchard commented 1 month ago

Could you fill in all the microarchitectures?

When I run sde, the following show unknown: ./gnr256/cpuinfo.txt- 36x unknown ./rpl/cpuinfo.txt- 36x unknown ./lnl/cpuinfo.txt- 36x unknown ./snr/cpuinfo.txt- 36x unknown ./adl/cpuinfo.txt- 36x unknown ./spr/cpuinfo.txt- 36x unknown ./gnr/cpuinfo.txt- 36x unknown ./mtl/cpuinfo.txt- 36x unknown ./tgl/cpuinfo.txt- 36x unknown ./srf/cpuinfo.txt- 36x unknown ./tnt/cpuinfo.txt- 36x unknown ./emr/cpuinfo.txt- 36x unknown ./arl/cpuinfo.txt- 36x unknown

Looking up the documentation on these: rpl Raptor Cove (P-cores) Gracemont (E-cores) lnl Lion Cove (P-cores) Skymont (E-cores) snr Tremont adl Golden Cove (P-cores) Gracemont (E-cores) spr Golden Cove (P-cores) gnr Redwood Cove mlt Redwood Cove P-Cores and Crestmont E-Cores tgl Willow Cove srf Crestmont E-Cores tnt Tremont emr Raptor Cove (P-cores) arl Lion Cove

xujuntwt95329 commented 1 month ago

Could you fill in all the microarchitectures?

When I run sde, the following show unknown: ./gnr256/cpuinfo.txt- 36x unknown ./rpl/cpuinfo.txt- 36x unknown ./lnl/cpuinfo.txt- 36x unknown ./snr/cpuinfo.txt- 36x unknown ./adl/cpuinfo.txt- 36x unknown ./spr/cpuinfo.txt- 36x unknown ./gnr/cpuinfo.txt- 36x unknown ./mtl/cpuinfo.txt- 36x unknown ./tgl/cpuinfo.txt- 36x unknown ./srf/cpuinfo.txt- 36x unknown ./tnt/cpuinfo.txt- 36x unknown ./emr/cpuinfo.txt- 36x unknown ./arl/cpuinfo.txt- 36x unknown

Looking up the documentation on these: rpl Raptor Cove (P-cores) Gracemont (E-cores) lnl Lion Cove (P-cores) Skymont (E-cores) snr Tremont adl Golden Cove (P-cores) Gracemont (E-cores) spr Golden Cove (P-cores) gnr Redwood Cove mlt Redwood Cove P-Cores and Crestmont E-Cores tgl Willow Cove srf Crestmont E-Cores tnt Tremont emr Raptor Cove (P-cores) arl Lion Cove

Sure, I'll add these microarchitectures.

fbarchard commented 1 month ago

You could start with just the P-Core uarch and add hybrid in a followup PR. Note that Alderlake has 2 'models', depending if you've got e-cores enabled or not.

Ch3nYuY commented 6 days ago

Tested using Intel SDE for MTL/RPL/ADL:

#!/bin/bash

bash scripts/local-build.sh

SDE_BIN="path/to/sde"

# Don't use -mtl/rpl/adl option of SDE, the cpuid returned in that is wrong. Below is the cpuid content
# from MTL
echo "
00000000 ******** => 00000023 756E6547 6C65746E 49656E69 #
00000001 ******** => 000A06A4 11800800 7FFAFBFF BFEBFBFF #
00000002 ******** => 00FEFF01 000000F0 00000000 00000000 #
00000003 ******** => 00000000 00000000 00000000 00000000 #
00000004 00000000 => FC004121 02C0003F 0000003F 00000000 #
00000004 00000001 => FC004122 03C0003F 0000003F 00000000 #
00000004 00000002 => FC01C143 03C0003F 000007FF 00000000 #
00000004 00000003 => FC0FC163 02C0003F 00007FFF 00000004 #
00000005 ******** => 00000040 00000040 00000003 11112020 #
00000006 ******** => 00DFCFF7 00000002 00000409 00010003 #
00000007 00000000 => 00000002 239C27EB 994007AC FC18C410 #
00000007 00000001 => 40400910 00000001 00000000 00040000 #
00000007 00000002 => 00000000 00000000 00000000 0000003F #
00000008 ******** => 00000000 00000000 00000000 00000000 #
00000009 ******** => 00000000 00000000 00000000 00000000 #
0000000A ******** => 07300805 00000000 00000007 00008603 #
0000000B 00000000 => 00000001 00000002 00000100 00000018 #
0000000B 00000001 => 00000007 00000016 00000201 00000011 #
0000000C ******** => 00000000 00000000 00000000 00000000 #
0000000D ******** => 00000207 00000340 00000A88 00000000 #
0000000E ******** => 00000000 00000000 00000000 00000000 #
0000000F ******** => 00000000 00000000 00000000 00000000 #
00000010 ******** => 00000000 00000000 00000000 00000000 #
00000011 ******** => 00000000 00000000 00000000 00000000 #
00000013 ******** => 00000000 00000000 00000000 00000000 #
00000014 00000000 => 00000001 0000005F 00000007 00000000 #
00000014 00000001 => 02490002 003F003F 00000000 00000000 #
00000015 ******** => 00000002 0000009C 0249F000 00000000 #
00000016 ******** => 00000BB8 000012C0 00000064 00000000 #
00000017 ******** => 00000000 00000000 00000000 00000000 #
00000018 ******** => 00000008 00000000 00000000 00000000 #
00000019 ******** => 00000000 00000000 00000000 00000000 #
0000001A ******** => 40000002 00000000 00000000 00000000 #
0000001B ******** => 00000000 00000000 00000000 00000000 #
0000001C ******** => 4000000B 00000007 00000007 00000000 #
0000001D ******** => 00000000 00000000 00000000 00000000 #
0000001E ******** => 00000000 00000000 00000000 00000000 #
0000001F ******** => 00000001 00000002 00000100 00000018 #
00000020 ******** => 00000000 00000001 00000000 00000000 #
00000021 ******** => 00000000 00000000 00000000 00000000 #
00000022 ******** => 00000000 00000000 00000000 00000000 #
00000023 ******** => 0000000B 00000000 00000000 00000000 #
80000000 ******** => 80000008 00000000 00000000 00000000 #
80000001 ******** => 00000000 00000000 00000121 2C100800 #
80000002 ******** => 65746E49 2952286C 726F4320 4D542865 #
80000003 ******** => 6C552029 20617274 35312037 00004835 #
80000004 ******** => 00000000 00000000 00000000 00000000 #
80000005 ******** => 00000000 00000000 00000000 00000000 #
80000006 ******** => 00000000 00000000 08007040 00000000 #
80000007 ******** => 00000000 00000000 00000000 00000100 #
80000008 ******** => 0000302E 00000000 00000000 00000000 #
" > mtl.def

echo "Meteor Lake"
"${SDE_BIN}" -cpuid_in mtl.def -- ./build/local/cpu-info | grep -A 1 Microarchitectures

# from RPL
echo "
00000000 ******** => 00000020 756E6547 6C65746E 49656E69 #
00000001 ******** => 000B0671 20800800 FFFAF38B BFCBFBFF #
00000002 ******** => 00FEFF01 000000F0 00000000 00000000 #
00000003 ******** => 00000000 00000000 00000000 00000000 #
00000004 00000000 => FC004121 02C0003F 0000003F 00000000 #
00000004 00000001 => FC004122 01C0003F 0000003F 00000000 #
00000004 00000002 => FC01C143 03C0003F 000007FF 00000000 #
00000004 00000003 => FC1FC163 02C0003F 0000BFFF 00000000 #
00000005 ******** => 00000040 00000040 00000003 00002020 #
00000006 ******** => 009F8FF3 00000002 00000409 00030003 #
00000007 00000000 => 00000002 239C27A9 184007A4 BC18C410 #
00000007 00000001 => 00400810 00000000 00000000 00000000 #
00000007 00000002 => 00000000 00000000 00000000 00000010 #
00000008 ******** => 00000000 00000000 00000000 00000000 #
00000009 ******** => 00000000 00000000 00000000 00000000 #
0000000A ******** => 07300605 00000000 00000007 00008603 #
0000000B 00000000 => 00000001 00000002 00000100 00000008 #
0000000B 00000001 => 00000007 00000020 00000201 00000020 #
0000000C ******** => 00000000 00000000 00000000 00000000 #
0000000D ******** => 00000007 00000340 00000340 00000000 #
0000000E ******** => 00000000 00000000 00000000 00000000 #
0000000F ******** => 00000000 00000000 00000000 00000000 #
00000010 ******** => 00000000 00000000 00000000 00000000 #
00000011 ******** => 00000000 00000000 00000000 00000000 #
00000013 ******** => 00000000 00000000 00000000 00000000 #
00000014 00000000 => 00000001 0000005F 00000007 00000000 #
00000014 00000001 => 02490002 003F003F 00000000 00000000 #
00000015 ******** => 00000002 0000009C 0249F000 00000000 #
00000016 ******** => 00000000 00000000 00000000 00000000 #
00000017 ******** => 00000000 00000000 00000000 00000000 #
00000018 ******** => 00000000 00000000 00000000 00000000 #
00000019 ******** => 00000000 00000000 00000000 00000000 #
0000001A ******** => 40000001 00000000 00000000 00000000 #
0000001B ******** => 00000000 00000000 00000000 00000000 #
0000001C ******** => 4000000B 00000007 00000007 00000000 #
0000001D ******** => 00000000 00000000 00000000 00000000 #
0000001E ******** => 00000000 00000000 00000000 00000000 #
0000001F ******** => 00000001 00000002 00000100 00000008 #
00000020 ******** => 00000000 00000001 00000000 00000000 #
80000000 ******** => 80000008 00000000 00000000 00000000 #
80000001 ******** => 00000000 00000000 00000121 2C100800 #
80000002 ******** => 68743331 6E654720 746E4920 52286C65 #
80000003 ******** => 6F432029 54286572 6920294D 33312D39 #
80000004 ******** => 4B303039 00000000 00000000 00000000 #
80000005 ******** => 00000000 00000000 00000000 00000000 #
80000006 ******** => 00000000 00000000 08007040 00000000 #
80000007 ******** => 00000000 00000000 00000000 00000100 #
80000008 ******** => 00003027 00000000 00000000 00000000 #
" > rpl.def

echo "Raptor Lake"
"${SDE_BIN}" -cpuid_in rpl.def -- ./build/local/cpu-info | grep -A 1 Microarchitectures

# from ADL
echo "
00000000 ******** => 00000020 756E6547 6C65746E 49656E69 #
00000001 ******** => 000906A3 00400800 FFFAF38B BFCBFBFF #
00000002 ******** => 00FEFF01 000000F0 00000000 00000000 #
00000003 ******** => 00000000 00000000 00000000 00000000 #
00000004 00000000 => 7C004121 02C0003F 0000003F 00000000 #
00000004 00000001 => 7C004122 01C0003F 0000003F 00000000 #
00000004 00000002 => 7C01C143 0240003F 000007FF 00000000 #
00000004 00000003 => 7C0FC163 02C0003F 00005FFF 00000004 #
00000005 ******** => 00000040 00000040 00000003 00002020 #
00000006 ******** => 009F8FF3 00000002 00000409 00000003 #
00000007 00000000 => 00000002 239C27A9 184027A4 BC18C410 #
00000007 00000001 => 00400810 00000000 00000000 00000000 #
00000007 00000002 => 00000000 00000000 00000000 00000010 #
00000008 ******** => 00000000 00000000 00000000 00000000 #
00000009 ******** => 00000000 00000000 00000000 00000000 #
0000000A ******** => 07300605 00000000 00000007 00008603 #
0000000B 00000000 => 00000001 00000002 00000100 00000000 #
0000000B 00000001 => 00000006 00000010 00000201 00000000 #
0000000C ******** => 00000000 00000000 00000000 00000000 #
0000000D ******** => 00000007 00000340 00000340 00000000 #
0000000E ******** => 00000000 00000000 00000000 00000000 #
0000000F ******** => 00000000 00000000 00000000 00000000 #
00000010 ******** => 00000000 00000000 00000000 00000000 #
00000011 ******** => 00000000 00000000 00000000 00000000 #
00000013 ******** => 00000000 00000000 00000000 00000000 #
00000014 00000000 => 00000001 0000005F 00000007 00000000 #
00000014 00000001 => 02490002 003F003F 00000000 00000000 #
00000015 ******** => 00000002 00000082 0249F000 00000000 #
00000016 ******** => 00000000 00000000 00000000 00000000 #
00000017 ******** => 00000000 00000000 00000000 00000000 #
00000018 ******** => 00000000 00000000 00000000 00000000 #
00000019 ******** => 00000000 00000000 00000000 00000000 #
0000001A ******** => 40000001 00000000 00000000 00000000 #
0000001B ******** => 00000000 00000000 00000000 00000000 #
0000001C ******** => 4000000B 00000007 00000007 00000000 #
0000001D ******** => 00000000 00000000 00000000 00000000 #
0000001E ******** => 00000000 00000000 00000000 00000000 #
0000001F ******** => 00000001 00000002 00000100 00000000 #
00000020 ******** => 00000000 00000001 00000000 00000000 #
80000000 ******** => 80000008 00000000 00000000 00000000 #
80000001 ******** => 00000000 00000000 00000121 2C100800 #
80000002 ******** => 68743231 6E654720 746E4920 52286C65 #
80000003 ******** => 6F432029 54286572 6920294D 32312D37 #
80000004 ******** => 00503037 00000000 00000000 00000000 #
80000005 ******** => 00000000 00000000 00000000 00000000 #
80000006 ******** => 00000000 00000000 05007040 00000000 #
80000007 ******** => 00000000 00000000 00000000 00000100 #
80000008 ******** => 00003027 00000000 00000000 00000000 #
" > adl.def

echo "Alder Lake"
"${SDE_BIN}" -cpuid_in adl.def -- ./build/local/cpu-info | grep -A 1 Microarchitectures

Result:

Meteor Lake
Microarchitectures:
        8x Redwood Cove
Raptor Lake
Microarchitectures:
        8x Raptor Cove
Alder Lake
Microarchitectures:
        8x Golden Cove
xujuntwt95329 commented 5 days ago

@mingfeima @fbarchard Thanks for all the suggestions, @Ch3nYuY has updated this patch to detect uarch for MTL/RPL/ADL, could you please help review this again?

If this kind of modification is acceptable, we will add more uarch as suggested by @fbarchard