@@ -28,68 +28,6 @@ static const char *unknown = "unknown";
28
28
static int trace_level = 5 ;
29
29
#endif
30
30
31
- /* LOG_ID_BITS = ( 1 + floor( log_2( max( log_per_phy - 1, 1 ))))
32
- * APIC_ID = (PHY_ID << LOG_ID_BITS) | LOG_ID
33
- * PHY_ID = APIC_ID >> LOG_ID_BITS
34
- */
35
- int __kmp_get_physical_id (int log_per_phy, int apic_id) {
36
- int index_lsb, index_msb, temp;
37
-
38
- if (log_per_phy > 1 ) {
39
- index_lsb = 0 ;
40
- index_msb = 31 ;
41
-
42
- temp = log_per_phy;
43
- while ((temp & 1 ) == 0 ) {
44
- temp >>= 1 ;
45
- index_lsb++;
46
- }
47
-
48
- temp = log_per_phy;
49
- while ((temp & 0x80000000 ) == 0 ) {
50
- temp <<= 1 ;
51
- index_msb--;
52
- }
53
-
54
- /* If >1 bits were set in log_per_phy, choose next higher power of 2 */
55
- if (index_lsb != index_msb)
56
- index_msb++;
57
-
58
- return ((int )(apic_id >> index_msb));
59
- }
60
-
61
- return apic_id;
62
- }
63
-
64
- /*
65
- * LOG_ID_BITS = ( 1 + floor( log_2( max( log_per_phy - 1, 1 ))))
66
- * APIC_ID = (PHY_ID << LOG_ID_BITS) | LOG_ID
67
- * LOG_ID = APIC_ID & (( 1 << LOG_ID_BITS ) - 1 )
68
- */
69
- int __kmp_get_logical_id (int log_per_phy, int apic_id) {
70
- unsigned current_bit;
71
- int bits_seen;
72
-
73
- if (log_per_phy <= 1 )
74
- return (0 );
75
-
76
- bits_seen = 0 ;
77
-
78
- for (current_bit = 1 ; log_per_phy != 0 ; current_bit <<= 1 ) {
79
- if (log_per_phy & current_bit) {
80
- log_per_phy &= ~current_bit;
81
- bits_seen++;
82
- }
83
- }
84
-
85
- /* If exactly 1 bit was set in log_per_phy, choose next lower power of 2 */
86
- if (bits_seen == 1 ) {
87
- current_bit >>= 1 ;
88
- }
89
-
90
- return ((int )((current_bit - 1 ) & apic_id));
91
- }
92
-
93
31
static kmp_uint64 __kmp_parse_frequency ( // R: Frequency in Hz.
94
32
char const *frequency // I: Float number and unit: MHz, GHz, or TGz.
95
33
) {
@@ -122,7 +60,6 @@ static kmp_uint64 __kmp_parse_frequency( // R: Frequency in Hz.
122
60
void __kmp_query_cpuid (kmp_cpuinfo_t *p) {
123
61
struct kmp_cpuid buf;
124
62
int max_arg;
125
- int log_per_phy;
126
63
#ifdef KMP_DEBUG
127
64
int cflush_size;
128
65
#endif
@@ -227,11 +164,8 @@ void __kmp_query_cpuid(kmp_cpuinfo_t *p) {
227
164
228
165
if ((buf.edx >> 28 ) & 1 ) {
229
166
/* Bits 23-16: Logical Processors per Physical Processor (1 for P4) */
230
- log_per_phy = data[2 ];
231
167
p->apic_id = data[3 ]; /* Bits 31-24: Processor Initial APIC ID (X) */
232
- KA_TRACE (trace_level, (" HT(%d TPUs)" , log_per_phy));
233
- p->physical_id = __kmp_get_physical_id (log_per_phy, p->apic_id );
234
- p->logical_id = __kmp_get_logical_id (log_per_phy, p->apic_id );
168
+ KA_TRACE (trace_level, (" HT(%d TPUs)" , data[2 ]));
235
169
}
236
170
#ifdef KMP_DEBUG
237
171
if ((buf.edx >> 29 ) & 1 ) {
0 commit comments