anrieff / libcpuid

a small C library for x86 CPU detection and feature extraction
Other
451 stars 106 forks source link

Fix Ryzen core count calculation #120

Closed TheTumultuousUnicornOfDarkness closed 5 years ago

TheTumultuousUnicornOfDarkness commented 5 years ago

Original issue: X0rg/CPU-X#86.

Ryzen 3 CPUs come without SMT enabled (but the HT flag is present), so the num_cores /= 2 should be avoided in that case. The ThreadsPerCore value is what we need. Tests pass with success:

Test [./tests/amd/zen/ryzen7]: OK
Test [./tests/amd/zen/ryzen3]: OK
TheTumultuousUnicornOfDarkness commented 5 years ago

BTW, there are strange values in X0rg/CPU-X#86 (CPU maximum multiplier and bus speed), reminding me #94. After checking, it's just a cast problem. Shame on me. Fixed in 92d3a771059a3a7b179809f0aead306327c44afb.

anrieff commented 5 years ago

Cool, many thanks for the test, @X0rg !