aboutsummaryrefslogtreecommitdiff
path: root/openmp
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2023-07-06 12:31:47 -0500
committerJonathan Peyton <jonathan.l.peyton@intel.com>2023-07-06 12:35:34 -0500
commit05e2bc25e85a904e45663584167d575580834396 (patch)
treee2110afc354411ff660f894c77c9ccc297496717 /openmp
parentb7d36a1a1e0ebf995381e36464abf52e95b76779 (diff)
downloadllvm-05e2bc25e85a904e45663584167d575580834396.zip
llvm-05e2bc25e85a904e45663584167d575580834396.tar.gz
llvm-05e2bc25e85a904e45663584167d575580834396.tar.bz2
[OpenMP] Ensure socket layer is not first in CPUID topology detection
* Return 0 length topology if socket layer is detected first * Fix DEBUG ASSERT
Diffstat (limited to 'openmp')
-rw-r--r--openmp/runtime/src/kmp_affinity.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index 31e9a19..eead5bd 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;
}