place: --expert-pin-top cuts fractional profile shares correctly

pin_hot() set the pin threshold to the share at the cut minus 1.0, which
assumes integer gaps between shares. A profile's per-layer shares are
fractions in [0, 1] (xs_profile_load divides by the layer's total), so the
threshold went negative and every resident expert counted as pinned at any
--expert-pin-top, leaving the heat engine no slab slots (decode -4..9% on
Qwen3.8-Flash-Next IQR-V4 against the same run without pinning).

The threshold is now the share just below the hot set (-1 when the hot set
is every expert, so everything pins). A test with fractional shares pins the
hottest quarter and fails without the change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Code000andClaude Opus 5.5 authored and StillDeadcode committed 2026-11-17 18:17:08 +01:00
1 parent 8f2e511fcc
commit 8dcd8fdcd7
2 files changed
+38 -1

No files matched your search

+1 -1
View File
@@ -1146,7 +1146,7 @@ void Planner::pin_hot(const Config& cfg, Plan* p) const {
const double keep = (double)cfg.expert_pin_top * (double)shares.size();
const size_t hot = keep <= 0.0 ? 0 : std::min(shares.size(), (size_t)std::ceil(keep));
const float threshold = hot == 0 ? shares.back() + 1.0f
: shares[shares.size() - hot] - 1.0f;
: (hot < shares.size() ? shares[shares.size() - hot - 1] : -1.0f);
p->pin_threshold = threshold;
p->profile_units = (int64_t)shares.size();
int64_t pinned = 0, left = 0;