diff options
author | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2023-07-06 12:31:47 -0500 |
---|---|---|
committer | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2023-07-06 12:35:34 -0500 |
commit | 05e2bc25e85a904e45663584167d575580834396 (patch) | |
tree | e2110afc354411ff660f894c77c9ccc297496717 /openmp | |
parent | b7d36a1a1e0ebf995381e36464abf52e95b76779 (diff) | |
download | llvm-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.cpp | 6 |
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; } |