--aux-cpus: put the engine's threads that are neither pool workers nor the host on spare CPUs (Linux, off by default)

Header-only placement (include/strata/platform/aux_cpus.hpp): the spare CPU set (the host core's SMT siblings, then
CPUs of physical cores with no worker; never a CPU that shares a core with a worker), the list parser, threads the
engine creates pin themselves, threads somebody else created (the CUDA driver's) are moved by a sweep over
/proc/self/task after the pool exists and at every request; pool workers and the host thread are never moved.
--aux-cpus off|auto|LIST / STRATA_AUX_CPUS; per request strata_tune aux_cpus=0|1 (serve/server.py).
Default off: the hooks do nothing. tests/platform/aux_cpus_test covers the derivation and live threads (CPU only).
This commit is contained in:
noon-at-cgn authored and Niko1221 committed 2026-10-09 03:06:46 +02:00
1 parent f47349002c
commit 91f1e85dd1
13 files changed
+714 -10

No files matched your search

+5 -1
View File
@@ -2,6 +2,7 @@
#include "strata/core/expert_source.hpp"
#include "strata/core/foresight_swap.hpp"
#include "strata/core/on_device.hpp"
#include "strata/platform/aux_cpus.hpp"
#include "strata/core/remote_experts.hpp"
#include "strata/core/peer_experts.hpp"
#include "strata/kernels/cpu/expert_layout.hpp"
@@ -1949,7 +1950,10 @@ bool RouterLookahead::start(std::vector<std::vector<uint16_t>> routers, int64_t
k_ = k < 1 ? 1 : k > (int) n_expert ? (int) n_expert : k;
src_ = src;
x_.assign((size_t) (8 * n_embd), 0.f);
thread_ = std::thread([this] { run(); });
thread_ = std::thread([this] {
strata::aux_cpus::pin_current_thread();
run();
});
return true;
}