Major Features: - Debug counter infrastructure for Refill Stage tracking - Free Pipeline counters (ss_local, ss_remote, tls_sll) - Diagnostic counters for early return analysis - Unified larson.sh benchmark runner with profiles - Phase 6-3 regression analysis documentation Bug Fixes: - Fix SuperSlab disabled by default (HAKMEM_TINY_USE_SUPERSLAB) - Fix profile variable naming consistency - Add .gitignore patterns for large files Performance: - Phase 6-3: 4.79 M ops/s (has OOM risk) - With SuperSlab: 3.13 M ops/s (+19% improvement) This is a clean repository without large log files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
84 lines
2.4 KiB
Bash
84 lines
2.4 KiB
Bash
#!/usr/bin/env bash
|
||
set -euo pipefail
|
||
|
||
# Sweep Tiny env knobs quickly to tune small-size hot path.
|
||
# Knobs:
|
||
# - HAKMEM_SLL_MULTIPLIER ∈ {1,2,3}
|
||
# - HAKMEM_TINY_REFILL_MAX ∈ {64,96,128}
|
||
# - HAKMEM_TINY_REFILL_MAX_HOT ∈ {160,192,224}
|
||
# - HAKMEM_TINY_MAG_CAP (global) ∈ {128,256}
|
||
# - Optional: per-class MAG_CAP_C3=512 for 64B(フラグ --mag64-512)
|
||
#
|
||
# Usage: scripts/sweep_tiny_advanced.sh [cycles] [--mag64-512]
|
||
|
||
ROOT_DIR=$(cd "$(dirname "$0")/.." && pwd)
|
||
cd "$ROOT_DIR"
|
||
|
||
cycles=${1:-80000}
|
||
shift || true
|
||
MAG64=0
|
||
if [[ "${1:-}" == "--mag64-512" ]]; then MAG64=1; fi
|
||
|
||
make -s bench_fast >/dev/null
|
||
|
||
TS=$(date +%Y%m%d_%H%M%S)
|
||
OUTDIR="bench_results/sweep_tiny_adv_${TS}"
|
||
mkdir -p "$OUTDIR"
|
||
CSV="$OUTDIR/results.csv"
|
||
echo "size,sllmul,rmax,rmaxh,mag_cap,mag_cap_c3,throughput_mops" > "$CSV"
|
||
|
||
sizes=(16 32 64)
|
||
sllm=(1 2 3)
|
||
rmax=(64 96 128)
|
||
rmaxh=(160 192 224)
|
||
mags=(128 256)
|
||
|
||
run_case() {
|
||
local size="$1"; shift
|
||
local smul="$1"; shift
|
||
local r1="$1"; shift
|
||
local r2="$1"; shift
|
||
local mcap="$1"; shift
|
||
local mag64="$1"; shift
|
||
local out
|
||
if [[ "$size" == "64" && "$mag64" == "1" ]]; then
|
||
HAKMEM_WRAP_TINY=1 \
|
||
HAKMEM_TINY_TLS_SLL=1 \
|
||
HAKMEM_SLL_MULTIPLIER="$smul" \
|
||
HAKMEM_TINY_REFILL_MAX="$r1" \
|
||
HAKMEM_TINY_REFILL_MAX_HOT="$r2" \
|
||
HAKMEM_TINY_MAG_CAP="$mcap" \
|
||
HAKMEM_TINY_MAG_CAP_C3=512 \
|
||
./bench_tiny_hot_hakmem "$size" 100 "$cycles" | sed -n 's/^Throughput: \([0-9.][0-9.]*\) M ops.*/\1/p' >"$OUTDIR/tmp.txt" || true
|
||
else
|
||
HAKMEM_WRAP_TINY=1 \
|
||
HAKMEM_TINY_TLS_SLL=1 \
|
||
HAKMEM_SLL_MULTIPLIER="$smul" \
|
||
HAKMEM_TINY_REFILL_MAX="$r1" \
|
||
HAKMEM_TINY_REFILL_MAX_HOT="$r2" \
|
||
HAKMEM_TINY_MAG_CAP="$mcap" \
|
||
./bench_tiny_hot_hakmem "$size" 100 "$cycles" | sed -n 's/^Throughput: \([0-9.][0-9.]*\) M ops.*/\1/p' >"$OUTDIR/tmp.txt" || true
|
||
fi
|
||
out=$(cat "$OUTDIR/tmp.txt" || true)
|
||
if [[ -n "$out" ]]; then
|
||
echo "$size,$smul,$r1,$r2,$mcap,$([[ "$size" == "64" && "$mag64" == "1" ]] && echo 512 || echo -) ,$out" >> "$CSV"
|
||
fi
|
||
}
|
||
|
||
for sz in "${sizes[@]}"; do
|
||
for sm in "${sllm[@]}"; do
|
||
for r1 in "${rmax[@]}"; do
|
||
for r2 in "${rmaxh[@]}"; do
|
||
for mc in "${mags[@]}"; do
|
||
echo "[sweep-adv] size=$sz mul=$sm rmax=$r1 hot=$r2 mag=$mc mag64=$( [[ "$MAG64" == "1" ]] && echo 512 || echo - ) cycles=$cycles"
|
||
run_case "$sz" "$sm" "$r1" "$r2" "$mc" "$MAG64"
|
||
done
|
||
done
|
||
done
|
||
done
|
||
done
|
||
|
||
echo "[done] CSV: $CSV"
|
||
sed -n '1,40p' "$CSV" || true
|
||
|