[Openmp-commits] [openmp] [OpenMP] Fix logic to get first osid with e-core (hybrid system) (PR #97120)

via Openmp-commits openmp-commits at lists.llvm.org
Fri Jun 28 15:18:27 PDT 2024


https://github.com/nawrinsu created https://github.com/llvm/llvm-project/pull/97120

None

>From 06e0c92a1f88f503e55c7bf98c5e180335f2d498 Mon Sep 17 00:00:00 2001
From: Nawrin Sultana <nawrin.sultana at intel.com>
Date: Fri, 28 Jun 2024 17:13:36 -0500
Subject: [PATCH] [OpenMP] Fix logic to get first osid with e-core (hybrid
 system)

---
 openmp/runtime/src/kmp_affinity.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index f34e55555545f..b49047c2bbf38 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -5419,7 +5419,7 @@ int __kmp_get_first_osid_with_ecore(void) {
   int low = 0;
   int high = __kmp_topology->get_num_hw_threads() - 1;
   int mid = 0;
-  while (high - low > 1) {
+  while (high > low) {
     mid = (high + low) / 2;
     if (__kmp_topology->at(mid).attrs.get_core_type() ==
         KMP_HW_CORE_TYPE_CORE) {
@@ -5428,8 +5428,8 @@ int __kmp_get_first_osid_with_ecore(void) {
       high = mid;
     }
   }
-  if (__kmp_topology->at(mid).attrs.get_core_type() == KMP_HW_CORE_TYPE_ATOM) {
-    return mid;
+  if (__kmp_topology->at(low).attrs.get_core_type() == KMP_HW_CORE_TYPE_ATOM) {
+    return low;
   }
   return -1;
 }



More information about the Openmp-commits mailing list