summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src
diff options
context:
space:
mode:
authorJonas Hahnfeld <hahnjo@hahnjo.de>2017-12-08 15:07:05 +0000
committerJonas Hahnfeld <hahnjo@hahnjo.de>2017-12-08 15:07:05 +0000
commitce528acf0d04d80b3a284ba3c2dd281ce706e15e (patch)
tree16a7b5fbc20c990b445c8369d6fa871029459177 /openmp/runtime/src
parent86c307821c8d6fab396136b55ab8fb479238bc69 (diff)
downloadbcm5719-llvm-ce528acf0d04d80b3a284ba3c2dd281ce706e15e.tar.gz
bcm5719-llvm-ce528acf0d04d80b3a284ba3c2dd281ce706e15e.zip
Fix thread affinity on non-x86 Linux
To make thread affinity work according to the OpenMP spec, the runtime needs information about the hardware topology. On Linux the default way is to parse /proc/cpuinfo which contains this information for x86 machines but (at least) not for AArch64 and Power architectures. Fortunately, there is a different code path which is able to get that data from sysfs. The needed patch has landed in 2006 for Linux 2.6.16 which is safe to assume nowadays (even RHEL 5 had a kernel version derived from 2.6.18, and we are now at RHEL 7!). Differential Revision: https://reviews.llvm.org/D40357 llvm-svn: 320151
Diffstat (limited to 'openmp/runtime/src')
-rw-r--r--openmp/runtime/src/kmp_affinity.cpp2
-rw-r--r--openmp/runtime/src/kmp_os.h5
2 files changed, 2 insertions, 5 deletions
diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index c2813970a12..d7a0eda0d92 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -2030,7 +2030,7 @@ static int __kmp_affinity_create_cpuinfo_map(AddrUnsPair **address2os,
if (threadInfo[num_avail][osIdIndex] != UINT_MAX)
goto dup_field;
threadInfo[num_avail][osIdIndex] = val;
-#if KMP_OS_LINUX && USE_SYSFS_INFO
+#if KMP_OS_LINUX && !(KMP_ARCH_X86 || KMP_ARCH_X86_64)
char path[256];
KMP_SNPRINTF(
path, sizeof(path),
diff --git a/openmp/runtime/src/kmp_os.h b/openmp/runtime/src/kmp_os.h
index 79b3fe2f31e..fbd3513a42f 100644
--- a/openmp/runtime/src/kmp_os.h
+++ b/openmp/runtime/src/kmp_os.h
@@ -61,7 +61,7 @@
#error Unknown compiler
#endif
-#if (KMP_OS_LINUX || KMP_OS_WINDOWS) && !KMP_OS_CNK && !KMP_ARCH_PPC64
+#if (KMP_OS_LINUX || KMP_OS_WINDOWS) && !KMP_OS_CNK
#define KMP_AFFINITY_SUPPORTED 1
#if KMP_OS_WINDOWS && KMP_ARCH_X86_64
#define KMP_GROUP_AFFINITY 1
@@ -859,9 +859,6 @@ typedef void (*microtask_t)(int *gtid, int *npr, ...);
#endif
// Switches for OSS builds
-#ifndef USE_SYSFS_INFO
-#define USE_SYSFS_INFO 0
-#endif
#ifndef USE_CMPXCHG_FIX
#define USE_CMPXCHG_FIX 1
#endif
OpenPOWER on IntegriCloud