Skip to content

Commit

Permalink
Resolve formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
A-Satti committed Nov 22, 2024
1 parent 38bcef3 commit 3a1dd1d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
28 changes: 13 additions & 15 deletions onnxruntime/core/platform/windows/hardware_core_enumerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,36 +84,34 @@ 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 = GetCoreInfo();
#if !defined(_M_ARM64EC) && !defined(_M_ARM64) && !defined(__aarch64__)
#if !defined(_M_ARM64EC) && !defined(_M_ARM64) && !defined(__aarch64__)
const int kVendorID_Intel[3] = {0x756e6547, 0x6c65746e, 0x49656e69}; // "GenuntelineI"
bool isIntelSpecifiedPlatform = false;
const int kVendorID_IntelSpecifiedPlatformIDs[3] = {//ExtendedModel,ExtendedFamily,Family Code, and Model Number
0xa06a, //MTL
0xc065, //ARL-H
0xb065 //ARL-U
};
const int kVendorID_IntelSpecifiedPlatformIDs[3] = {
// ExtendedModel, ExtendedFamily, Family Code, and Model Number
0xa06a, // MTL
0xc065, // ARL-H
0xb065 // ARL-U
};

int regs_leaf0[4];
int regs_leaf1[4];
__cpuid(regs_leaf0, 0);
__cpuid(regs_leaf1, 0x1);

auto isIntel = (kVendorID_Intel[0] == regs_leaf0[1]) && (kVendorID_Intel[1] == regs_leaf0[2]) && (kVendorID_Intel[2] == regs_leaf0[3]);

auto isIntel = (kVendorID_Intel[0] == regs_leaf0[1]) && (kVendorID_Intel[1] == regs_leaf0[2]) &&
(kVendorID_Intel[2] == regs_leaf0[3]);

for(int intelSpecifiedPlatform : kVendorID_IntelSpecifiedPlatformIDs){
if ((regs_leaf1[0]>>4) == intelSpecifiedPlatform){
for (int intelSpecifiedPlatform : kVendorID_IntelSpecifiedPlatformIDs) {
if ((regs_leaf1[0] >> 4) == intelSpecifiedPlatform) {
isIntelSpecifiedPlatform = true;
}
}

if (isIntel) {
if(isIntelSpecifiedPlatform){
//We want to exclude cores without an LLC
if (isIntelSpecifiedPlatform) {
// We want to exclude cores without an LLC
return cores.LLCCores;
}
else{
} else {
return cores.PhysicalCores;
}
}
Expand Down
18 changes: 9 additions & 9 deletions winml/lib/Api/HardwareCoreEnumerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,26 +86,26 @@ uint32_t HardwareCoreEnumerator::DefaultIntraOpNumThreads() {
// # of logical cores = # of P cores x 2 (if hyper threading is enabled) + # of E cores + # of Soc Cores.
auto cores = GetCoreInfo();

#if !defined(_M_ARM64EC) && !defined(_M_ARM64) && !defined(__aarch64__)
#if !defined(_M_ARM64EC) && !defined(_M_ARM64) && !defined(__aarch64__)
const int kVendorID_Intel[3] = {0x756e6547, 0x6c65746e, 0x49656e69}; // "GenuntelineI"
bool isIntelSpecifiedPlatform = false;
const int kVendorID_IntelSpecifiedPlatformIDs[3] = {//ExtendedModel,ExtendedFamily,Family Code, and Model Number
0xa06a, //MTL
0xc065, //ARL-H
0xb065 //ARL-U
};
const int kVendorID_IntelSpecifiedPlatformIDs[3] = {
// ExtendedModel,ExtendedFamily,Family Code, and Model Number
0xa06a, // MTL
0xc065, // ARL-H
0xb065 // ARL-U
};

int regs_leaf0[4];
int regs_leaf1[4];
__cpuid(regs_leaf0, 0);
__cpuid(regs_leaf1, 0x1);


auto isIntel = (kVendorID_Intel[0] == regs_leaf0[1]) && (kVendorID_Intel[1] == regs_leaf0[2]) &&
(kVendorID_Intel[2] == regs_leaf0[3]);

for(int intelSpecifiedPlatform : kVendorID_IntelSpecifiedPlatformIDs){
if ((regs_leaf1[0]>>4) == intelSpecifiedPlatform){
for (int intelSpecifiedPlatform : kVendorID_IntelSpecifiedPlatformIDs) {
if ((regs_leaf1[0] >> 4) == intelSpecifiedPlatform) {
isIntelSpecifiedPlatform = true;
}
}
Expand Down

0 comments on commit 3a1dd1d

Please sign in to comment.