[Openmp-commits] [PATCH] D11158: Fix machine topology pruning.
Jonathan Peyton
jonathan.l.peyton at intel.com
Mon Jul 13 13:52:24 PDT 2015
jlpeyton created this revision.
jlpeyton added a reviewer: hfinkel.
jlpeyton added subscribers: llvm-commits, openmp-commits, brianbliss.
jlpeyton set the repository for this revision to rL LLVM.
This patch fixes a bug when eliminating layers in the machine topology (namely cores, and threads). Before this patch, if a user specifies using only one thread per socket, then affinity is not set properly due to bad topology pruning.
Repository:
rL LLVM
http://reviews.llvm.org/D11158
Files:
runtime/src/kmp_affinity.cpp
Index: runtime/src/kmp_affinity.cpp
===================================================================
--- runtime/src/kmp_affinity.cpp
+++ runtime/src/kmp_affinity.cpp
@@ -1791,24 +1791,26 @@
new_retval[proc] = AddrUnsPair(addr, retval[proc].second);
}
int new_level = 0;
+ int newPkgLevel = -1;
+ int newCoreLevel = -1;
+ int newThreadLevel = -1;
+ int i;
for (level = 0; level < depth; level++) {
- if ((maxCt[level] == 1) && (level != pkgLevel)) {
- if (level == threadLevel) {
- threadLevel = -1;
- }
- else if ((threadLevel >= 0) && (level < threadLevel)) {
- threadLevel--;
- }
- if (level == coreLevel) {
- coreLevel = -1;
- }
- else if ((coreLevel >= 0) && (level < coreLevel)) {
- coreLevel--;
- }
- if (level < pkgLevel) {
- pkgLevel--;
- }
- continue;
+ if ((maxCt[level] == 1)
+ && (level != pkgLevel)) {
+ //
+ // Remove this level. Never remove the package level
+ //
+ continue;
+ }
+ if (level == pkgLevel) {
+ newPkgLevel = level;
+ }
+ if (level == coreLevel) {
+ newCoreLevel = level;
+ }
+ if (level == threadLevel) {
+ newThreadLevel = level;
}
for (proc = 0; (int)proc < nApics; proc++) {
new_retval[proc].first.labels[new_level]
@@ -1820,6 +1822,9 @@
__kmp_free(retval);
retval = new_retval;
depth = new_depth;
+ pkgLevel = newPkgLevel;
+ coreLevel = newCoreLevel;
+ threadLevel = newThreadLevel;
}
if (__kmp_affinity_gran_levels < 0) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11158.29602.patch
Type: text/x-patch
Size: 1983 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20150713/9c1ea8eb/attachment.bin>
More information about the Openmp-commits
mailing list