Phase 19-3a: remove backwards UNLIKELY env-snapshot hints

This commit is contained in:
Moe Charm (CI)
2025-12-15 12:29:27 +09:00
parent ec87025da6
commit 8f4ada5bbd
4 changed files with 1164 additions and 6 deletions

View File

@ -1,6 +1,41 @@
# 本線タスク(現在)
## 更新メモ2025-12-15 Phase 19-1b FASTLANE-DIRECT-1B
## 更新メモ2025-12-15 Phase 19-3a UNLIKELY-HINT-REMOVAL
### Phase 19-3a UNLIKELY-HINT-REMOVAL: ENV Snapshot UNLIKELY Hint Removal — ✅ GO (+4.42%)
**Result**: UNLIKELY hint (`__builtin_expect(..., 0)`) 削除により throughput **+4.42%** 達成。期待値(+0-2%)を大幅超過。
**A/B Test Results** (HAKMEM_PROFILE=MIXED_TINYV3_C7_SAFE, 20M ops, 3-run average):
- Baseline (Phase 19-1b): 52.06M ops/s
- Optimized (Phase 19-3a): 54.36M ops/s (53.99, 54.44, 54.66)
- Delta: **+4.42%** (GO判定、期待値 +0-2% を大幅超過)
**修正内容**:
- File: `/mnt/workdisk/public_share/hakmem/core/front/malloc_tiny_fast.h`
- 修正箇所: 5箇所
- Line 237: malloc_tiny_fast_for_class (C7 ULTRA alloc)
- Line 405: free_tiny_fast_cold (Front V3 free hotcold)
- Line 627: free_tiny_fast_hot (C7 ULTRA free)
- Line 834: free_tiny_fast (C7 ULTRA free larson)
- Line 915: free_tiny_fast (Front V3 free larson)
- 変更: `__builtin_expect(hakmem_env_snapshot_enabled(), 0)``hakmem_env_snapshot_enabled()`
- 理由: ENV snapshot は ON by default (MIXED_TINYV3_C7_SAFE preset) → UNLIKELY hint が逆効果
**Why it works**:
- Phase 19-1b で学んだ教訓: `__builtin_expect(..., 0)` は branch misprediction を誘発
- ENV snapshot は MIXED_TINYV3_C7_SAFE で ON → "UNLIKELY" hint が backwards
- Hint 削除により compiler が正しい branch prediction を生成 → misprediction penalty 削減
**Impact**:
- Throughput: 52.06M → 54.36M ops/s (+4.42%)
- Expected future gains (from design doc Phase 19-3b/c): Additional +3-5% from ENV consolidation
**Next**: Phase 19-3b (ENV Snapshot Consolidation) — Pass env snapshot down from wrapper entry to eliminate 8 additional TLS reads/op.
---
## 前回タスク2025-12-15 Phase 19-1b FASTLANE-DIRECT-1B
### Phase 19-1b FASTLANE-DIRECT-1B: FastLane Direct (Revised) — ✅ GO (+5.88%)