Skip to content

Commit 6272500

Browse files
authored
[OpenMP] Remove unused logical/physical CPUID information (#83298)
1 parent 3303be6 commit 6272500

File tree

2 files changed

+1
-69
lines changed

2 files changed

+1
-69
lines changed

openmp/runtime/src/kmp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,8 +1392,6 @@ typedef struct kmp_cpuinfo {
13921392
int stepping; // CPUID(1).EAX[3:0] ( Stepping )
13931393
kmp_cpuinfo_flags_t flags;
13941394
int apic_id;
1395-
int physical_id;
1396-
int logical_id;
13971395
kmp_uint64 frequency; // Nominal CPU frequency in Hz.
13981396
char name[3 * sizeof(kmp_cpuid_t)]; // CPUID(0x80000002,0x80000003,0x80000004)
13991397
} kmp_cpuinfo_t;

openmp/runtime/src/kmp_utility.cpp

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -28,68 +28,6 @@ static const char *unknown = "unknown";
2828
static int trace_level = 5;
2929
#endif
3030

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-
9331
static kmp_uint64 __kmp_parse_frequency( // R: Frequency in Hz.
9432
char const *frequency // I: Float number and unit: MHz, GHz, or TGz.
9533
) {
@@ -122,7 +60,6 @@ static kmp_uint64 __kmp_parse_frequency( // R: Frequency in Hz.
12260
void __kmp_query_cpuid(kmp_cpuinfo_t *p) {
12361
struct kmp_cpuid buf;
12462
int max_arg;
125-
int log_per_phy;
12663
#ifdef KMP_DEBUG
12764
int cflush_size;
12865
#endif
@@ -227,11 +164,8 @@ void __kmp_query_cpuid(kmp_cpuinfo_t *p) {
227164

228165
if ((buf.edx >> 28) & 1) {
229166
/* Bits 23-16: Logical Processors per Physical Processor (1 for P4) */
230-
log_per_phy = data[2];
231167
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]));
235169
}
236170
#ifdef KMP_DEBUG
237171
if ((buf.edx >> 29) & 1) {

0 commit comments

Comments
 (0)