[Openmp-commits] [PATCH] D23203: Fixed x2APIC discovery for 256-processor architectures

Andrey Churbanov via Openmp-commits openmp-commits at lists.llvm.org
Fri Aug 5 06:45:47 PDT 2016


AndreyChurbanov created this revision.
AndreyChurbanov added reviewers: tlwilmar, jlpeyton.
AndreyChurbanov added a subscriber: openmp-commits.
AndreyChurbanov set the repository for this revision to rL LLVM.

CPUID returns values in bits 0-15 of ebx those were mistakenly masked by 0xFF reading only bits 0-7. Thus on 256-processor architecture we got value 0 that is wrong.  Masking by 0xFFFF fixes the problem.


Repository:
  rL LLVM

https://reviews.llvm.org/D23203

Files:
  runtime/src/kmp_affinity.cpp

Index: runtime/src/kmp_affinity.cpp
===================================================================
--- runtime/src/kmp_affinity.cpp
+++ runtime/src/kmp_affinity.cpp
@@ -1429,7 +1429,7 @@
             threadLevel = level;
             coreLevel = -1;
             pkgLevel = -1;
-            __kmp_nThreadsPerCore = buf.ebx & 0xff;
+            __kmp_nThreadsPerCore = buf.ebx & 0xffff;
             if (__kmp_nThreadsPerCore == 0) {
                 *msg_id = kmp_i18n_str_InvalidCpuidInfo;
                 return -1;
@@ -1441,7 +1441,7 @@
             //
             coreLevel = level;
             pkgLevel = -1;
-            nCoresPerPkg = buf.ebx & 0xff;
+            nCoresPerPkg = buf.ebx & 0xffff;
             if (nCoresPerPkg == 0) {
                 *msg_id = kmp_i18n_str_InvalidCpuidInfo;
                 return -1;
@@ -1456,7 +1456,7 @@
                 continue;
             }
             pkgLevel = level;
-            nPackages = buf.ebx & 0xff;
+            nPackages = buf.ebx & 0xffff;
             if (nPackages == 0) {
                 *msg_id = kmp_i18n_str_InvalidCpuidInfo;
                 return -1;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23203.66941.patch
Type: text/x-patch
Size: 1136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20160805/0f8d1761/attachment-0001.bin>


More information about the Openmp-commits mailing list