[Openmp-commits] [openmp] 690c929 - [OpenMP][AIX] Use syssmt() to get the number of SMTs per physical CPU (#89985)

via Openmp-commits openmp-commits at lists.llvm.org
Fri Apr 26 10:23:37 PDT 2024


Author: Xing Xue
Date: 2024-04-26T13:23:33-04:00
New Revision: 690c929b6c68b4cd0ff314a0a88d3b218d46db2d

URL: https://github.com/llvm/llvm-project/commit/690c929b6c68b4cd0ff314a0a88d3b218d46db2d
DIFF: https://github.com/llvm/llvm-project/commit/690c929b6c68b4cd0ff314a0a88d3b218d46db2d.diff

LOG: [OpenMP][AIX] Use syssmt() to get the number of SMTs per physical CPU (#89985)

This patch changes to use system call `syssmt()` instead of
`lpar_get_info()` to get the number of SMTs (logical processors) per
physical processor for AIX. `lpar_get_info()` gives the max number of
SMTs that the physical processor can support while `syssmt()` returns
the number that is currently configured.

Added: 
    

Modified: 
    openmp/runtime/src/kmp_affinity.cpp
    openmp/runtime/src/kmp_affinity.h

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index 378e5aa296c41a..f34e55555545f3 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -3038,15 +3038,7 @@ static bool __kmp_affinity_create_cpuinfo_map(int *line,
     KMP_INFORM(AffParseFilename, "KMP_AFFINITY", "system info for topology");
 
   // Get the number of SMT threads per core.
-  int retval =
-      lpar_get_info(LPAR_INFO_FORMAT1, &cpuinfo, sizeof(lpar_info_format1_t));
-  if (!retval)
-    smt_threads = cpuinfo.smt_threads;
-  else {
-    CLEANUP_THREAD_INFO;
-    *msg_id = kmp_i18n_str_UnknownTopology;
-    return false;
-  }
+  smt_threads = syssmt(GET_NUMBER_SMT_SETS, 0, 0, NULL);
 
   // Allocate a resource set containing available system resourses.
   rsethandle_t sys_rset = rs_alloc(RS_SYSTEM);

diff  --git a/openmp/runtime/src/kmp_affinity.h b/openmp/runtime/src/kmp_affinity.h
index 8e9e7667eb904e..3dc2c84d53f773 100644
--- a/openmp/runtime/src/kmp_affinity.h
+++ b/openmp/runtime/src/kmp_affinity.h
@@ -322,6 +322,8 @@ class KMPHwlocAffinity : public KMPAffinity {
 #include <sys/dr.h>
 #include <sys/rset.h>
 #define VMI_MAXRADS 64 // Maximum number of RADs allowed by AIX.
+#define GET_NUMBER_SMT_SETS 0x0004
+extern "C" int syssmt(int flags, int, int, int *);
 #endif
 class KMPNativeAffinity : public KMPAffinity {
   class Mask : public KMPAffinity::Mask {


        


More information about the Openmp-commits mailing list