summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src/kmp_affinity.cpp
diff options
context:
space:
mode:
authorAndrey Churbanov <Andrey.Churbanov@intel.com>2015-01-27 17:03:42 +0000
committerAndrey Churbanov <Andrey.Churbanov@intel.com>2015-01-27 17:03:42 +0000
commit1c33129956253fb8f1d001ac91c2b962d01caf25 (patch)
tree37afbb2630b68618ec23ee3995f401caa83fae7c /openmp/runtime/src/kmp_affinity.cpp
parentdf6555b6ef0dd6a5a43d547827c7c594abe342ef (diff)
downloadbcm5719-llvm-1c33129956253fb8f1d001ac91c2b962d01caf25.tar.gz
bcm5719-llvm-1c33129956253fb8f1d001ac91c2b962d01caf25.zip
Enables a cpuid leaf 4 check for non-MIC x86 architectures.
llvm-svn: 227204
Diffstat (limited to 'openmp/runtime/src/kmp_affinity.cpp')
-rw-r--r--openmp/runtime/src/kmp_affinity.cpp35
1 files changed, 14 insertions, 21 deletions
diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index 2679518978b..2b3a2b25d4a 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -787,33 +787,27 @@ static int
__kmp_affinity_create_apicid_map(AddrUnsPair **address2os,
kmp_i18n_id_t *const msg_id)
{
+ kmp_cpuid buf;
int rc;
*address2os = NULL;
*msg_id = kmp_i18n_null;
-# if KMP_MIC
- {
- // The code below will use cpuid(4).
- // Check if cpuid(4) is supported.
- // FIXME? - this really doesn't need to be specific to MIC.
- kmp_cpuid buf;
+ //
+ // Check if cpuid leaf 4 is supported.
+ //
__kmp_x86_cpuid(0, 0, &buf);
if (buf.eax < 4) {
*msg_id = kmp_i18n_str_NoLeaf4Support;
return -1;
}
- }
-# endif // KMP_MIC
//
- // Even if __kmp_affinity_type == affinity_none, this routine is still
- // called to set __kmp_ht_enabled, & __kmp_ncores, as well as
- // __kmp_nThreadsPerCore, nCoresPerPkg, & nPackages.
- //
// The algorithm used starts by setting the affinity to each available
- // thread and retreiving info from the cpuid instruction, so if we are not
- // capable of calling __kmp_affinity_get_map()/__kmp_affinity_get_map(),
- // then we need to do something else.
+ // thread and retrieving info from the cpuid instruction, so if we are
+ // not capable of calling __kmp_get_system_affinity() and
+ // _kmp_get_system_affinity(), then we need to do something else - use
+ // the defaults that we calculated from issuing cpuid without binding
+ // to each proc.
//
if (! KMP_AFFINITY_CAPABLE()) {
//
@@ -830,7 +824,6 @@ __kmp_affinity_create_apicid_map(AddrUnsPair **address2os,
// but is disabled, this value will be 2 on a single core chip.
// Usually, it will be 2 if HT is enabled and 1 if HT is disabled.
//
- kmp_cpuid buf;
__kmp_x86_cpuid(1, 0, &buf);
int maxThreadsPerPkg = (buf.ebx >> 16) & 0xff;
if (maxThreadsPerPkg == 0) {
@@ -959,7 +952,6 @@ __kmp_affinity_create_apicid_map(AddrUnsPair **address2os,
//
// The apic id and max threads per pkg come from cpuid(1).
//
- kmp_cpuid buf;
__kmp_x86_cpuid(1, 0, &buf);
if (! (buf.edx >> 9) & 1) {
__kmp_set_system_affinity(oldMask, TRUE);
@@ -1400,10 +1392,11 @@ __kmp_affinity_create_x2apicid_map(AddrUnsPair **address2os,
//
// The algorithm used starts by setting the affinity to each available
- // thread and retrieving info from the cpuid instruction, so if we are not
- // capable of calling __kmp_affinity_get_map()/__kmp_affinity_get_map(),
- // then we need to do something else - use the defaults that we calculated
- // from issuing cpuid without binding to each proc.
+ // thread and retrieving info from the cpuid instruction, so if we are
+ // not capable of calling __kmp_get_system_affinity() and
+ // _kmp_get_system_affinity(), then we need to do something else - use
+ // the defaults that we calculated from issuing cpuid without binding
+ // to each proc.
//
if (! KMP_AFFINITY_CAPABLE())
{
OpenPOWER on IntegriCloud