| 345 | } |
| 346 | |
| 347 | int CPUIDNumSMT() { |
| 348 | #ifdef PLATFORM_IS_X86 |
| 349 | // https://software.intel.com/en-us/articles/intel-64-architecture-processor-topology-enumeration |
| 350 | // https://software.intel.com/en-us/articles/intel-sdm (Vol 3A) |
| 351 | // Section: Detecting Hardware Multi-threads Support and Topology |
| 352 | // Uses CPUID Leaf 11 to enumerate system topology on Intel x86 architectures |
| 353 | // Other cases not supported |
| 354 | uint32 eax, ebx, ecx, edx; |
| 355 | // Check if system supports Leaf 11 |
| 356 | GETCPUID(eax, ebx, ecx, edx, 0, 0); |
| 357 | if (eax >= 11) { |
| 358 | // 1) Leaf 11 available? CPUID.(EAX=11, ECX=0):EBX != 0 |
| 359 | // 2) SMT_Mask_Width = CPUID.(EAX=11, ECX=0):EAX[4:0] if CPUID.(EAX=11, |
| 360 | // ECX=0):ECX[15:8] is 1 |
| 361 | GETCPUID(eax, ebx, ecx, edx, 11, 0); |
| 362 | if (ebx != 0 && ((ecx & 0xff00) >> 8) == 1) { |
| 363 | return 1 << (eax & 0x1f); // 2 ^ SMT_Mask_Width |
| 364 | } |
| 365 | } |
| 366 | #endif // PLATFORM_IS_X86 |
| 367 | return 0; |
| 368 | } |
| 369 | |
| 370 | } // namespace port |
| 371 | } // namespace tensorflow |
no outgoing calls
no test coverage detected