[Openmp-commits] [openmp] r264535 - Fixing the non-x86 build by removing dependence on kmp_cpuid_t
Hal Finkel via Openmp-commits
openmp-commits at lists.llvm.org
Sun Mar 27 06:24:11 PDT 2016
Author: hfinkel
Date: Sun Mar 27 08:24:09 2016
New Revision: 264535
URL: http://llvm.org/viewvc/llvm-project?rev=264535&view=rev
Log:
Fixing the non-x86 build by removing dependence on kmp_cpuid_t
The problem is that the definition of kmp_cpuinfo_t contains:
char name [3*sizeof (kmp_cpuid_t)]; // CPUID(0x80000002,0x80000003,0x80000004)
and kmp_cpuid_t is only defined when compiling for x86.
Differential Revision: http://reviews.llvm.org/D18245
Modified:
openmp/trunk/runtime/src/kmp.h
openmp/trunk/runtime/src/kmp_csupport.c
openmp/trunk/runtime/src/kmp_global.c
Modified: openmp/trunk/runtime/src/kmp.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp.h?rev=264535&r1=264534&r2=264535&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp.h (original)
+++ openmp/trunk/runtime/src/kmp.h Sun Mar 27 08:24:09 2016
@@ -1228,6 +1228,7 @@ typedef struct kmp_sys_info {
long nivcsw; /* the number of times a context switch was forced */
} kmp_sys_info_t;
+#if KMP_ARCH_X86 || KMP_ARCH_X86_64
typedef struct kmp_cpuinfo {
int initialized; // If 0, other fields are not initialized.
int signature; // CPUID(1).EAX
@@ -1243,7 +1244,7 @@ typedef struct kmp_cpuinfo {
kmp_uint64 frequency; // Nominal CPU frequency in Hz.
char name [3*sizeof (kmp_cpuid_t)]; // CPUID(0x80000002,0x80000003,0x80000004)
} kmp_cpuinfo_t;
-
+#endif
#ifdef BUILD_TV
@@ -2666,7 +2667,9 @@ extern int __kmp_storage_map;
extern int __kmp_storage_map_verbose; /* True means storage map includes placement info */
extern int __kmp_storage_map_verbose_specified;
+#if KMP_ARCH_X86 || KMP_ARCH_X86_64
extern kmp_cpuinfo_t __kmp_cpuinfo;
+#endif
extern volatile int __kmp_init_serial;
extern volatile int __kmp_init_gtid;
Modified: openmp/trunk/runtime/src/kmp_csupport.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_csupport.c?rev=264535&r1=264534&r2=264535&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_csupport.c (original)
+++ openmp/trunk/runtime/src/kmp_csupport.c Sun Mar 27 08:24:09 2016
@@ -1174,13 +1174,20 @@ __kmp_map_hint_to_lock(uintptr_t hint)
#else
# define KMP_TSX_LOCK(seq) __kmp_user_lock_seq
#endif
+
+#if KMP_ARCH_X86 || KMP_ARCH_X86_64
+# define KMP_CPUINFO_RTM (__kmp_cpuinfo.rtm)
+#else
+# define KMP_CPUINFO_RTM 0
+#endif
+
// Hints that do not require further logic
if (hint & kmp_lock_hint_hle)
return KMP_TSX_LOCK(hle);
if (hint & kmp_lock_hint_rtm)
- return (__kmp_cpuinfo.rtm)? KMP_TSX_LOCK(rtm): __kmp_user_lock_seq;
+ return KMP_CPUINFO_RTM ? KMP_TSX_LOCK(rtm): __kmp_user_lock_seq;
if (hint & kmp_lock_hint_adaptive)
- return (__kmp_cpuinfo.rtm)? KMP_TSX_LOCK(adaptive): __kmp_user_lock_seq;
+ return KMP_CPUINFO_RTM ? KMP_TSX_LOCK(adaptive): __kmp_user_lock_seq;
// Rule out conflicting hints first by returning the default lock
if ((hint & omp_lock_hint_contended) && (hint & omp_lock_hint_uncontended))
Modified: openmp/trunk/runtime/src/kmp_global.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_global.c?rev=264535&r1=264534&r2=264535&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_global.c (original)
+++ openmp/trunk/runtime/src/kmp_global.c Sun Mar 27 08:24:09 2016
@@ -17,7 +17,9 @@
kmp_key_t __kmp_gtid_threadprivate_key;
+#if KMP_ARCH_X86 || KMP_ARCH_X86_64
kmp_cpuinfo_t __kmp_cpuinfo = { 0 }; // Not initialized
+#endif
#if KMP_STATS_ENABLED
#include "kmp_stats.h"
More information about the Openmp-commits
mailing list