Skip to content

Commit 01bb240

Browse files
author
Hal Finkel
committedMar 27, 2016
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 llvm-svn: 264535
1 parent cb34bd3 commit 01bb240

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed
 

‎openmp/runtime/src/kmp.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,6 +1228,7 @@ typedef struct kmp_sys_info {
12281228
long nivcsw; /* the number of times a context switch was forced */
12291229
} kmp_sys_info_t;
12301230

1231+
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
12311232
typedef struct kmp_cpuinfo {
12321233
int initialized; // If 0, other fields are not initialized.
12331234
int signature; // CPUID(1).EAX
@@ -1243,7 +1244,7 @@ typedef struct kmp_cpuinfo {
12431244
kmp_uint64 frequency; // Nominal CPU frequency in Hz.
12441245
char name [3*sizeof (kmp_cpuid_t)]; // CPUID(0x80000002,0x80000003,0x80000004)
12451246
} kmp_cpuinfo_t;
1246-
1247+
#endif
12471248

12481249
#ifdef BUILD_TV
12491250

@@ -2666,7 +2667,9 @@ extern int __kmp_storage_map; /* True means print storage map for t
26662667
extern int __kmp_storage_map_verbose; /* True means storage map includes placement info */
26672668
extern int __kmp_storage_map_verbose_specified;
26682669

2670+
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
26692671
extern kmp_cpuinfo_t __kmp_cpuinfo;
2672+
#endif
26702673

26712674
extern volatile int __kmp_init_serial;
26722675
extern volatile int __kmp_init_gtid;

‎openmp/runtime/src/kmp_csupport.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,13 +1174,20 @@ __kmp_map_hint_to_lock(uintptr_t hint)
11741174
#else
11751175
# define KMP_TSX_LOCK(seq) __kmp_user_lock_seq
11761176
#endif
1177+
1178+
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
1179+
# define KMP_CPUINFO_RTM (__kmp_cpuinfo.rtm)
1180+
#else
1181+
# define KMP_CPUINFO_RTM 0
1182+
#endif
1183+
11771184
// Hints that do not require further logic
11781185
if (hint & kmp_lock_hint_hle)
11791186
return KMP_TSX_LOCK(hle);
11801187
if (hint & kmp_lock_hint_rtm)
1181-
return (__kmp_cpuinfo.rtm)? KMP_TSX_LOCK(rtm): __kmp_user_lock_seq;
1188+
return KMP_CPUINFO_RTM ? KMP_TSX_LOCK(rtm): __kmp_user_lock_seq;
11821189
if (hint & kmp_lock_hint_adaptive)
1183-
return (__kmp_cpuinfo.rtm)? KMP_TSX_LOCK(adaptive): __kmp_user_lock_seq;
1190+
return KMP_CPUINFO_RTM ? KMP_TSX_LOCK(adaptive): __kmp_user_lock_seq;
11841191

11851192
// Rule out conflicting hints first by returning the default lock
11861193
if ((hint & omp_lock_hint_contended) && (hint & omp_lock_hint_uncontended))

‎openmp/runtime/src/kmp_global.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
kmp_key_t __kmp_gtid_threadprivate_key;
1919

20+
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
2021
kmp_cpuinfo_t __kmp_cpuinfo = { 0 }; // Not initialized
22+
#endif
2123

2224
#if KMP_STATS_ENABLED
2325
#include "kmp_stats.h"

0 commit comments

Comments
 (0)
Please sign in to comment.