fix: P/E cores from the highest EfficiencyClass, AMD CCDs from real L3 groups

The legacy topology treated the lowest EfficiencyClass as the performance
core, swapping P- and E-cores on hybrid Intel CPUs. AMD CCDs were guessed
as 8 cores each, which split 6+6 parts (7900X3D, 9900X3D) into 8+4; they now
come from the L3 groups Windows reports, with the guess kept only as a
fallback. The topology snapshot also keeps each L3 group's size.
This commit is contained in:
PrimeBuild-pc
2026-10-15 13:25:35 +02:00
parent 7552a4c5d5
commit 3f0f135255
6 changed files with 229 additions and 13 deletions
+11 -3
View File
@@ -59,6 +59,7 @@ namespace ThreadPilot.Models
private readonly IReadOnlyDictionary<ProcessorRef, int> lastLevelCacheIndexesByProcessor;
private readonly IReadOnlyDictionary<ProcessorRef, int> packageIndexesByProcessor;
private readonly IReadOnlyDictionary<ProcessorRef, IReadOnlyList<int>> smtSiblingGlobalIndexesByProcessor;
private readonly IReadOnlyDictionary<int, ulong> lastLevelCacheSizesByIndex;
private CpuTopologySnapshot(
IReadOnlyList<ProcessorRef> logicalProcessors,
@@ -70,7 +71,8 @@ namespace ThreadPilot.Models
IReadOnlyDictionary<ProcessorRef, int> packageIndexesByProcessor,
IReadOnlyDictionary<ProcessorRef, IReadOnlyList<int>> smtSiblingGlobalIndexesByProcessor,
CpuTopologySignature signature,
IReadOnlyList<int> reservedLogicalProcessorIndexes)
IReadOnlyList<int> reservedLogicalProcessorIndexes,
IReadOnlyDictionary<int, ulong> lastLevelCacheSizesByIndex)
{
this.LogicalProcessors = logicalProcessors;
this.cpuSetIdsByProcessor = cpuSetIdsByProcessor;
@@ -82,6 +84,7 @@ namespace ThreadPilot.Models
this.smtSiblingGlobalIndexesByProcessor = smtSiblingGlobalIndexesByProcessor;
this.Signature = signature;
this.ReservedLogicalProcessorIndexes = reservedLogicalProcessorIndexes;
this.lastLevelCacheSizesByIndex = lastLevelCacheSizesByIndex;
}
public IReadOnlyList<ProcessorRef> LogicalProcessors { get; }
@@ -100,7 +103,8 @@ namespace ThreadPilot.Models
IReadOnlyDictionary<ProcessorRef, int>? lastLevelCacheIndexes = null,
IReadOnlyDictionary<ProcessorRef, int>? packageIndexes = null,
IReadOnlyDictionary<ProcessorRef, IReadOnlyList<int>>? smtSiblingGlobalIndexes = null,
IEnumerable<int>? reservedLogicalProcessorIndexes = null)
IEnumerable<int>? reservedLogicalProcessorIndexes = null,
IReadOnlyDictionary<int, ulong>? lastLevelCacheSizes = null)
{
ArgumentNullException.ThrowIfNull(logicalProcessors);
@@ -177,7 +181,8 @@ namespace ThreadPilot.Models
.Where(knownGlobalIndexes.Contains)
.Distinct()
.OrderBy(index => index)
.ToList());
.ToList(),
lastLevelCacheSizes?.ToDictionary(kvp => kvp.Key, kvp => kvp.Value) ?? new Dictionary<int, ulong>());
}
public bool TryGetCpuSetId(ProcessorRef processor, out uint cpuSetId) =>
@@ -195,6 +200,9 @@ namespace ThreadPilot.Models
public bool TryGetLastLevelCacheIndex(ProcessorRef processor, out int lastLevelCacheIndex) =>
this.lastLevelCacheIndexesByProcessor.TryGetValue(processor, out lastLevelCacheIndex);
public bool TryGetLastLevelCacheSize(int lastLevelCacheIndex, out ulong cacheSizeBytes) =>
this.lastLevelCacheSizesByIndex.TryGetValue(lastLevelCacheIndex, out cacheSizeBytes);
public bool TryGetPackageIndex(ProcessorRef processor, out int packageIndex) =>
this.packageIndexesByProcessor.TryGetValue(processor, out packageIndex);