[Openmp-commits] [PATCH] D11158: Fix machine topology pruning.

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Tue Aug 25 11:45:42 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL245966: Fix machine topology pruning. (authored by jlpeyton).

Changed prior to commit:
  http://reviews.llvm.org/D11158?vs=29602&id=33097#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11158

Files:
  openmp/trunk/runtime/src/kmp_affinity.cpp

Index: openmp/trunk/runtime/src/kmp_affinity.cpp
===================================================================
--- openmp/trunk/runtime/src/kmp_affinity.cpp
+++ openmp/trunk/runtime/src/kmp_affinity.cpp
@@ -1791,24 +1791,26 @@
             new_retval[proc] = AddrUnsPair(addr, retval[proc].second);
         }
         int new_level = 0;
+        int newPkgLevel = -1;
+        int newCoreLevel = -1;
+        int newThreadLevel = -1;
+        int i;
         for (level = 0; level < depth; level++) {
-            if ((maxCt[level] == 1) && (level != pkgLevel)) {
-               if (level == threadLevel) {
-                   threadLevel = -1;
-               }
-               else if ((threadLevel >= 0) && (level < threadLevel)) {
-                   threadLevel--;
-               }
-               if (level == coreLevel) {
-                   coreLevel = -1;
-               }
-               else if ((coreLevel >= 0) && (level < coreLevel)) {
-                   coreLevel--;
-               }
-               if (level < pkgLevel) {
-                   pkgLevel--;
-               }
-               continue;
+            if ((maxCt[level] == 1)
+              && (level != pkgLevel)) {
+                //
+                // Remove this level. Never remove the package level
+                //
+                continue;
+            }
+            if (level == pkgLevel) {
+                newPkgLevel = level;
+            }
+            if (level == coreLevel) {
+                newCoreLevel = level;
+            }
+            if (level == threadLevel) {
+                newThreadLevel = level;
             }
             for (proc = 0; (int)proc < nApics; proc++) {
                 new_retval[proc].first.labels[new_level]
@@ -1820,6 +1822,9 @@
         __kmp_free(retval);
         retval = new_retval;
         depth = new_depth;
+        pkgLevel = newPkgLevel;
+        coreLevel = newCoreLevel;
+        threadLevel = newThreadLevel;
     }
 
     if (__kmp_affinity_gran_levels < 0) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11158.33097.patch
Type: text/x-patch
Size: 2022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20150825/4968e9e5/attachment.bin>


More information about the Openmp-commits mailing list