[PATCH] D61796: Fix hwloc topology traversal code unable to handle situation where L2 cache is common for the packages

Paul Osmialowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 06:16:06 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL360890: Fix hwloc topology traversal code unable to handle situation where L2 cache is… (authored by pawosm01, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D61796?vs=199044&id=199806#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61796/new/

https://reviews.llvm.org/D61796

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
@@ -530,7 +530,7 @@
 static int __kmp_hwloc_check_numa() {
   hwloc_topology_t &tp = __kmp_hwloc_topology;
   hwloc_obj_t hT, hC, hL, hN, hS; // hwloc objects (pointers to)
-  int depth;
+  int depth, l2cache_depth, package_depth;
 
   // Get some PU
   hT = hwloc_get_obj_by_type(tp, HWLOC_OBJ_PU, 0);
@@ -548,8 +548,10 @@
     }
   }
 
+  package_depth = hwloc_get_type_depth(tp, HWLOC_OBJ_PACKAGE);
+  l2cache_depth = hwloc_get_cache_type_depth(tp, 2, HWLOC_OBJ_CACHE_UNIFIED);
   // check tile, get object by depth because of multiple caches possible
-  depth = hwloc_get_cache_type_depth(tp, 2, HWLOC_OBJ_CACHE_UNIFIED);
+  depth = (l2cache_depth < package_depth) ? package_depth : l2cache_depth;
   hL = hwloc_get_ancestor_obj_by_depth(tp, depth, hT);
   hC = NULL; // not used, but reset it here just in case
   if (hL != NULL &&


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61796.199806.patch
Type: text/x-patch
Size: 1046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190516/fd7a7c5e/attachment.bin>


More information about the llvm-commits mailing list