Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intel Core i7-12700KF lists 10 cores instead of 12 #40

Open
AndrejMitrovic opened this issue Oct 5, 2022 · 10 comments
Open

Intel Core i7-12700KF lists 10 cores instead of 12 #40

AndrejMitrovic opened this issue Oct 5, 2022 · 10 comments
Assignees

Comments

@AndrejMitrovic
Copy link

Hi,

I'm seeing only 10 cores listed when running ddcpuid on both Posix and Win32:

$ dub run
Performing "debug" build using C:\Apps\DMD\dmd2\windows\bin64\dmd.exe for x86_64.
ddcpuid 0.21.0: building configuration "application"...
Linking...
Running ddcpuid.exe

Name:        GenuineIntel 12th Gen Intel(R) Core(TM) i7-12700KF
Identifier:  Family 0x6 Model 0x97 Stepping 0x2
Cores:       10 cores, 20 threads
Max. Memory: 512 GiB physical, 256 TiB virtual
Platform:    x86-64
Baseline:    x86-64-v3
Features:    eist turboboost htt
Extensions:  x87/fpu +f16c mmx intel64/x86-64 +lahf64 aes-ni adx sha bmi1 bmi2
SSE:         sse sse2 sse3 ssse3 sse4.1 sse4.2 fma
AVX:         avx avx2
AMX:
Mitigations: ibrs stibp ssbd l1d_flush md_clear cet_ibt cet_ss
ParaVirt.:   Hyper-V
Cache L1-D:   10x   48 KiB,  480 KiB total, si
Cache L1-I:   10x   32 KiB,  320 KiB total, si
Cache L2-U:    2x 1.25 MiB,  2.5 MiB total, si
Cache L3-U:    1x   25 MiB,   25 MiB total, si

Here's a comparison with CPU-Z:

cpuid

It seems ddcpuid might be missing some of the L2 caches as well.


Here's the raw output if it helps:

| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|        0 |        0 |       1f | 756e6547 | 6c65746e | 49656e69 |
|        1 |        0 |    90672 | 4e800800 | fefaf383 | bfcbfbff |
|        2 |        0 |   feff01 |       f0 |        0 |        0 |
|        3 |        0 |        0 |        0 |        0 |        0 |
|        4 |        0 | fc004121 |  2c0003f |       3f |        0 |
|        5 |        0 |        0 |        0 |        0 |        0 |
|        6 |        0 |   1f8ff3 |        2 |        9 |    90003 |
|        7 |        0 |        1 | 239c27ab |   400784 | bc108410 |
|        8 |        0 |        0 |        0 |        0 |        0 |
|        9 |        0 |        0 |        0 |        0 |        0 |
|        a |        0 |  7300605 |        0 |        0 |      603 |
|        b |        0 |        1 |        2 |      100 |       4c |
|        c |        0 |        0 |        0 |        0 |        0 |
|        d |        0 |        7 |      340 |      340 |        0 |
|        e |        0 |        0 |        0 |        0 |        0 |
|        f |        0 |        0 |        0 |        0 |        0 |
|       10 |        0 |        0 |        0 |        0 |        0 |
|       11 |        0 |        0 |        0 |        0 |        0 |
|       12 |        0 |        0 |        0 |        0 |        0 |
|       13 |        0 |        0 |        0 |        0 |        0 |
|       14 |        0 |        1 |       5f | 80000007 |        0 |
|       15 |        0 |        2 |       bc |  249f000 |        0 |
|       16 |        0 |        0 |        0 |        0 |        0 |
|       17 |        0 |        0 |        0 |        0 |        0 |
|       18 |        0 |        0 |        0 |        0 |        0 |
|       19 |        0 |        0 |        0 |        0 |        0 |
|       1a |        0 | 20000001 |        0 |        0 |        0 |
|       1b |        0 |        0 |        0 |        0 |        0 |
|       1c |        0 |        0 |        0 |        0 |        0 |
|       1d |        0 |        0 |        0 |        0 |        0 |
|       1e |        0 |        0 |        0 |        0 |        0 |
|       1f |        0 |        1 |        2 |      100 |       4e |
| 40000000 |        0 | 4000000b | 7263694d | 666f736f | 76482074 |
| 40000001 |        0 | 31237648 |        0 |        0 |        0 |
| 40000002 |        0 |     4a61 |    a0000 |        2 |      7d6 |
| 40000003 |        0 |     bfff |   2bb9ff |        2 | 31fffbf6 |
| 40000004 |        0 |    60e14 |        0 |       2e |        0 |
| 40000005 |        0 |      400 |      400 |      fb4 |        0 |
| 40000006 |        0 |   8200af |        0 |        0 |        0 |
| 40000007 |        0 | 80000007 |        3 |        0 |        0 |
| 40000008 |        0 |        0 |        0 |        0 |        0 |
| 40000009 |        0 |        0 |        0 |        0 |        0 |
| 4000000a |        0 |        0 |        0 |        0 |        0 |
| 4000000b |        0 |        0 |        0 |        0 |        0 |
| 80000000 |        0 | 80000008 |        0 |        0 |        0 |
| 80000001 |        0 |        0 |        0 |      121 | 2c100800 |
| 80000002 |        0 | 68743231 | 6e654720 | 746e4920 | 52286c65 |
| 80000003 |        0 | 6f432029 | 54286572 | 6920294d | 32312d37 |
| 80000004 |        0 | 4b303037 |       46 |        0 |        0 |
| 80000005 |        0 |        0 |        0 |        0 |        0 |
| 80000006 |        0 |        0 |        0 |  5007040 |        0 |
| 80000007 |        0 |        0 |        0 |        0 |      100 |
| 80000008 |        0 |     3027 |        0 |        0 |        0 |
@dd86k dd86k self-assigned this Oct 5, 2022
@dd86k
Copy link
Owner

dd86k commented Oct 5, 2022

Finally, you're the first one I meet with a 12th Gen Core processor!

Only thing I ask is to get the output of these commands:

  • ddcpuid -r 0x1f,0
  • ddcpuid -r 0x1f,1
  • ddcpuid -r 0x1f,2
  • ddcpuid -r 0x1f,3
  • ddcpuid -r 0x1f,4
  • ddcpuid -r 0x1f,5
  • ddcpuid -r 0x1f,6

With this, I'll finally be able to implement CPUID.1Fh against a real-life example.

The 10 is likely due to the 20 logical total cores it found via an older CPUID call (as Intel's Ark confirms, since it's 8 SMT P-Cores and 4 non-SMT E-Cores, so 8x2+4 threads) to base its core/thread calculation and cache topology.

@AndrejMitrovic
Copy link
Author

Here you go:

ddcpuid -r 0x1f,0
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|       1f |        0 |        1 |        2 |      100 |       4e |

ddcpuid -r 0x1f,1
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|       1f |        1 |        7 |       14 |      201 |       48 |

ddcpuid -r 0x1f,2
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|       1f |        2 |        0 |        0 |        2 |       4e |

ddcpuid -r 0x1f,3
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|       1f |        3 |        0 |        0 |        3 |       4e |

ddcpuid -r 0x1f,4
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|       1f |        4 |        0 |        0 |        4 |       4e |

ddcpuid -r 0x1f,5
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|       1f |        5 |        0 |        0 |        5 |       48 |

ddcpuid -r 0x1f,6
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|       1f |        6 |        0 |        0 |        6 |       48 |

Btw, have you considered posting about this project to https://forum.dlang.org/group/announce? I only discovered it by chance. Really impressive work!

@dd86k
Copy link
Owner

dd86k commented Oct 10, 2022

Hm, unfortunately I'm only seeing SMT=2 (two threads per core) and Core=20 (20 threads total). Nothing else because all the other levels are invalid. Either because the utility was rerun multiple times (on either P/E platforms because of the different x2APIC ID) or I don't know.

I'm now thinking maybe both P-Cores and E-Cores may contain different information, so I'm in for a ride since I may have to support going across NUMA nodes (curse you Intel) and that's OS-dependant.

One of those bugs where I'll have to experiment with once I get a 12/13th Gen of my own.

have you considered posting about this project to https://forum.dlang.org/group/announce?

Yeah, but I never liked getting too much attention. I did announce my SHA-3 and BLAKE2 implementations earlier this year because those are smaller projects, easier to finish/maintain, and less attractive.

@dd86k
Copy link
Owner

dd86k commented Oct 10, 2022

Curious again.

Can you run ddcpuid -r 0xb,0 up to ddcpuid -r 0xb,4? Hopefully it's useable.

@AndrejMitrovic
Copy link
Author

Here you go:

ddcpuid -r 0xb,0
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|        b |        0 |        1 |        2 |      100 |       4c |

ddcpuid -r 0xb,1
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|        b |        1 |        7 |       14 |      201 |       4e |

ddcpuid -r 0xb,2
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|        b |        2 |        0 |        0 |        2 |       4e |

ddcpuid -r 0xb,3
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|        b |        3 |        0 |        0 |        3 |       4e |

ddcpuid -r 0xb,4
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|        b |        4 |        0 |        0 |        4 |       48 |

@dd86k
Copy link
Owner

dd86k commented Oct 10, 2022

Sob, that's the exact same as CPUID.1Fh.

Since I saw that CPU-Z screenshot, I assume you're on Windows.

These next steps will tell me which revision of the microcode you're using (and if it's up-to-date): Can you navigate to registry key (using regedit or a similar tool) HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0 and tell me the value of Update Revision?

For 06-97-02 (updated 2 months ago), I'm expecting the registry value to be 22 00 00 00 00 00 00 00 (so revision 0x22). At least this will tell me if Windows Updates has the last µcode revision, it can happen CPUID data changes through those.

@AndrejMitrovic
Copy link
Author

Yeah it's 22.

@dd86k
Copy link
Owner

dd86k commented Oct 10, 2022

Well, that sucks.

To say the least, CPUID.1Ah.EAX[31:24] contains 0x20 ("Intel Atom®") which tells me ddcpuid probably ran in a E-Core thread and that tells me those cores might not have everything as I recall some articles talking about this.

I'll continue to investigate.

@dd86k
Copy link
Owner

dd86k commented Oct 10, 2022

Or, lastly, if you can run ddcpuid -r 4,0 up to ddcpuid -r 4,5 (for CPUID.04h(ECX=0..5).EAX[31:14]).

@AndrejMitrovic
Copy link
Author

To say the least, CPUID.1Ah.EAX[31:24] contains 0x20 ("Intel Atom®") which tells me ddcpuid probably ran in a E-Core thread and that tells me those cores might not have everything as I recall some articles talking about this.

Perhaps I could try to set the affinity to make it run on one of the performance cores? I can try it out tomorrow, it's a bit late here now.

Or, lastly, if you can run ddcpuid -r 4,0 up to ddcpuid -r 4,5 (for CPUID.04h(ECX=0..5).EAX[31:14]).

Here:

ddcpuid -r 4,0
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|        4 |        0 | fc004121 |  2c0003f |       3f |        0 |

ddcpuid -r 4,1
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|        4 |        1 | fc004122 |  1c0003f |       3f |        0 |

ddcpuid -r 4,2
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|        4 |        2 | fc01c143 |  240003f |      7ff |        0 |

ddcpuid -r 4,3
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|        4 |        3 | fc1fc163 |  240003f |     9fff |        0 |

ddcpuid -r 4,4
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|        4 |        4 |        0 |        0 |        0 |        0 |

ddcpuid -r 4,5
| Leaf     | Sub-leaf | EAX      | EBX      | ECX      | EDX      |
|----------|----------|----------|----------|----------|----------|
|        4 |        5 |        0 |        0 |        0 |        0 |

Thanks for trying!

@dd86k dd86k added the library ddcpuid library label Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

2 participants