Restrict L2 Cache Core check to Intel devices (#19483)
### Description Limit SoC core detection via 2 level cache core logic to Intel and Hybrid processors. ### Motivation and Context The following code was added to add support for a new class of CPU cores present in Intel’s next generation Intel Core Ultra mobile processors. This code is essential to avoid placing threads on low performing SoC cores that don’t have L3 cache. SoC cores are meant to specialize in system bringup and help improve responsiveness and power usage, in other words they are not meant to run compute heavy AI workloads. In order to avoid broad exposure of this logic, it is currently designed to be restricted to Intel platforms that have hybrid enabled. --------- Co-authored-by: Sheil Kumar <sheilk@microsoft.com>
This commit is contained in:
Родитель
fbff99a432
Коммит
1508c2ee39
|
@ -14,7 +14,7 @@ struct LogicalProcessorInformation {
|
|||
|
||||
struct CoreCounter {
|
||||
uint32_t PhysicalCores = 0;
|
||||
uint32_t SocDieCores = 0;
|
||||
uint32_t Num2CacheCores = 0;
|
||||
};
|
||||
|
||||
static LogicalProcessorInformation GetLogicalProcessorInfos(LOGICAL_PROCESSOR_RELATIONSHIP relationship) {
|
||||
|
@ -75,7 +75,7 @@ static CoreCounter GetNumberOPhysicalAndEngineeringCores() {
|
|||
read += currentProcessorInfo->Size;
|
||||
}
|
||||
|
||||
cores.SocDieCores = CountSetBits(dwLevel2GroupMask & ~dwLevel3GroupMask);
|
||||
cores.Num2CacheCores = CountSetBits(dwLevel2GroupMask & ~dwLevel3GroupMask);
|
||||
return cores;
|
||||
}
|
||||
|
||||
|
@ -83,8 +83,25 @@ uint32_t HardwareCoreEnumerator::DefaultIntraOpNumThreads() {
|
|||
// # of physical cores = # of P cores + # of E Cores + # of Soc Cores.
|
||||
// # of logical cores = # of P cores x 2 (if hyper threading is enabled) + # of E cores + # of Soc Cores.
|
||||
auto cores = GetNumberOPhysicalAndEngineeringCores();
|
||||
// We want to use the number of physical cores, but exclude soc cores
|
||||
return cores.PhysicalCores - cores.SocDieCores;
|
||||
|
||||
const int kVendorID_Intel[3] = {0x756e6547, 0x6c65746e, 0x49656e69}; // "GenuntelineI"
|
||||
int regs_leaf0[4];
|
||||
int regs_leaf7[4];
|
||||
__cpuid(regs_leaf0, 0);
|
||||
__cpuid(regs_leaf7, 0x7);
|
||||
|
||||
auto isIntel = (kVendorID_Intel[0] == regs_leaf0[1]) && (kVendorID_Intel[1] == regs_leaf0[2]) &&
|
||||
(kVendorID_Intel[2] == regs_leaf0[3]);
|
||||
|
||||
auto isHybrid = (regs_leaf7[3] & (1 << 15));
|
||||
|
||||
if (isIntel && isHybrid) {
|
||||
// We want to use the number of physical cores, but exclude soc cores
|
||||
// On Intel Hybrid processors, numSocCores == cores.Num2CacheCores
|
||||
return cores.PhysicalCores - cores.Num2CacheCores;
|
||||
}
|
||||
|
||||
return cores.PhysicalCores;
|
||||
}
|
||||
|
||||
} // namespace WINMLP
|
||||
|
|
Загрузка…
Ссылка в новой задаче