Merge PR 4534 (b1b8b8d3d) into f-pr-split: the split search prices a pipelined two-stage split by its slower stage

One commit by cobra91 on dbb2d168c, merged as written: with --pipeline-windows 2 and exactly two stages the search's predicted window time is the slower stage's (its layers, plus about 12 layer-times for the last stage's head and draft chain, plus that stage's misses on its own link) instead of the sum of the stages. Nothing changes without --pipeline-windows 2 (on CUDA it is not on by default).
1 file: src/program/generate.cpp, 16 lines added in the search's predict lambda. Git merged it without a conflict.
This commit is contained in:
Niko1221 committed 2026-11-12 22:28:51 +01:00
commit d20c94caeb
1 file changed
+16
+16
View File
@@ -6448,6 +6448,22 @@ int main(int argc, char** argv) {
++held_cnt[(size_t) st];
}
held_mass /= std::max(total_mass, 1e-9);
// --pipeline-windows 2 on two stages: the stages overlap, so a window costs about the slower stage,
// and a stage's CPU misses wait on that stage. The last one also runs the head and the draft chain
// the next window waits for: ~4 ms on an RTX 5080, about 12 of its layers. (A sum of the stages put
// 2 of 48 layers on the first card of a 4060 Ti + 5080 pair and left most of its VRAM idle: 29 tok/s
// against 165 at K=20. From Strata-DualGPU, adapted to keep this tree's per-link miss scaling.)
if (o.pipeline_windows >= 2 && ns == 2) {
double slowest = 0.0;
for (int i = 0; i < ns; ++i) {
const int64_t lb = i == 0 ? 0 : at[(size_t) i - 1], le = i + 1 < ns ? at[(size_t) i] : g.n_layers;
const double gpu = (double) (le - lb + (i + 1 == ns ? 12 : 0)) * layer_ms[(size_t) i];
slowest = std::max(slowest, gpu + miss_ms * link_scale[(size_t) i] *
std::max(0.0, mass_i[(size_t) i] - held_i[(size_t) i]) /
std::max(total_mass, 1e-9));
}
return slowest;
}
// Each stage's misses on its own link (link_scale; 1.0 everywhere = the fitted single-constant formula).
double ms = 0.0;
for (int i = 0; i < ns; ++i)