diff --git a/CURRENT_TASK.md b/CURRENT_TASK.md index 7c7d94fd..41493125 100644 --- a/CURRENT_TASK.md +++ b/CURRENT_TASK.md @@ -132,6 +132,15 @@ - **前提**: Top 50 実行確認が必須 - Phase 69 が外れた時の保険として後回し推奨 +--- + +**Phase 70(観測の前提固め): Refill/WarmPool 最適化の Step 0 を SSOT 化** + +- 目的: **“経路が踏まれていない最適化”** を防ぐ(Phase 40/41/64 の layout tax 前例) +- 注意: `Route assignments: LEGACY` は「Unified Cache 未使用」を意味しない(backend route kind) +- SSOT: `docs/analysis/PHASE70_REFILL_OBSERVABILITY_PREREQS_SSOT.md` + - Mixed SSOT(WS=400)で `unified_cache_refill()` / WarmPool pop が有意に起きているかを **OBSERVE で確定**してから Phase 70 を進める + **注記**: 研究箱の削除は今やらない(link-out/削除が layout tax を起こす前例が強いので、compile-out維持が正解) ## 3) アーカイブ diff --git a/docs/analysis/PHASE70_REFILL_OBSERVABILITY_PREREQS_SSOT.md b/docs/analysis/PHASE70_REFILL_OBSERVABILITY_PREREQS_SSOT.md new file mode 100644 index 00000000..ce29a7b4 --- /dev/null +++ b/docs/analysis/PHASE70_REFILL_OBSERVABILITY_PREREQS_SSOT.md @@ -0,0 +1,66 @@ +# Phase 70: Refill Tuning Prerequisites (Observability SSOT) + +**Status**: 🟡 ACTIVE + +**Context**: +- Current baseline (Mixed WS=400 + prefault) generates almost **zero cache misses** (refills) in Unified Cache. +- Optimizing `unified_cache_refill()` or Warm Pool logic will yield **zero throughput gain** if this path is not hot. +- Phase 70 must be gated on *observing significant refill activity*. + +## 1. Observability Protocol (Step 0) + +Before implementing any refill/WarmPool changes, execute this sequence: + +1. **Build with Stats**: + ```bash + make bench_random_mixed_hakmem_observe EXTRA_CFLAGS='-DHAKMEM_UNIFIED_CACHE_STATS_COMPILED=1' + ``` + *(Note: Phase 70-0 fixed release-mode stats blocking)* + +2. **Run with Stats**: + ```bash + HAKMEM_WARM_POOL_STATS=1 ./bench_random_mixed_hakmem_observe 20000000 400 1 + ``` + +3. **Check Output**: + - Look for `Unified-STATS`: `miss=...` + - Look for `WarmPool-STATS`: `hits=...` + +**Decision Gate**: +- If `miss` counts are < 1000 (approx <0.01% miss rate): + - **STOP**: Optimization has no ROI on this workload. + - **ACTION**: Either accept current state (refill is not a bottleneck) or switch to a research workload (below). +- If `miss` counts are significant: + - **GO**: Proceed with Phase 70 logic changes. + +## 2. Research Workload (If Refill Optimization is Mandatory) + +If you must measure refill performance improvements (e.g., for architectural validation), modify the workload to force cache pressure: + +**Option A: Disable Prefault (Cold Path Stress)** +```bash +HAKMEM_BENCH_PREFAULT=0 ./bench_random_mixed_hakmem_observe ... +``` +- Pros: Forces refills during benchmark loop. +- Cons: Measures startup behavior, not steady-state throughput. + +**Option B: Increase Working Set (Steady State Stress)** +```bash +./bench_random_mixed_hakmem_observe 20000000 8192 1 # WS=8192 > Cache(2048) +``` +- Pros: Forces steady-state evictions/refills. +- Cons: Different workload profile than standard Mixed SSOT (WS=400). + +**WARNING**: Do NOT change `HAKMEM_TINY_STATIC_ROUTE` or `ULTRA` flags unless specifically testing routing changes. The default `LEGACY` route *does* use Unified Cache for alloc/free. + +## 3. Reference: Why "LEGACY" Route is OK + +- **LEGACY** route means "not ULTRA/MID/V7 specialized". +- Alloc path: `malloc_tiny_fast` → `tiny_hot_alloc_fast` → **Unified Cache (TLS array)**. +- Free path: `free_tiny_fast` → `tiny_hot_free_fast` → **Unified Cache (TLS array)**. +- Refill path: Cache Miss → `unified_cache_refill` → **Warm Pool** → Registry. + +Previous confusion ("LEGACY unused") was due to: +1. Stats counting was gated by `#if !HAKMEM_BUILD_RELEASE`. +2. Low miss rate in WS=400 made it look unused. +3. Phase 70-0 fixed the stats visibility. \ No newline at end of file