Files
hakmem/build_pgo.sh
Moe Charm (CI) 04186341c1 Phase 4-Step2: Add Hot/Cold Path Box (+7.3% performance)
Implemented Hot/Cold Path separation using Box pattern for Tiny allocations:

Performance Improvement (without PGO):
- Baseline (Phase 26-A):     53.3 M ops/s
- Hot/Cold Box (Phase 4-Step2): 57.2 M ops/s
- Gain: +7.3% (+3.9 M ops/s)

Implementation:
1. core/box/tiny_front_hot_box.h - Ultra-fast hot path (1 branch)
   - Removed range check (caller guarantees valid class_idx)
   - Inline cache hit path with branch prediction hints
   - Debug metrics with zero overhead in Release builds

2. core/box/tiny_front_cold_box.h - Slow cold path (noinline, cold)
   - Refill logic (batch allocation from SuperSlab)
   - Drain logic (batch free to SuperSlab)
   - Error reporting and diagnostics

3. core/front/malloc_tiny_fast.h - Updated to use Hot/Cold Boxes
   - Hot path: tiny_hot_alloc_fast() (1 branch: cache empty check)
   - Cold path: tiny_cold_refill_and_alloc() (noinline, cold attribute)
   - Clear separation improves i-cache locality

Branch Analysis:
- Baseline: 4-5 branches in hot path (range check + cache check + refill logic mixed)
- Hot/Cold Box: 1 branch in hot path (cache empty check only)
- Reduction: 3-4 branches eliminated from hot path

Design Principles (Box Pattern):
 Single Responsibility: Hot path = cache hit only, Cold path = refill/errors
 Clear Contract: Hot returns NULL on miss, Cold handles miss
 Observable: Debug metrics (TINY_HOT_METRICS_*) gated by NDEBUG
 Safe: Branch prediction hints (TINY_HOT_LIKELY/UNLIKELY)
 Testable: Isolated hot/cold paths, easy A/B testing

PGO Status:
- Temporarily disabled (build issues with __gcov_merge_time_profile)
- Will re-enable PGO in future commit after resolving gcc/lto issues
- Current benchmarks are without PGO (fair A/B comparison)

Other Changes:
- .gitignore: Added *.d files (dependency files, auto-generated)
- Makefile: PGO targets temporarily disabled (show informational message)
- build_pgo.sh: Temporarily disabled (show "PGO paused" message)

Next: Phase 4-Step3 (Front Config Box, target +5-8%)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 11:58:37 +09:00

11 lines
422 B
Bash
Executable File

#!/bin/bash
#!/bin/bash
# build_pgo.sh - PGO temporarily disabled
# NOTE: Phase 4 Tiny front refactor is in progress.
# PGO/build flow is parked to avoid extra complexity.
echo "build_pgo.sh: PGO build is temporarily disabled (Phase 4 tiny-front refactor in progress)."
echo " - Normal build: ./build.sh release bench_random_mixed_hakmem"
echo " - Tiny benches: ./build.sh release bench_tiny_hot_hakmem"
exit 1