[Openmp-commits] [openmp] 05e2bc2 - [OpenMP] Ensure socket layer is not first in CPUID topology detection
Jonathan Peyton via Openmp-commits
openmp-commits at lists.llvm.org
Thu Jul 6 10:36:32 PDT 2023
Author: Jonathan Peyton
Date: 2023-07-06T12:35:34-05:00
New Revision: 05e2bc25e85a904e45663584167d575580834396
URL: https://github.com/llvm/llvm-project/commit/05e2bc25e85a904e45663584167d575580834396
DIFF: https://github.com/llvm/llvm-project/commit/05e2bc25e85a904e45663584167d575580834396.diff
LOG: [OpenMP] Ensure socket layer is not first in CPUID topology detection
* Return 0 length topology if socket layer is detected first
* Fix DEBUG ASSERT
Added:
Modified:
openmp/runtime/src/kmp_affinity.cpp
Removed:
################################################################################
diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index 31e9a19c47fcd7..eead5bdfb9e4fa 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -2509,6 +2509,10 @@ __kmp_x2apicid_get_levels(int leaf,
level++;
} while (level_type != INTEL_LEVEL_TYPE_INVALID);
+ // Ensure the INTEL_LEVEL_TYPE_INVALID (Socket) layer isn't first
+ if (levels_index == 0 || levels[0].level_type == INTEL_LEVEL_TYPE_INVALID)
+ return 0;
+
// Set the masks to & with apicid
for (unsigned i = 0; i < levels_index; ++i) {
if (levels[i].level_type != INTEL_LEVEL_TYPE_INVALID) {
@@ -2517,7 +2521,7 @@ __kmp_x2apicid_get_levels(int leaf,
for (unsigned j = 0; j < i; ++j)
levels[i].mask ^= levels[j].mask;
} else {
- KMP_DEBUG_ASSERT(levels_index > 0);
+ KMP_DEBUG_ASSERT(i > 0);
levels[i].mask = (-1) << levels[i - 1].mask_width;
levels[i].cache_mask = 0;
}
More information about the Openmp-commits
mailing list