[Openmp-commits] [openmp] [OpenMP] Sort topology after adding processor group layer. (PR #83943)

via Openmp-commits openmp-commits at lists.llvm.org
Tue Mar 12 11:15:52 PDT 2024


https://github.com/MessyHack updated https://github.com/llvm/llvm-project/pull/83943

>From 1ad27f9dca08a631960de794b0480a5e192f9b7e Mon Sep 17 00:00:00 2001
From: MessyHack <messyhack at gmail.com>
Date: Mon, 4 Mar 2024 17:16:13 -0800
Subject: [PATCH] [OpenMP] Sort topology after adding processor group layer.

Various behavior around creating affinity masks and detecting uniform topology
depends on the topology being sorted.

resort topology after adding processor group layer to ensure
that the updated topology reflects the newly added processor group info.

Observed that the topology was not sorted correctly on high core count
AMD Epyc Genoa (2 sockets, 96 cores, 2 threads) using NUMA (NPS 2+).
---
 openmp/runtime/src/kmp_affinity.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index 6a41d34b023729..8fa2ed6a7a9af4 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -327,6 +327,9 @@ void kmp_topology_t::_insert_windows_proc_groups() {
   KMP_CPU_FREE(mask);
   _insert_layer(KMP_HW_PROC_GROUP, ids);
   __kmp_free(ids);
+
+  // sort topology after adding proc groups
+  __kmp_topology->sort_ids();
 }
 #endif
 



More information about the Openmp-commits mailing list