diff --git a/README.md b/README.md index 7901095..cf64712 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,8 @@ These self-contained code samples show you how to correctly detect physical and ## Support and suggestions If you spot a bug, or would like to see the samples evolve in a particular way, file an issue and we'll take a look! + +## Further reading + +- Ken Mitchell (2017). [CPU Core Count Detection on Windows®](https://gpuopen.com/learn/cpu-core-count-detection-windows/). *GPUOpen*. +- Ken Mitchell, Elliot Kim (2018). [AMD Ryzen™ CPU Optimization](https://gpuopen.com/wp-content/uploads/2018/05/gdc_2018_sponsored_optimizing_for_ryzen.pdf). Presented on GDC 2018. diff --git a/windows/ThreadCount-Win7.cpp b/windows/ThreadCount-Win7.cpp index 7198e70..3df314a 100644 --- a/windows/ThreadCount-Win7.cpp +++ b/windows/ThreadCount-Win7.cpp @@ -73,8 +73,10 @@ DWORD getDefaultThreadCount() { char vendor[13]; getCpuidVendor(vendor); if (0 == strcmp(vendor, "AuthenticAMD")) { - if (0x15 == getCpuidFamily()) { - // AMD "Bulldozer" family microarchitecture + if (0x15 <= getCpuidFamily()) { + // AMD "Bulldozer" family microarchitecture or newer + // Jaguar does not have SMT, and Zen SMT is no worse than Bulldozer + // MAINTAINER: remember to update if SMT ever gets bad! count = logical; } else { @@ -92,8 +94,8 @@ int main(int argc, char* argv[]) { DWORD cores, logical; getProcessorCount(cores, logical); - if ((0 == strcmp(vendor, "AuthenticAMD")) && (0x15 == getCpuidFamily())) { - // AMD "Bulldozer" family microarchitecture + if ((0 == strcmp(vendor, "AuthenticAMD")) && (0x15 <= getCpuidFamily())) { + // AMD "Bulldozer" family microarchitecture or newer printf("Processor Module Count: %u\n", logical / 2); printf("Processor Core Count: %u\n", logical); } diff --git a/windows/ThreadCount-WinXP.cpp b/windows/ThreadCount-WinXP.cpp index ac5ddac..933099b 100644 --- a/windows/ThreadCount-WinXP.cpp +++ b/windows/ThreadCount-WinXP.cpp @@ -72,7 +72,9 @@ DWORD getDefaultThreadCount() { getCpuidVendor(vendor); if (0 == strcmp(vendor, "AuthenticAMD")) { if (0x15 == getCpuidFamily()) { - // AMD "Bulldozer" family microarchitecture + // AMD "Bulldozer" family microarchitecture or newer + // Jaguar does not have SMT, and Zen SMT is no worse than Bulldozer + // MAINTAINER: remember to update if SMT ever gets bad! count = logical; } else { @@ -90,8 +92,8 @@ int main(int argc, char* argv[]) { DWORD cores, logical; getProcessorCount(cores, logical); - if ((0 == strcmp(vendor, "AuthenticAMD")) && (0x15 == getCpuidFamily())) { - // AMD "Bulldozer" family microarchitecture + if ((0 == strcmp(vendor, "AuthenticAMD")) && (0x15 <= getCpuidFamily())) { + // AMD "Bulldozer" family microarchitecture or newer printf("Processor Module Count: %u\n", logical / 2); printf("Processor Core Count: %u\n", logical); }