[Openmp-commits] [PATCH] D142152: [OpenMP][libomp] Insert correct HWLOC version guards

Jonathan Peyton via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jan 19 12:32:02 PST 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG3a362a9f38b9: [OpenMP][libomp] Insert correct HWLOC version guards (authored by ggouaillardet, committed by jlpeyton).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142152

Files:
  openmp/runtime/src/kmp_affinity.cpp


Index: openmp/runtime/src/kmp_affinity.cpp
===================================================================
--- openmp/runtime/src/kmp_affinity.cpp
+++ openmp/runtime/src/kmp_affinity.cpp
@@ -1604,6 +1604,7 @@
   case HWLOC_OBJ_PU:
     return KMP_HW_THREAD;
   case HWLOC_OBJ_GROUP:
+#if HWLOC_API_VERSION >= 0x00020000
     if (obj->attr->group.kind == HWLOC_GROUP_KIND_INTEL_DIE)
       return KMP_HW_DIE;
     else if (obj->attr->group.kind == HWLOC_GROUP_KIND_INTEL_TILE)
@@ -1612,6 +1613,7 @@
       return KMP_HW_MODULE;
     else if (obj->attr->group.kind == HWLOC_GROUP_KIND_WINDOWS_PROCESSOR_GROUP)
       return KMP_HW_PROC_GROUP;
+#endif
     return KMP_HW_UNKNOWN;
 #if HWLOC_API_VERSION >= 0x00020100
   case HWLOC_OBJ_DIE:
@@ -1701,6 +1703,7 @@
     return true;
   }
 
+#if HWLOC_API_VERSION >= 0x00020400
   // Handle multiple types of cores if they exist on the system
   int nr_cpu_kinds = hwloc_cpukinds_get_nr(tp, 0);
 
@@ -1739,6 +1742,7 @@
       }
     }
   }
+#endif
 
   root = hwloc_get_root_obj(tp);
 
@@ -1800,6 +1804,7 @@
       hw_thread.ids[index] = pu->logical_index;
       hw_thread.os_id = pu->os_index;
       // If multiple core types, then set that attribute for the hardware thread
+#if HWLOC_API_VERSION >= 0x00020400
       if (cpukinds) {
         int cpukind_index = -1;
         for (int i = 0; i < nr_cpu_kinds; ++i) {
@@ -1813,6 +1818,7 @@
           hw_thread.attrs.set_core_eff(cpukinds[cpukind_index].efficiency);
         }
       }
+#endif
       index--;
     }
     obj = pu;
@@ -1857,12 +1863,14 @@
       hw_thread_index++;
   }
 
+#if HWLOC_API_VERSION >= 0x00020400
   // Free the core types information
   if (cpukinds) {
     for (int idx = 0; idx < nr_cpu_kinds; ++idx)
       hwloc_bitmap_free(cpukinds[idx].mask);
     __kmp_free(cpukinds);
   }
+#endif
   __kmp_topology->sort_ids();
   return true;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142152.490631.patch
Type: text/x-patch
Size: 1870 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230119/e302cc66/attachment.bin>


More information about the Openmp-commits mailing list