decode: STRATA_PCIE_BALANCE=1 picks each layer's PCIe count from measured costs
The verify window reads pcie_frac of a layer's missed experts over PCIe, a share the link probe sets; the CPU's speed does not enter it. With a slow CPU the GPU spins on the pool's rows: IQ2_XS with one AVX2 pool worker (emulated) runs 16.8-17.2 ms a round at the probe's 0.55. Opt-in, STRATA_PCIE_BALANCE=1 (one GPU, no batch slots, no --pcie-frac): - wait_flag_ge_stamped: the flag spin kernels also write the GPU clock as the plan arrives, as the PCIe part starts and as the GPU waits for the CPU's rows (no extra launch; captured only with the switch on); - the host times its pool per step; after each window, least squares with forgetting fit the pool's a + c n_cpu + d n_pcie (d: the link's DRAM reads slowing the pool - on a DRAM-bound pool moving experts to PCIe saves nothing) and the GPU's g0 + g n_pcie; - a layer then reads over PCIe the m of its misses that minimizes the longer side; every 64th layer that would keep them all on one side moves one, so both fits stay measured. IQ2_XS, RTX 5090 + 9950X3D, chat to the end of the turn: - one AVX2 pool worker: 16.77 / 17.17 -> 12.98 / 12.82 ms a round (fit: CPU 42-60 us an expert, GPU 28 us a PCIe expert; 0.8 of the misses move); - the 9950X3D's 16 workers: 3 pairs 12.19 -> 12.17 (pool DRAM-bound, few move). Off (the default) the logits and 32 tokens equal v0.1.39 (2K, fixed cache). Port of PR #1548 (commit a513394c4) onto 0.1.44.1. Conflicts with the 0.1.43 tail skip, PCIE_MIN1 and the fused waits resolved: the fused wait+copy launches stay off while the balance stamps are on. Docs line added. Co-authored-by: sergiywith <sergiywith@gmail.com>
This commit is contained in:
1 parent
c41c0ebbd1
commit
04be241a5a
8 files changed
+222
-8
No files matched your search
@@ -3812,8 +3812,9 @@ void expert_pool_dispatch_multi(ExpertDispatch& d, const float* x_f, const int32
|
||||
++d.tail_experts;
|
||||
}
|
||||
}
|
||||
const bool pcie_ok = d.pcie_num > 0 && d.src->pcie_layer(d.layers);
|
||||
int m = pcie_ok ? (nmiss * d.pcie_num) >> 8 : 0;
|
||||
// STRATA_PCIE_BALANCE (opt-in, #1548): the count comes from the measured CPU and GPU costs instead of the share
|
||||
const bool pcie_ok = (d.pcie_num > 0 || d.pcie_model.on) && d.src->pcie_layer(d.layers);
|
||||
int m = pcie_ok ? d.pcie_model.pick(nmiss, (nmiss * d.pcie_num) >> 8) : 0;
|
||||
// STRATA_PCIE_MIN1 (opt-in): the share rounds to 0 for 1-2 misses per layer, so the PCIe lane idles on the typical
|
||||
// decode step; with >= 2 misses give it at least one (the last in routing order). It only flies if its blob is
|
||||
// pinned (the fetch below checks), else it stays a CPU miss exactly as before. Read once.
|
||||
@@ -4009,6 +4010,7 @@ void expert_pool_dispatch_multi(ExpertDispatch& d, const float* x_f, const int32
|
||||
++d.multi_entries;
|
||||
}
|
||||
const auto c3 = std::chrono::steady_clock::now();
|
||||
if (d.plan != nullptr) d.plan->cpu_jobs = njobs;
|
||||
pt("run", njobs);
|
||||
if (njobs > 0) {
|
||||
if (native) d.pool->run_split_multi_native(lay.fmt[(size_t) d.layers], d.jobs_multi.data(), njobs);
|
||||
|
||||
Reference in new issue
Block a user