Phase 3 C3: Static Routing A/B Test ADOPT (+2.20% Mixed gain)

Step 2 & 3 Complete:
- A/B test (Mixed 10-run): STATIC_ROUTE=0 (38.91M) → =1 (39.77M) = +2.20% avg
  - Median gain: +1.98%
  - Result:  GO (exceeds +1.0% threshold)

- Decision:  ADOPT into MIXED_TINYV3_C7_SAFE preset
  - bench_profile.h line 77: HAKMEM_TINY_STATIC_ROUTE=1 default
  - Learner auto-disables static route when HAKMEM_SMALL_LEARNER_V7_ENABLED=1

Implementation Summary:
- core/box/tiny_static_route_box.{h,c}: Research box (Step 1A)
- core/front/malloc_tiny_fast.h: Route lookup integration (Step 1B, lines 249-256)
- core/bench_profile.h: Bench sync + preset adoption

Cumulative Phase 2-3 Gains:
- B3 (Routing shape): +2.89%
- B4 (Wrapper split): +1.47%
- C3 (Static routing): +2.20%
- Total: ~6.8% (35.2M → ~39.8M ops/s)

Next: Phase 3 C1 (TLS Prefetch, expected +2-4%)

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Moe Charm (CI)
2025-12-13 18:46:11 +09:00
parent 1798ed656d
commit d54893ea1d
29 changed files with 553 additions and 82 deletions

View File

@ -62,6 +62,12 @@ From `/mnt/workdisk/public_share/hakmem/core/hakmem_tiny_stats.h`:
- **Usage**: `export HAKMEM_WRAP_TINY_REFILL=1`
- **Safety**: OFF by default (avoids deadlock risk in recursive malloc)
#### HAKMEM_WRAP_SHAPE
- **Default**: 0 (disabled)
- **Purpose**: Experiment: reshape malloc/free wrappers into hot/cold boxes (push rare checks into `noinline,cold`)
- **Impact**: Phase 2 B4 (WRAPPER-SHAPE-1) の A/B gate。`MIXED_TINYV3_C7_SAFE` プリセットでは default=1 に昇格。
- **Notes**: Intended to reduce wrapper I-cache / branch overhead while preserving exact behavior.
#### HAKMEM_TINY_USE_SUPERSLAB
- **Default**: 1 (enabled)
- **Purpose**: Enable SuperSlab allocator for Tiny Pool slabs
@ -73,6 +79,23 @@ From `/mnt/workdisk/public_share/hakmem/core/hakmem_tiny_stats.h`:
- **Purpose**: Treat C0C3 alloc as “second hot path” and skip policy snapshot/routing in `malloc_tiny_fast()`
- **Impact**: Opt-in experiment; keep OFF unless you are A/B testing
#### HAKMEM_FREE_TINY_FAST_HOTCOLD
- **Default**: 0 (disabled)
- **Purpose**: Enable FREE DUALHOT (C0C3 as “second hot path”) in Tiny free path
- **Impact**: Mixed workload winner; promoted as default in `MIXED_TINYV3_C7_SAFE` preset
- **Notes**: `HAKMEM_TINY_LARSON_FIX=1` で互換性のため最適化を無効化できる
#### HAKMEM_TINY_ALLOC_ROUTE_SHAPE
- **Default**: 0 (disabled)
- **Purpose**: Optimize alloc route dispatch shape (LIKELY on LEGACY + cold helper for rare routes)
- **Impact**: Mixed winner; promoted as default in `MIXED_TINYV3_C7_SAFE` / `C6_HEAVY_LEGACY_POOLV1` presets
#### HAKMEM_TINY_STATIC_ROUTE
- **Default**: 0 (disabled)
- **Purpose**: Phase 3 C3: bypass `small_policy_v7_snapshot()` by using a static per-class route table initialized from ENV
- **Impact**: A/B gate for policy snapshot cost removal (research box until GO)
- **Notes**: v7 learner が有効な場合(`HAKMEM_SMALL_HEAP_V7_ENABLED=1` かつ learner 無効化なし)は安全のため強制 OFF
---
### 2. Tiny Pool TLS Caching (Performance Critical)