[Openmp-commits] [openmp] r269642 - Clean all the mess around KMP_USE_FUTEX and kmp_lock.h
Paul Osmialowski via Openmp-commits
openmp-commits at lists.llvm.org
Mon May 16 02:44:12 PDT 2016
Author: pawosm01
Date: Mon May 16 04:44:11 2016
New Revision: 269642
URL: http://llvm.org/viewvc/llvm-project?rev=269642&view=rev
Log:
Clean all the mess around KMP_USE_FUTEX and kmp_lock.h
KMP_USE_FUTEX preprocessor definition defined in kmp_lock.h is used
inconsequently throughout LLVM libomp code.
* some .c files that use this define do not include kmp_lock.h file,
in effect guarded part of code are never compiled
* some places in code use architecture-depending preprocessor
logic expressions which effectively disable use of Futex for
AArch64 architecture, all these places should use
'#if KMP_USE_FUTEX' instead to avoid any further confusions
* some places use KMP_HAS_FUTEX which is nowhere defined,
KMP_USE_FUTEX should be used instead
Differential Revision: http://reviews.llvm.org/D19629
Modified:
openmp/trunk/runtime/src/kmp.h
openmp/trunk/runtime/src/kmp_csupport.c
openmp/trunk/runtime/src/kmp_lock.cpp
openmp/trunk/runtime/src/kmp_settings.c
openmp/trunk/runtime/src/z_Linux_util.c
Modified: openmp/trunk/runtime/src/kmp.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp.h?rev=269642&r1=269641&r2=269642&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp.h (original)
+++ openmp/trunk/runtime/src/kmp.h Mon May 16 04:44:11 2016
@@ -3132,11 +3132,11 @@ extern void __kmp_balanced_affinity( int
extern void __kmp_cleanup_hierarchy();
extern void __kmp_get_hierarchy(kmp_uint32 nproc, kmp_bstate_t *thr_bar);
-#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
+#if KMP_USE_FUTEX
extern int __kmp_futex_determine_capable( void );
-#endif // KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
+#endif // KMP_USE_FUTEX
extern void __kmp_gtid_set_specific( int gtid );
extern int __kmp_gtid_get_specific( void );
Modified: openmp/trunk/runtime/src/kmp_csupport.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_csupport.c?rev=269642&r1=269641&r2=269642&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_csupport.c (original)
+++ openmp/trunk/runtime/src/kmp_csupport.c Mon May 16 04:44:11 2016
@@ -17,6 +17,7 @@
#include "kmp.h"
#include "kmp_i18n.h"
#include "kmp_itt.h"
+#include "kmp_lock.h"
#include "kmp_error.h"
#include "kmp_stats.h"
Modified: openmp/trunk/runtime/src/kmp_lock.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_lock.cpp?rev=269642&r1=269641&r2=269642&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_lock.cpp (original)
+++ openmp/trunk/runtime/src/kmp_lock.cpp Mon May 16 04:44:11 2016
@@ -21,7 +21,7 @@
#include "kmp_lock.h"
#include "kmp_io.h"
-#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
+#if KMP_USE_FUTEX
# include <unistd.h>
# include <sys/syscall.h>
// We should really include <futex.h>, but that causes compatibility problems on different
@@ -362,7 +362,7 @@ __kmp_destroy_nested_tas_lock_with_check
}
-#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
+#if KMP_USE_FUTEX
/* ------------------------------------------------------------------------ */
/* futex locks */
@@ -710,7 +710,7 @@ __kmp_destroy_nested_futex_lock_with_che
__kmp_destroy_nested_futex_lock( lck );
}
-#endif // KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM)
+#endif // KMP_USE_FUTEX
/* ------------------------------------------------------------------------ */
@@ -3496,7 +3496,7 @@ __kmp_get_user_lock_owner(kmp_user_lock_
case lockseq_tas:
case lockseq_nested_tas:
return __kmp_get_tas_lock_owner((kmp_tas_lock_t *)lck);
-#if KMP_HAS_FUTEX
+#if KMP_USE_FUTEX
case lockseq_futex:
case lockseq_nested_futex:
return __kmp_get_futex_lock_owner((kmp_futex_lock_t *)lck);
@@ -3721,7 +3721,7 @@ void __kmp_set_user_lock_vptrs( kmp_lock
}
break;
-#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM)
+#if KMP_USE_FUTEX
case lk_futex: {
__kmp_base_user_lock_size = sizeof( kmp_base_futex_lock_t );
@@ -3761,7 +3761,7 @@ void __kmp_set_user_lock_vptrs( kmp_lock
}
break;
-#endif // KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM)
+#endif // KMP_USE_FUTEX
case lk_ticket: {
__kmp_base_user_lock_size = sizeof( kmp_base_ticket_lock_t );
Modified: openmp/trunk/runtime/src/kmp_settings.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_settings.c?rev=269642&r1=269641&r2=269642&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_settings.c (original)
+++ openmp/trunk/runtime/src/kmp_settings.c Mon May 16 04:44:11 2016
@@ -21,6 +21,7 @@
#include "kmp_str.h"
#include "kmp_settings.h"
#include "kmp_i18n.h"
+#include "kmp_lock.h"
#include "kmp_io.h"
static int __kmp_env_toPrint( char const * name, int flag );
@@ -3924,7 +3925,7 @@ __kmp_stg_parse_lock_kind( char const *
__kmp_user_lock_kind = lk_tas;
KMP_STORE_LOCK_SEQ(tas);
}
-#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM)
+#if KMP_USE_FUTEX
else if ( __kmp_str_match( "futex", 1, value ) ) {
if ( __kmp_futex_determine_capable() ) {
__kmp_user_lock_kind = lk_futex;
@@ -3998,7 +3999,7 @@ __kmp_stg_print_lock_kind( kmp_str_buf_t
value = "tas";
break;
-#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64)
+#if KMP_USE_FUTEX
case lk_futex:
value = "futex";
break;
Modified: openmp/trunk/runtime/src/z_Linux_util.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/z_Linux_util.c?rev=269642&r1=269641&r2=269642&view=diff
==============================================================================
--- openmp/trunk/runtime/src/z_Linux_util.c (original)
+++ openmp/trunk/runtime/src/z_Linux_util.c Mon May 16 04:44:11 2016
@@ -18,6 +18,7 @@
#include "kmp_itt.h"
#include "kmp_str.h"
#include "kmp_i18n.h"
+#include "kmp_lock.h"
#include "kmp_io.h"
#include "kmp_stats.h"
#include "kmp_wait_release.h"
@@ -34,7 +35,7 @@
#if KMP_OS_LINUX && !KMP_OS_CNK
# include <sys/sysinfo.h>
-# if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
+# if KMP_USE_FUTEX
// We should really include <futex.h>, but that causes compatibility problems on different
// Linux* OS distributions that either require that you include (or break when you try to include)
// <pci/types.h>.
@@ -422,7 +423,7 @@ __kmp_affinity_determine_capable(const c
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
-#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64) && !KMP_OS_CNK
+#if KMP_USE_FUTEX && !KMP_OS_CNK
int
__kmp_futex_determine_capable()
@@ -439,7 +440,7 @@ __kmp_futex_determine_capable()
return retval;
}
-#endif // KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM) && !KMP_OS_CNK
+#endif // KMP_USE_FUTEX && !KMP_OS_CNK
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
More information about the Openmp-commits
mailing list