Replace platform macro with KMP_MIC_SUPPORTED
Differential Revision: https://reviews.llvm.org/D34119
llvm-svn: 305307
diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index f2f0cdc..06b4fe7 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -453,7 +453,7 @@
};
#endif /* KMP_OS_LINUX */
-#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
+#if KMP_MIC_SUPPORTED
enum mic_type { non_mic, mic1, mic2, mic3, dummy };
#endif
@@ -2940,7 +2940,7 @@
extern int __kmp_clock_function_param;
#endif /* KMP_OS_LINUX */
-#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
+#if KMP_MIC_SUPPORTED
extern enum mic_type __kmp_mic_type;
#endif
diff --git a/openmp/runtime/src/kmp_global.cpp b/openmp/runtime/src/kmp_global.cpp
index 960c4b6..93a7f65 100644
--- a/openmp/runtime/src/kmp_global.cpp
+++ b/openmp/runtime/src/kmp_global.cpp
@@ -238,7 +238,7 @@
int __kmp_clock_function_param;
#endif /* KMP_OS_LINUX */
-#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
+#if KMP_MIC_SUPPORTED
enum mic_type __kmp_mic_type = non_mic;
#endif
diff --git a/openmp/runtime/src/kmp_platform.h b/openmp/runtime/src/kmp_platform.h
index 95cebf9..800523a 100644
--- a/openmp/runtime/src/kmp_platform.h
+++ b/openmp/runtime/src/kmp_platform.h
@@ -176,6 +176,10 @@
/* Specify 32 bit architectures here */
#define KMP_32_BIT_ARCH (KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS)
+// Platforms which support Intel(R) Many Integrated Core Architecture
+#define KMP_MIC_SUPPORTED \
+ ((KMP_ARCH_X86 || KMP_ARCH_X86_64) && (KMP_OS_LINUX || KMP_OS_WINDOWS))
+
// TODO: Fixme - This is clever, but really fugly
#if (1 != \
KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64 + \
diff --git a/openmp/runtime/src/kmp_runtime.cpp b/openmp/runtime/src/kmp_runtime.cpp
index 7048b5a..4b36a87 100644
--- a/openmp/runtime/src/kmp_runtime.cpp
+++ b/openmp/runtime/src/kmp_runtime.cpp
@@ -6268,7 +6268,7 @@
// End of Library registration stuff.
// -----------------------------------------------------------------------------
-#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
+#if KMP_MIC_SUPPORTED
static void __kmp_check_mic_type() {
kmp_cpuid_t cpuid_state = {0};
@@ -6284,7 +6284,7 @@
}
}
-#endif /* KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS) */
+#endif /* KMP_MIC_SUPPORTED */
static void __kmp_do_serial_initialize(void) {
int i, gtid;
@@ -6356,7 +6356,7 @@
__kmp_runtime_initialize();
-#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
+#if KMP_MIC_SUPPORTED
__kmp_check_mic_type();
#endif
@@ -6423,7 +6423,7 @@
#undef kmp_reduction_barrier_release_bb
#undef kmp_reduction_barrier_gather_bb
#endif // KMP_FAST_REDUCTION_BARRIER
-#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
+#if KMP_MIC_SUPPORTED
if (__kmp_mic_type == mic2) { // KNC
// AC: plane=3,2, forkjoin=2,1 are optimal for 240 threads on KNC
__kmp_barrier_gather_branch_bits[bs_plain_barrier] = 3; // plain gather
@@ -6437,8 +6437,8 @@
__kmp_barrier_gather_pattern[bs_reduction_barrier] = bp_hierarchical_bar;
__kmp_barrier_release_pattern[bs_reduction_barrier] = bp_hierarchical_bar;
}
-#endif
-#endif
+#endif // KMP_FAST_REDUCTION_BARRIER
+#endif // KMP_MIC_SUPPORTED
// From KMP_CHECKS initialization
#ifdef KMP_DEBUG
@@ -7513,7 +7513,7 @@
int teamsize_cutoff = 4;
-#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
+#if KMP_MIC_SUPPORTED
if (__kmp_mic_type != non_mic) {
teamsize_cutoff = 8;
}
diff --git a/openmp/runtime/src/kmp_settings.cpp b/openmp/runtime/src/kmp_settings.cpp
index ed61a67..91b7e21 100644
--- a/openmp/runtime/src/kmp_settings.cpp
+++ b/openmp/runtime/src/kmp_settings.cpp
@@ -2173,7 +2173,7 @@
}; // if
if (__kmp_affinity_gran == affinity_gran_default) {
-#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
+#if KMP_MIC_SUPPORTED
if (__kmp_mic_type != non_mic) {
if (__kmp_affinity_verbose || __kmp_affinity_warnings) {
KMP_WARNING(AffGranUsing, "KMP_AFFINITY", "fine");
@@ -2819,7 +2819,7 @@
// OMP_PROC_BIND => granularity=fine,scatter on MIC
// OMP_PROC_BIND => granularity=core,scatter elsewhere
__kmp_affinity_type = affinity_scatter;
-#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
+#if KMP_MIC_SUPPORTED
if (__kmp_mic_type != non_mic)
__kmp_affinity_gran = affinity_gran_fine;
else
@@ -5207,7 +5207,7 @@
#endif /* OMP_40_ENABLED */
if (__kmp_affinity_type == affinity_default) {
#if OMP_40_ENABLED
-#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
+#if KMP_MIC_SUPPORTED
if (__kmp_mic_type != non_mic) {
__kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
} else
@@ -5216,7 +5216,7 @@
__kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
}
#endif /* OMP_40_ENABLED */
-#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
+#if KMP_MIC_SUPPORTED
if (__kmp_mic_type != non_mic) {
__kmp_affinity_type = affinity_scatter;
} else
@@ -5227,7 +5227,7 @@
}
if ((__kmp_affinity_gran == affinity_gran_default) &&
(__kmp_affinity_gran_levels < 0)) {
-#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
+#if KMP_MIC_SUPPORTED
if (__kmp_mic_type != non_mic) {
__kmp_affinity_gran = affinity_gran_fine;
} else