summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src
diff options
context:
space:
mode:
authorAndrey Churbanov <Andrey.Churbanov@intel.com>2015-01-27 16:52:57 +0000
committerAndrey Churbanov <Andrey.Churbanov@intel.com>2015-01-27 16:52:57 +0000
commit7daf9803f52427743bf09b128480f295077b3b52 (patch)
tree7342712fa2caa8e1431f39008a2b119aca8ab0e7 /openmp/runtime/src
parent42a79217a85cbd0c968ff80123e9202dc1849a01 (diff)
downloadbcm5719-llvm-7daf9803f52427743bf09b128480f295077b3b52.tar.gz
bcm5719-llvm-7daf9803f52427743bf09b128480f295077b3b52.zip
Replaces KMP_OS_WINDOWS && KMP_ARCH_X86_64 or any combination of those two options with the feature macro KMP_GROUP_AFFINITY.
llvm-svn: 227199
Diffstat (limited to 'openmp/runtime/src')
-rw-r--r--openmp/runtime/src/kmp.h12
-rw-r--r--openmp/runtime/src/kmp_affinity.cpp24
-rw-r--r--openmp/runtime/src/kmp_ftn_entry.h4
-rw-r--r--openmp/runtime/src/kmp_global.c4
-rw-r--r--openmp/runtime/src/kmp_os.h18
-rw-r--r--openmp/runtime/src/kmp_settings.c24
-rw-r--r--openmp/runtime/src/z_Windows_NT_util.c26
7 files changed, 59 insertions, 53 deletions
diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index 83ecb15fe97..a7a5e531abc 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -547,7 +547,7 @@ typedef unsigned char kmp_affin_mask_t;
// Intel(R) 64 it is 8 bytes times the number of processor groups.
//
-# if KMP_ARCH_X86_64
+# if KMP_GROUP_AFFINITY
// GROUP_AFFINITY is already defined for _MSC_VER>=1600 (VS2010 and later).
# if _MSC_VER < 1600
@@ -644,7 +644,7 @@ typedef DWORD kmp_affin_mask_t; /* for compatibility with older winbase.h */
# define KMP_CPU_COMPLEMENT(mask) (*(mask) = ~*(mask))
# define KMP_CPU_UNION(dest, src) (*(dest) |= *(src))
-# endif /* KMP_ARCH_X86 */
+# endif /* KMP_GROUP_AFFINITY */
# endif /* KMP_OS_WINDOWS */
@@ -690,13 +690,13 @@ enum affinity_gran {
affinity_gran_core,
affinity_gran_package,
affinity_gran_node,
-#if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+#if KMP_GROUP_AFFINITY
//
// The "group" granularity isn't necesssarily coarser than all of the
// other levels, but we put it last in the enum.
//
affinity_gran_group,
-#endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
+#endif /* KMP_GROUP_AFFINITY */
affinity_gran_default
};
@@ -707,9 +707,9 @@ enum affinity_top_method {
affinity_top_method_x2apicid,
#endif /* KMP_ARCH_X86 || KMP_ARCH_X86_64 */
affinity_top_method_cpuinfo, // KMP_CPUINFO_FILE is usable on Windows* OS, too
-#if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+#if KMP_GROUP_AFFINITY
affinity_top_method_group,
-#endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
+#endif /* KMP_GROUP_AFFINITY */
affinity_top_method_flat,
affinity_top_method_default
};
diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index a9338c29747..f3d0a8ce7f5 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -85,7 +85,7 @@ __kmp_affinity_entire_machine_mask(kmp_affin_mask_t *mask)
{
KMP_CPU_ZERO(mask);
-# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+# if KMP_GROUP_AFFINITY
if (__kmp_num_proc_groups > 1) {
int group;
@@ -100,7 +100,7 @@ __kmp_affinity_entire_machine_mask(kmp_affin_mask_t *mask)
}
else
-# endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
+# endif /* KMP_GROUP_AFFINITY */
{
int proc;
@@ -641,7 +641,7 @@ __kmp_affinity_create_flat_map(AddrUnsPair **address2os,
}
-# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+# if KMP_GROUP_AFFINITY
//
// If multiple Windows* OS processor groups exist, we can create a 2-level
@@ -723,7 +723,7 @@ __kmp_affinity_create_proc_group_map(AddrUnsPair **address2os,
return 2;
}
-# endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
+# endif /* KMP_GROUP_AFFINITY */
# if KMP_ARCH_X86 || KMP_ARCH_X86_64
@@ -3541,7 +3541,7 @@ __kmp_aux_affinity_initialize(void)
# endif /* KMP_OS_LINUX */
-# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+# if KMP_GROUP_AFFINITY
if ((depth < 0) && (__kmp_num_proc_groups > 1)) {
if (__kmp_affinity_verbose) {
@@ -3552,7 +3552,7 @@ __kmp_aux_affinity_initialize(void)
KMP_ASSERT(depth != 0);
}
-# endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
+# endif /* KMP_GROUP_AFFINITY */
if (depth < 0) {
if (__kmp_affinity_verbose && (msg_id != kmp_i18n_null)) {
@@ -3678,7 +3678,7 @@ __kmp_aux_affinity_initialize(void)
}
}
-# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+# if KMP_GROUP_AFFINITY
else if (__kmp_affinity_top_method == affinity_top_method_group) {
if (__kmp_affinity_verbose) {
@@ -3693,7 +3693,7 @@ __kmp_aux_affinity_initialize(void)
}
}
-# endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
+# endif /* KMP_GROUP_AFFINITY */
else if (__kmp_affinity_top_method == affinity_top_method_flat) {
if (__kmp_affinity_verbose) {
@@ -4019,7 +4019,7 @@ __kmp_affinity_set_init_mask(int gtid, int isa_root)
{
if ((__kmp_affinity_type == affinity_none) || (__kmp_affinity_type == affinity_balanced)
) {
-# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+# if KMP_GROUP_AFFINITY
if (__kmp_num_proc_groups > 1) {
return;
}
@@ -4038,7 +4038,7 @@ __kmp_affinity_set_init_mask(int gtid, int isa_root)
else {
if ((! isa_root)
|| (__kmp_nested_proc_bind.bind_types[0] == proc_bind_false)) {
-# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+# if KMP_GROUP_AFFINITY
if (__kmp_num_proc_groups > 1) {
return;
}
@@ -4206,11 +4206,11 @@ __kmp_aux_set_affinity(void **mask)
KMP_FATAL(AffinityInvalidMask, "kmp_set_affinity");
}
-# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+# if KMP_GROUP_AFFINITY
if (__kmp_get_proc_group((kmp_affin_mask_t *)(*mask)) < 0) {
KMP_FATAL(AffinityInvalidMask, "kmp_set_affinity");
}
-# endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
+# endif /* KMP_GROUP_AFFINITY */
}
}
diff --git a/openmp/runtime/src/kmp_ftn_entry.h b/openmp/runtime/src/kmp_ftn_entry.h
index 8263a657877..ba6e9c67672 100644
--- a/openmp/runtime/src/kmp_ftn_entry.h
+++ b/openmp/runtime/src/kmp_ftn_entry.h
@@ -259,11 +259,11 @@ FTN_GET_AFFINITY_MAX_PROC( void )
return 0;
}
- #if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+ #if KMP_GROUP_AFFINITY
if ( __kmp_num_proc_groups <= 1 ) {
return (int)KMP_CPU_SETSIZE;
}
- #endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
+ #endif /* KMP_GROUP_AFFINITY */
return __kmp_xproc;
#endif
}
diff --git a/openmp/runtime/src/kmp_global.c b/openmp/runtime/src/kmp_global.c
index 5f188d03c5d..1614799f85d 100644
--- a/openmp/runtime/src/kmp_global.c
+++ b/openmp/runtime/src/kmp_global.c
@@ -217,7 +217,7 @@ int __kmp_clock_function_param;
#if KMP_AFFINITY_SUPPORTED
-# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+# if KMP_GROUP_AFFINITY
int __kmp_num_proc_groups = 1;
@@ -226,7 +226,7 @@ kmp_GetActiveProcessorGroupCount_t __kmp_GetActiveProcessorGroupCount = NULL;
kmp_GetThreadGroupAffinity_t __kmp_GetThreadGroupAffinity = NULL;
kmp_SetThreadGroupAffinity_t __kmp_SetThreadGroupAffinity = NULL;
-# endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
+# endif /* KMP_GROUP_AFFINITY */
size_t __kmp_affin_mask_size = 0;
enum affinity_type __kmp_affinity_type = affinity_default;
diff --git a/openmp/runtime/src/kmp_os.h b/openmp/runtime/src/kmp_os.h
index 5b9fe0c7509..d770b32ce90 100644
--- a/openmp/runtime/src/kmp_os.h
+++ b/openmp/runtime/src/kmp_os.h
@@ -121,12 +121,6 @@
# define KMP_OS_UNIX 1
#endif
-#if (KMP_OS_LINUX || KMP_OS_WINDOWS) && !KMP_OS_CNK && !KMP_ARCH_PPC64
-# define KMP_AFFINITY_SUPPORTED 1
-#else
-# define KMP_AFFINITY_SUPPORTED 0
-#endif
-
#if KMP_OS_WINDOWS
# if defined _M_AMD64
# undef KMP_ARCH_X86_64
@@ -199,6 +193,18 @@
# error Unknown or unsupported architecture
#endif
+#if (KMP_OS_LINUX || KMP_OS_WINDOWS) && !KMP_OS_CNK && !KMP_ARCH_PPC64
+# define KMP_AFFINITY_SUPPORTED 1
+# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+# define KMP_GROUP_AFFINITY 1
+# else
+# define KMP_GROUP_AFFINITY 0
+# endif
+#else
+# define KMP_AFFINITY_SUPPORTED 0
+# define KMP_GROUP_AFFINITY 0
+#endif
+
/* Check for quad-precision extension. */
#define KMP_HAVE_QUAD 0
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
diff --git a/openmp/runtime/src/kmp_settings.c b/openmp/runtime/src/kmp_settings.c
index 53ab1d74788..2355c5f73a0 100644
--- a/openmp/runtime/src/kmp_settings.c
+++ b/openmp/runtime/src/kmp_settings.c
@@ -2192,11 +2192,11 @@ __kmp_parse_affinity_env( char const * name, char const * value,
} else if (__kmp_match_str("node", buf, (const char **)&next)) {
set_gran( affinity_gran_node, -1 );
buf = next;
-# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+# if KMP_GROUP_AFFINITY
} else if (__kmp_match_str("group", buf, (const char **)&next)) {
set_gran( affinity_gran_group, -1 );
buf = next;
-# endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
+# endif /* KMP_GROUP AFFINITY */
} else if ((*buf >= '0') && (*buf <= '9')) {
int n;
next = buf;
@@ -2430,11 +2430,11 @@ __kmp_stg_print_affinity( kmp_str_buf_t * buffer, char const * name, void * data
case affinity_gran_node:
__kmp_str_buf_print( buffer, "%s", "granularity=node,");
break;
-# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+# if KMP_GROUP_AFFINITY
case affinity_gran_group:
__kmp_str_buf_print( buffer, "%s", "granularity=group,");
break;
-# endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
+# endif /* KMP_GROUP_AFFINITY */
}
if ( __kmp_affinity_dups ) {
__kmp_str_buf_print( buffer, "%s,", "duplicates");
@@ -3103,11 +3103,11 @@ __kmp_stg_parse_topology_method( char const * name, char const * value,
|| __kmp_str_match( "cpuinfo", 5, value )) {
__kmp_affinity_top_method = affinity_top_method_cpuinfo;
}
-# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+# if KMP_GROUP_AFFINITY
else if ( __kmp_str_match( "group", 1, value ) ) {
__kmp_affinity_top_method = affinity_top_method_group;
}
-# endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
+# endif /* KMP_GROUP_AFFINITY */
else if ( __kmp_str_match( "flat", 1, value ) ) {
__kmp_affinity_top_method = affinity_top_method_flat;
}
@@ -3145,11 +3145,11 @@ __kmp_stg_print_topology_method( kmp_str_buf_t * buffer, char const * name,
value = "cpuinfo";
break;
-# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+# if KMP_GROUP_AFFINITY
case affinity_top_method_group:
value = "group";
break;
-# endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
+# endif /* KMP_GROUP_AFFINITY */
case affinity_top_method_flat:
value = "flat";
@@ -5106,7 +5106,7 @@ __kmp_env_initialize( char const * string ) {
if ( KMP_AFFINITY_CAPABLE() ) {
-# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+# if KMP_GROUP_AFFINITY
//
// Handle the Win 64 group affinity stuff if there are multiple
@@ -5180,16 +5180,16 @@ __kmp_env_initialize( char const * string ) {
}
else
-# endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
+# endif /* KMP_GROUP_AFFINITY */
{
if ( __kmp_affinity_respect_mask == affinity_respect_mask_default ) {
-# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
+# if KMP_GROUP_AFFINITY
if ( __kmp_num_proc_groups > 1 ) {
__kmp_affinity_respect_mask = FALSE;
}
else
-# endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
+# endif /* KMP_GROUP_AFFINITY */
{
__kmp_affinity_respect_mask = TRUE;
}
diff --git a/openmp/runtime/src/z_Windows_NT_util.c b/openmp/runtime/src/z_Windows_NT_util.c
index 9442444ac9f..e3de8f9d005 100644
--- a/openmp/runtime/src/z_Windows_NT_util.c
+++ b/openmp/runtime/src/z_Windows_NT_util.c
@@ -134,9 +134,9 @@ HMODULE ntdll = NULL;
/* End of NtQuerySystemInformation()-related code */
-#if KMP_ARCH_X86_64
+#if KMP_GROUP_AFFINITY
static HMODULE kernel32 = NULL;
-#endif /* KMP_ARCH_X86_64 */
+#endif /* KMP_GROUP_AFFINITY */
/* ----------------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------------------- */
@@ -547,7 +547,7 @@ __kmp_gtid_get_specific()
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
-#if KMP_ARCH_X86_64
+#if KMP_GROUP_AFFINITY
//
// Only 1 DWORD in the mask should have any procs set.
@@ -570,13 +570,13 @@ __kmp_get_proc_group( kmp_affin_mask_t const *mask )
return group;
}
-#endif /* KMP_ARCH_X86_64 */
+#endif /* KMP_GROUP_AFFINITY */
int
__kmp_set_system_affinity( kmp_affin_mask_t const *mask, int abort_on_error )
{
-#if KMP_ARCH_X86_64
+#if KMP_GROUP_AFFINITY
if (__kmp_num_proc_groups > 1) {
//
@@ -615,7 +615,7 @@ __kmp_set_system_affinity( kmp_affin_mask_t const *mask, int abort_on_error )
}
else
-#endif /* KMP_ARCH_X86_64 */
+#endif /* KMP_GROUP_AFFINITY */
{
if (!SetThreadAffinityMask( GetCurrentThread(), *mask )) {
@@ -638,7 +638,7 @@ int
__kmp_get_system_affinity( kmp_affin_mask_t *mask, int abort_on_error )
{
-#if KMP_ARCH_X86_64
+#if KMP_GROUP_AFFINITY
if (__kmp_num_proc_groups > 1) {
KMP_CPU_ZERO(mask);
@@ -667,7 +667,7 @@ __kmp_get_system_affinity( kmp_affin_mask_t *mask, int abort_on_error )
}
else
-#endif /* KMP_ARCH_X86_64 */
+#endif /* KMP_GROUP_AFFINITY */
{
kmp_affin_mask_t newMask, sysMask, retval;
@@ -718,7 +718,7 @@ void
__kmp_affinity_bind_thread( int proc )
{
-#if KMP_ARCH_X86_64
+#if KMP_GROUP_AFFINITY
if (__kmp_num_proc_groups > 1) {
//
@@ -747,7 +747,7 @@ __kmp_affinity_bind_thread( int proc )
}
else
-#endif /* KMP_ARCH_X86_64 */
+#endif /* KMP_GROUP_AFFINITY */
{
kmp_affin_mask_t mask;
@@ -764,7 +764,7 @@ __kmp_affinity_determine_capable( const char *env_var )
// All versions of Windows* OS (since Win '95) support SetThreadAffinityMask().
//
-#if KMP_ARCH_X86_64
+#if KMP_GROUP_AFFINITY
__kmp_affin_mask_size = __kmp_num_proc_groups * sizeof(kmp_affin_mask_t);
#else
__kmp_affin_mask_size = sizeof(kmp_affin_mask_t);
@@ -920,7 +920,7 @@ __kmp_runtime_initialize( void )
}
KMP_DEBUG_ASSERT( NtQuerySystemInformation != NULL );
-#if KMP_ARCH_X86_64
+#if KMP_GROUP_AFFINITY
//
// Load kernel32.dll.
// Same caveat - must use full system path name.
@@ -985,7 +985,7 @@ __kmp_runtime_initialize( void )
#else
GetSystemInfo( & info );
__kmp_xproc = info.dwNumberOfProcessors;
-#endif // KMP_ARCH_X86_64
+#endif /* KMP_GROUP_AFFINITY */
//
// If the OS said there were 0 procs, take a guess and use a value of 2.
OpenPOWER on IntegriCloud