Skip to content

Commit 42744e4

Browse files
authored
fix: use appropriately sized buffer for memory bandwidth and latency benchmarks (#677)
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
1 parent 86688a9 commit 42744e4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

internal/script/scripts.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,13 @@ func GetParameterizedScriptByName(name string, params map[string]string) ScriptD
164164

165165
// mlc benchmark script constants (buffer setup snippets passed into mlcBenchmarkScript)
166166
const (
167-
// for measuring memory bandwidth and latency (2x of L3 cache size)
167+
// for measuring memory bandwidth and latency (2x of per-core L3 share, minimum 100 MB)
168168
mlcBufferSetupMemory = `L3_KB=$(cache_size_kb L3)
169-
BUF_KB=$(( L3_KB * 2 ))
170-
[ $BUF_KB -lt 1 ] && BUF_KB=1`
169+
CORES_PER_SOCKET=$(lscpu | grep -E 'Core\(s\) per socket:' | head -1 | awk '{print $4}')
170+
[ $CORES_PER_SOCKET -lt 1 ] && CORES_PER_SOCKET=1
171+
BUF_KB=$(( L3_KB * 2 / CORES_PER_SOCKET ))
172+
MIN_KB=102400
173+
[ $BUF_KB -lt $MIN_KB ] && BUF_KB=$MIN_KB`
171174
// for measuring L1 bandwidth and latency (half of L1D cache size minus 4KB)
172175
mlcBufferSetupL1 = `L1D_KB=$(cache_size_kb L1D)
173176
BUF_KB=$(( L1D_KB / 2 - 4 ))

0 commit comments

Comments
 (0)