AMD Ryzen, wrong CPU Core Enumeration (#376)

Thanks to @sebastian-dev
This commit is contained in:
sebastian-dev
2021-02-08 10:50:06 +01:00
committed by GitHub
parent f5aa4fbe06
commit 46150305f2
2 changed files with 11 additions and 18 deletions
@@ -125,11 +125,6 @@ namespace LibreHardwareMonitor.Hardware.CPU
}
break;
}
case 0x17:
{
miscellaneousControlDeviceId = FAMILY_17H_MODEL_00_MISC_CONTROL_DEVICE_ID;
break;
}
default:
{
miscellaneousControlDeviceId = 0;
@@ -565,7 +560,6 @@ namespace LibreHardwareMonitor.Hardware.CPU
private const ushort FAMILY_15H_MODEL_70_MISC_CONTROL_DEVICE_ID = 0x15B3;
private const ushort FAMILY_16H_MODEL_00_MISC_CONTROL_DEVICE_ID = 0x1533;
private const ushort FAMILY_16H_MODEL_30_MISC_CONTROL_DEVICE_ID = 0x1583;
private const ushort FAMILY_17H_MODEL_00_MISC_CONTROL_DEVICE_ID = 0x1577;
// ReSharper restore InconsistentNaming
}
@@ -28,10 +28,8 @@ namespace LibreHardwareMonitor.Hardware.CPU
_processor = new Processor(this);
// add all numa nodes
const int initialCoreId = 1_000_000_000;
int coreId = 1;
int lastCoreId = initialCoreId;
int coreId = 0;
int lastCoreId = -1; //invalid id
// Ryzen 3000's skip some core ids.
// So start at 1 and count upwards when the read core changes.
@@ -39,22 +37,23 @@ namespace LibreHardwareMonitor.Hardware.CPU
{
CpuId thread = cpu[0];
// coreID
// Register ..1E_1, [7:0]
// CPUID_Fn8000001E_EBX, Register ..1E_1, [7:0]
// threads per core = CPUID_Fn8000001E_EBX[15:8] + 1
// CoreId: core ID = CPUID_Fn8000001E_EBX[7:0]
int coreIdRead = (int)(thread.ExtData[0x1e, 1] & 0xff);
// nodeID
// Register ..1E_2, [7:0]
// CPUID_Fn8000001E_ECX, Node Identifiers, Register ..1E_2
// NodesPerProcessor = CPUID_Fn8000001E_ECX[10:8]
// nodeID = CPUID_Fn8000001E_ECX[7:0]
int nodeId = (int)(thread.ExtData[0x1e, 2] & 0xff);
_processor.AppendThread(thread, nodeId, coreId);
if (lastCoreId != initialCoreId && coreIdRead != lastCoreId)
if (coreIdRead != lastCoreId)
{
coreId++;
}
lastCoreId = coreIdRead;
_processor.AppendThread(thread, nodeId, coreId);
}
Update();