Skip to content

Commit 31310a9

Browse files
committed
fix frequency table for CWF
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
1 parent 76ef3e6 commit 31310a9

File tree

2 files changed

+33
-19
lines changed

2 files changed

+33
-19
lines changed

internal/extract/frequency.go

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -124,30 +124,37 @@ func GetSpecFrequencyBuckets(outputs map[string]script.ScriptOutput) ([][]string
124124
var dieCoreBuckets []string
125125
totalCoreStartRange := 1
126126
startRange := 1
127-
var archMultiplier int
128-
if strings.Contains(arch, cpus.UarchSRF) || strings.Contains(arch, cpus.UarchCWF) {
129-
archMultiplier = 4
127+
var numDies int
128+
var coreMultiplier int
129+
if strings.Contains(arch, cpus.UarchSRF) {
130+
numDies = 4
131+
coreMultiplier = 4
132+
} else if strings.Contains(arch, cpus.UarchCWF) {
133+
numDies = 3
134+
coreMultiplier = 4
130135
} else if strings.Contains(arch, cpus.UarchGNR_X3) {
131-
archMultiplier = 3
136+
numDies = 3
137+
coreMultiplier = 1
132138
} else if strings.Contains(arch, cpus.UarchGNR_X2) {
133-
archMultiplier = 2
139+
numDies = 2
140+
coreMultiplier = 1
134141
} else {
135-
archMultiplier = 1
142+
numDies = 1
143+
coreMultiplier = 1
136144
}
137145
for _, count := range bucketCoreCounts {
138-
if startRange > count {
146+
adjustedCount := count * coreMultiplier
147+
if startRange > adjustedCount {
139148
break
140149
}
141-
if archMultiplier > 1 {
142-
totalCoreCount := count * archMultiplier
143-
if totalCoreStartRange > int(totalCoreCount) {
144-
break
145-
}
146-
totalCoreBuckets = append(totalCoreBuckets, fmt.Sprintf("%d-%d", totalCoreStartRange, totalCoreCount))
147-
totalCoreStartRange = int(totalCoreCount) + 1
150+
totalCoreCount := adjustedCount * numDies
151+
if totalCoreStartRange > int(totalCoreCount) {
152+
break
148153
}
149-
dieCoreBuckets = append(dieCoreBuckets, fmt.Sprintf("%d-%d", startRange, count))
150-
startRange = int(count) + 1
154+
totalCoreBuckets = append(totalCoreBuckets, fmt.Sprintf("%d-%d", totalCoreStartRange, totalCoreCount))
155+
totalCoreStartRange = int(totalCoreCount) + 1
156+
dieCoreBuckets = append(dieCoreBuckets, fmt.Sprintf("%d-%d", startRange, adjustedCount))
157+
startRange = int(adjustedCount) + 1
151158
}
152159
// get the frequencies for each isa
153160
var allIsaFreqs [][]string
@@ -185,7 +192,7 @@ func GetSpecFrequencyBuckets(outputs map[string]script.ScriptOutput) ([][]string
185192
specCoreFreqs = make([][]string, 1, len(dieCoreBuckets)+1)
186193
// add bucket field name(s)
187194
specCoreFreqs[0] = append(specCoreFreqs[0], "Cores")
188-
if archMultiplier > 1 {
195+
if numDies > 1 {
189196
specCoreFreqs[0] = append(specCoreFreqs[0], "Cores per Die")
190197
}
191198
// add fieldNames for ISAs that have frequencies
@@ -198,7 +205,7 @@ func GetSpecFrequencyBuckets(outputs map[string]script.ScriptOutput) ([][]string
198205
for i, bucket := range dieCoreBuckets {
199206
row := make([]string, 0, len(allIsaFreqs)+2)
200207
// add the total core buckets for multi-die architectures
201-
if archMultiplier > 1 {
208+
if numDies > 1 {
202209
row = append(row, totalCoreBuckets[i])
203210
}
204211
// add the die core buckets

internal/script/scripts.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,14 @@ if ( [ "$family" -eq 6 ] && [ "$model" -eq 173 ] ) || ( [ "$family" -eq 6 ] && [
383383
avx512=$(pcm-tpmi 0x5 0xB8 -i 0 -e 0 | tail -n 2 | head -n 1 | awk '{print $3}') # SST_PPINFO_6
384384
avx512h=$(pcm-tpmi 0x5 0xC0 -i 0 -e 0 | tail -n 2 | head -n 1 | awk '{print $3}') # SST_PPINFO_7
385385
amx=$(pcm-tpmi 0x5 0xC8 -i 0 -e 0 | tail -n 2 | head -n 1 | awk '{print $3}') # SST_PPINFO_8
386-
elif [ "$family" -eq 6 ] && ( [ "$model" -eq 175 ] || [ "$model" -eq 221 ] ); then # SRF, CWF
386+
elif [ "$family" -eq 6 ] && [ "$model" -eq 221 ]; then # CWF (no AVX-512 or AMX support)
387+
cores=$(pcm-tpmi 0x5 0xD8 -i 0 -e 0 | tail -n 2 | head -n 1 | awk '{print $3}') # SST_PP_INFO_10
388+
sse=$(rdmsr 0x1ad) # MSR_TURBO_RATIO_LIMIT: Maximum Ratio Limit of Turbo Mode
389+
avx2=$(pcm-tpmi 0x5 0xB0 -i 0 -e 0 | tail -n 2 | head -n 1 | awk '{print $3}') # SST_PPINFO_5
390+
avx512=0
391+
avx512h=0
392+
amx=0
393+
elif [ "$family" -eq 6 ] && [ "$model" -eq 175 ]; then # SRF
387394
cores=$(rdmsr 0x1ae) # MSR_TURBO_GROUP_CORE_CNT: Group Size of Active Cores for Turbo Mode Operation
388395
# if pstate driver is intel_pstate use 0x774 else use 0x199
389396
driver=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver)

0 commit comments

Comments
 (0)