kernel_ab pool-window: the real CPU expert pool on a large replicated bank, HOT against COLD windows; stub for the kernel resident/streamed and pool-window benchmarks (CPU only); notes on the vanilla trace and the existing tasks-per-thread knob

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Pavlo Ratushnyi
2026-11-12 18:54:53 +01:00
co-authored by Claude Sonnet 5.5
parent 78d148dd31
commit b9d652df56
4 changed files with 225 additions and 2 deletions
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Stage 6b step 2 (CPU only, no GPU, no model): is the CPU expert time memory-bound or arithmetic-bound, and where does the pool lose against one thread?
# A. one thread, pinned, the Original's C++ kernel (`kab time`) and our Rust twin (`kernel_ab time`) on the IQ3_S gate/up + IQ4_NL down case 21-20 (rows 1 and 3): RESIDENT (cache) against STREAMED (over the LLC) ns per expert.
# B. the real pool (`kernel_ab pool-window`, cmd_pool_window.rs) on a 4.4 GiB role-major bank of that expert: HOT windows (same k experts, cache-resident) against COLD windows (random experts), k = 1..4, workers 15 / 7 / 3, and 15 workers with LELEKA_POOL_TASKS_PER_THREAD=6 (finer tasks).
# Run it only when no engine runs (it needs all cores). Inputs: the C++ run directory (frozen) and the two tools below.
set -u
T=/data/leleka-e2e/prefill-latency/tools
OUT=/data/leleka-e2e/prefill-latency/runs/cpu-expert-kernel-resident-vs-streamed-and-pool-window-hot-vs-cold-iq3s
D=/data/leleka-e2e/runs/kernel-ab/final
KAB=/data/leleka-e2e/build/kernel-ab-317/kab
RB=$T/kernel_ab-pool-window
mkdir -p "$OUT"
( cd "$T" && sha256sum -c --ignore-missing SHA256SUMS ) >"$OUT/tools-check.txt" 2>&1 || { echo "tool digest mismatch" >&2; exit 1; }
sha256sum "$KAB" "$RB" >"$OUT/tools.sha256"
lscpu >"$OUT/lscpu.txt"; cat /sys/kernel/mm/transparent_hugepage/enabled >"$OUT/thp.txt"; free -m >"$OUT/free.txt"
for c in 21-20-r1 21-20-r3; do
"$KAB" time --run-dir "$D" --case "$c" --slices 50 --pin 9 --out "$OUT/kab-cpp-$c.json" >"$OUT/kab-cpp-$c.log" 2>&1
"$RB" time --run-dir "$D" --case "$c" --slices 50 --pin 9 --out "$OUT/kab-rust-$c.json" >"$OUT/kab-rust-$c.log" 2>&1
done
export LELEKA_POOL_TIMING=layers
for w in 15 7 3; do
"$RB" pool-window --run-dir "$D" --case 21-20-r1 --workers "$w" --ks 1,2,3,4 --windows 400 >"$OUT/pool-window-w$w.txt" 2>&1
done
LELEKA_POOL_TASKS_PER_THREAD=6 "$RB" pool-window --run-dir "$D" --case 21-20-r1 --workers 15 --ks 1,2,3,4 --windows 400 >"$OUT/pool-window-w15-tpt6.txt" 2>&1
LELEKA_POOL_TASKS_PER_THREAD=1 "$RB" pool-window --run-dir "$D" --case 21-20-r1 --workers 15 --ks 1,2,3,4 --windows 400 >"$OUT/pool-window-w15-tpt1.txt" 2>&1
echo done >"$OUT/DONE"