46 lines
1.7 KiB
Markdown
46 lines
1.7 KiB
Markdown
|
|
# Phase 66: PGO (FAST minimal, GCC+LTO) — Results
|
|||
|
|
|
|||
|
|
## TL;DR
|
|||
|
|
|
|||
|
|
PGO は **GO**。`BENCH_MINIMAL` の Mixed 10-run で **+6.58%**(mean)を達成。
|
|||
|
|
|
|||
|
|
## What changed
|
|||
|
|
|
|||
|
|
- Makefile: `pgo-fast-*` の PGO ワークフローを追加(GCC + `-flto` を維持)
|
|||
|
|
- `scripts/box/pgo_tiny_profile_box.sh`: `PGO_CONFIG` 切替対応 + workload を `bash -lc` で実行
|
|||
|
|
- `scripts/box/pgo_fast_profile_config.sh`: FAST minimal 用の PGO 代表ワークロード(cleanenv 前提)
|
|||
|
|
- Makefile: `bench_tiny_hot_hakmem` を `$(TINY_BENCH_OBJS)` でリンク(LTO 時の未解決参照を解消)
|
|||
|
|
|
|||
|
|
## A/B (Mixed 10-run, cleanenv)
|
|||
|
|
|
|||
|
|
計測の正:
|
|||
|
|
- `scripts/run_mixed_10_cleanenv.sh`(`ITERS=20000000 WS=400`)
|
|||
|
|
- baseline: `bench_random_mixed_hakmem_minimal`
|
|||
|
|
- treatment: `bench_random_mixed_hakmem_minimal_pgo`
|
|||
|
|
|
|||
|
|
結果(n=10):
|
|||
|
|
- Baseline mean: `61.718839M ops/s` / median: `61.672012M ops/s`
|
|||
|
|
- PGO mean: `65.780056M ops/s` / median: `66.227247M ops/s`
|
|||
|
|
- Delta: **+6.58% mean** / **+7.38% median**
|
|||
|
|
|
|||
|
|
Verdict: ✅ **GO**(build-level のため +1.0% 以上で十分)
|
|||
|
|
|
|||
|
|
## Key lesson (important)
|
|||
|
|
|
|||
|
|
PGO は **profile mismatch で簡単に NO-GO になる**。
|
|||
|
|
|
|||
|
|
- NG 例: `bench_random_mixed_hakmem` を “直起動” で profile 収集
|
|||
|
|
- preset/ENV が一致せず、`FASTLANE_DIRECT` 等が OFF のプロファイルが混ざる
|
|||
|
|
- 結果: PGO が逆方向に最適化して -5% 級の regression になり得る
|
|||
|
|
- OK 例(本 Phase 66): **cleanenv 経由で profile 収集**
|
|||
|
|
- `scripts/box/pgo_fast_profile_config.sh` が `scripts/run_mixed_10_cleanenv.sh` を使う
|
|||
|
|
|
|||
|
|
## How to reproduce
|
|||
|
|
|
|||
|
|
```sh
|
|||
|
|
make pgo-fast-full
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
(手動手順は `docs/analysis/PHASE66_PGO_FAST_WITH_LTO_INSTRUCTIONS.md`)
|
|||
|
|
|