generate: review fixes for the admission switches

STRATA_SLOT_CKPT_MOVE: an active slot is a slot source only when the main
drafter's rows come along or are not drafted from (no --mtp, --batch-mtp,
or a batch admission).  The slot copy takes the main layers' cells only, so
a solo GEN beside active slots would draft from another conversation's
drafter rows below its start; it reads its prompt as with the switch off.

STRATA_CKPT_THREADS: a checkpoint thread widens its CPU mask before it
goes to the aux CPUs, so the mask the aux placement restores (a request
with aux_cpus=0) is the wide one, not the host thread's single CPU.

STRATA_ADMIT_MERGE_FIRST: a merged first window counts as one row in the
STRATA_DECODE_TIMING window statistics (its prompt rows are not decode rows).
This commit is contained in:
havok2-htwo authored and Niko1221 committed 2026-10-14 06:59:57 +02:00
1 parent ca239cdabc
commit a923889bd2
1 file changed
+8 -6
+8 -6
View File
@@ -1683,14 +1683,13 @@ public:
private:
static void spread_current_thread() {
#if defined(__linux__)
if (strata::aux_cpus::enabled()) {
strata::aux_cpus::pin_current_thread();
return;
}
// wide first: the mask the aux placement keeps as this thread's own is the one restore() puts back (a request
// with aux_cpus=0), and the host's one CPU must not be it
cpu_set_t all;
CPU_ZERO(&all);
for (int c = 0; c < CPU_SETSIZE; ++c) CPU_SET(c, &all);
(void) sched_setaffinity(0, sizeof all, &all); // the kernel keeps the CPUs the process may use
strata::aux_cpus::pin_current_thread(); // (a no-op while the feature is off)
#endif
}
void loop(size_t k) {
@@ -11382,7 +11381,10 @@ int main(int argc, char** argv) {
for (int b = 0; b < (int) bs.size(); ++b) {
const BSlot& sl = bs[(size_t) b];
const bool idle_source = !sl.active && sl.cached;
if (sl.cvec != want_cvec || !(idle_source || (sl.active && slot_ckpt_move_env()))) continue;
// (an active slot only where the drafter's rows come along or are not drafted from: the copy
// takes the main layers' cells, so the main drafter would keep another conversation's below it)
const bool active_source = sl.active && slot_ckpt_move_env() && (!use_mtp || batch_mtp || admit_slot >= 0);
if (sl.cvec != want_cvec || !(idle_source || active_source)) continue;
if (idle_source && (int64_t) sl.ids.size() > std::max(resume, slot_tokens) && starts_with(sl.ids, {})) {
slot_source = b;
slot_tokens = (int64_t) sl.ids.size();
@@ -13265,7 +13267,7 @@ int main(int argc, char** argv) {
const Clock::time_point tw3 = Clock::now();
auto msd = [](Clock::time_point a0, Clock::time_point b0) { return std::chrono::duration<double, std::milli>(b0 - a0).count(); };
dt_run += msd(tw0, tw1); dt_commit += msd(tw1, tw2); dt_draft += msd(tw2, tw3);
++dec_windows; dec_T += T;
++dec_windows; dec_T += merged ? 1 : T; // a merged window's prompt rows are not decode rows
}
pcie_auto_step(req_pcie_frac); // the default share, refined from the CPU pool's speed (PcieAuto); a request's own share is left alone
if (adapt_thr.joinable()) {