From f696c820cd7ccbe7c536b970d46d0ed0065a229f Mon Sep 17 00:00:00 2001 From: Andrey Churbanov Date: Tue, 27 Jan 2015 16:55:43 +0000 Subject: [PATCH] Removes some unused variables (__kmp_ht_*) and changes__kmp_ncores and __kmp_nThreadsPerCore to static globals within kmp_affinity.cpp. llvm-svn: 227201 --- openmp/runtime/src/kmp.h | 6 ++---- openmp/runtime/src/kmp_affinity.cpp | 26 +++++++++----------------- openmp/runtime/src/kmp_global.c | 5 ++--- openmp/runtime/src/kmp_utility.c | 7 ------- 4 files changed, 13 insertions(+), 31 deletions(-) diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h index a7a5e53..1275719 100644 --- a/openmp/runtime/src/kmp.h +++ b/openmp/runtime/src/kmp.h @@ -2579,11 +2579,9 @@ extern int __kmp_bt_intervals; /* number of monitor timestamp intervals #ifdef KMP_ADJUST_BLOCKTIME extern int __kmp_zero_bt; /* whether blocktime has been forced to zero */ #endif /* KMP_ADJUST_BLOCKTIME */ -extern int __kmp_ht_capable; /* whether CPUs support Intel(R) Hyper-Threading Technology */ -extern int __kmp_ht_enabled; /* whether Intel(R) Hyper-Threading Technology is enabled in OS */ +#ifdef KMP_DFLT_NTH_CORES extern int __kmp_ncores; /* Number of physical procs in HT machine */ -extern int __kmp_ht_log_per_phy; /* Maximum possible number of logical processors per package */ -extern int __kmp_nThreadsPerCore;/* Number of hyperthreads per core in HT machine. */ +#endif extern int __kmp_abort_delay; /* Number of millisecs to delay on abort for VTune */ extern int __kmp_need_register_atfork_specified; diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp index f3d0a8c..2679518 100644 --- a/openmp/runtime/src/kmp_affinity.cpp +++ b/openmp/runtime/src/kmp_affinity.cpp @@ -485,7 +485,10 @@ __kmp_affinity_get_fullMask() { return fullMask; } static int nCoresPerPkg, nPackages; -int __kmp_nThreadsPerCore; +static int __kmp_nThreadsPerCore; +#ifndef KMP_DFLT_NTH_CORES +static int __kmp_ncores; +#endif // // __kmp_affinity_uniform_topology() doesn't work when called from @@ -556,14 +559,13 @@ __kmp_affinity_create_flat_map(AddrUnsPair **address2os, // // Even if __kmp_affinity_type == affinity_none, this routine might still - // called to set __kmp_ht_enabled, & __kmp_ncores, as well as + // called to set __kmp_ncores, as well as // __kmp_nThreadsPerCore, nCoresPerPkg, & nPackages. // if (! KMP_AFFINITY_CAPABLE()) { KMP_ASSERT(__kmp_affinity_type == affinity_none); __kmp_ncores = nPackages = __kmp_xproc; __kmp_nThreadsPerCore = nCoresPerPkg = 1; - __kmp_ht_enabled = FALSE; if (__kmp_affinity_verbose) { KMP_INFORM(AffFlatTopology, "KMP_AFFINITY"); KMP_INFORM(AvailableOSProc, "KMP_AFFINITY", __kmp_avail_proc); @@ -576,13 +578,12 @@ __kmp_affinity_create_flat_map(AddrUnsPair **address2os, // // When affinity is off, this routine will still be called to set - // __kmp_ht_enabled, & __kmp_ncores, as well as __kmp_nThreadsPerCore, + // __kmp_ncores, as well as __kmp_nThreadsPerCore, // nCoresPerPkg, & nPackages. Make sure all these vars are set // correctly, and return now if affinity is not enabled. // __kmp_ncores = nPackages = __kmp_avail_proc; __kmp_nThreadsPerCore = nCoresPerPkg = 1; - __kmp_ht_enabled = FALSE; if (__kmp_affinity_verbose) { char buf[KMP_AFFIN_MASK_PRINT_LEN]; __kmp_affinity_print_mask(buf, KMP_AFFIN_MASK_PRINT_LEN, fullMask); @@ -878,7 +879,6 @@ __kmp_affinity_create_apicid_map(AddrUnsPair **address2os, __kmp_ncores = __kmp_xproc; nPackages = (__kmp_xproc + nCoresPerPkg - 1) / nCoresPerPkg; __kmp_nThreadsPerCore = 1; - __kmp_ht_enabled = FALSE; if (__kmp_affinity_verbose) { KMP_INFORM(AffNotCapableUseLocCpuid, "KMP_AFFINITY"); KMP_INFORM(AvailableOSProc, "KMP_AFFINITY", __kmp_avail_proc); @@ -1045,7 +1045,6 @@ __kmp_affinity_create_apicid_map(AddrUnsPair **address2os, if (nApics == 1) { __kmp_ncores = nPackages = 1; __kmp_nThreadsPerCore = nCoresPerPkg = 1; - __kmp_ht_enabled = FALSE; if (__kmp_affinity_verbose) { char buf[KMP_AFFIN_MASK_PRINT_LEN]; __kmp_affinity_print_mask(buf, KMP_AFFIN_MASK_PRINT_LEN, oldMask); @@ -1182,11 +1181,10 @@ __kmp_affinity_create_apicid_map(AddrUnsPair **address2os, // // When affinity is off, this routine will still be called to set - // __kmp_ht_enabled, & __kmp_ncores, as well as __kmp_nThreadsPerCore, + // __kmp_ncores, as well as __kmp_nThreadsPerCore, // nCoresPerPkg, & nPackages. Make sure all these vars are set // correctly, and return now if affinity is not enabled. // - __kmp_ht_enabled = (__kmp_nThreadsPerCore > 1); __kmp_ncores = nCores; if (__kmp_affinity_verbose) { char buf[KMP_AFFIN_MASK_PRINT_LEN]; @@ -1417,7 +1415,6 @@ __kmp_affinity_create_x2apicid_map(AddrUnsPair **address2os, __kmp_ncores = __kmp_xproc / __kmp_nThreadsPerCore; nPackages = (__kmp_xproc + nCoresPerPkg - 1) / nCoresPerPkg; - __kmp_ht_enabled = (__kmp_nThreadsPerCore > 1); if (__kmp_affinity_verbose) { KMP_INFORM(AffNotCapableUseLocCpuidL11, "KMP_AFFINITY"); KMP_INFORM(AvailableOSProc, "KMP_AFFINITY", __kmp_avail_proc); @@ -1517,7 +1514,6 @@ __kmp_affinity_create_x2apicid_map(AddrUnsPair **address2os, if (nApics == 1) { __kmp_ncores = nPackages = 1; __kmp_nThreadsPerCore = nCoresPerPkg = 1; - __kmp_ht_enabled = FALSE; if (__kmp_affinity_verbose) { char buf[KMP_AFFIN_MASK_PRINT_LEN]; __kmp_affinity_print_mask(buf, KMP_AFFIN_MASK_PRINT_LEN, oldMask); @@ -1625,7 +1621,7 @@ __kmp_affinity_create_x2apicid_map(AddrUnsPair **address2os, // // When affinity is off, this routine will still be called to set - // __kmp_ht_enabled, & __kmp_ncores, as well as __kmp_nThreadsPerCore, + // __kmp_ncores, as well as __kmp_nThreadsPerCore, // nCoresPerPkg, & nPackages. Make sure all these vars are set // correctly, and return if affinity is not enabled. // @@ -1635,8 +1631,6 @@ __kmp_affinity_create_x2apicid_map(AddrUnsPair **address2os, else { __kmp_nThreadsPerCore = 1; } - __kmp_ht_enabled = (__kmp_nThreadsPerCore > 1); - nPackages = totals[pkgLevel]; if (coreLevel >= 0) { @@ -2134,7 +2128,6 @@ __kmp_affinity_create_cpuinfo_map(AddrUnsPair **address2os, int *line, if (num_avail == 1) { __kmp_ncores = 1; __kmp_nThreadsPerCore = nCoresPerPkg = nPackages = 1; - __kmp_ht_enabled = FALSE; if (__kmp_affinity_verbose) { if (! KMP_AFFINITY_CAPABLE()) { KMP_INFORM(AffNotCapableUseCpuinfo, "KMP_AFFINITY"); @@ -2375,11 +2368,10 @@ __kmp_affinity_create_cpuinfo_map(AddrUnsPair **address2os, int *line, // // When affinity is off, this routine will still be called to set - // __kmp_ht_enabled, & __kmp_ncores, as well as __kmp_nThreadsPerCore, + // __kmp_ncores, as well as __kmp_nThreadsPerCore, // nCoresPerPkg, & nPackages. Make sure all these vars are set // correctly, and return now if affinity is not enabled. // - __kmp_ht_enabled = (maxCt[threadIdIndex] > 1); // threads per core > 1 __kmp_ncores = totals[coreIdIndex]; if (__kmp_affinity_verbose) { diff --git a/openmp/runtime/src/kmp_global.c b/openmp/runtime/src/kmp_global.c index 1614799..0ef2c39 100644 --- a/openmp/runtime/src/kmp_global.c +++ b/openmp/runtime/src/kmp_global.c @@ -146,10 +146,9 @@ int __kmp_bt_intervals = KMP_INTERVALS_FROM_BLOCKTIME( KMP_DEFAULT_BLOC #ifdef KMP_ADJUST_BLOCKTIME int __kmp_zero_bt = FALSE; #endif /* KMP_ADJUST_BLOCKTIME */ -int __kmp_ht_capable = FALSE; -int __kmp_ht_enabled = FALSE; -int __kmp_ht_log_per_phy = 1; +#ifdef KMP_DFLT_NTH_CORES int __kmp_ncores = 0; +#endif int __kmp_chunk = 0; int __kmp_abort_delay = 0; #if KMP_OS_LINUX && defined(KMP_TDATA_GTID) diff --git a/openmp/runtime/src/kmp_utility.c b/openmp/runtime/src/kmp_utility.c index 180fcea..b12c7bc 100644 --- a/openmp/runtime/src/kmp_utility.c +++ b/openmp/runtime/src/kmp_utility.c @@ -234,16 +234,9 @@ __kmp_query_cpuid( kmp_cpuinfo_t *p ) } #endif /* KMP_DEBUG */ - __kmp_ht_capable = FALSE; if ( (buf.edx >> 28) & 1 ) { - - /* HT - Processor is HT Enabled (formerly JT) */ - __kmp_ht_capable = TRUE; - /* Bits 23-16: Logical Processors per Physical Processor (1 for P4) */ log_per_phy = data[ 2 ]; - __kmp_ht_log_per_phy = log_per_phy; - p->apic_id = data[ 3 ]; /* Bits 31-24: Processor Initial APIC ID (X) */ KA_TRACE( trace_level, (" HT(%d TPUs)", log_per_phy ) ); -- 2.7.4