mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1598] [CLOSED] --aux-cpus: helper threads on spare CPUs, +10% decode on a layer split (Linux, opt-in) #3555
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3555
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/1598
Author: @noon-at-cgn
Created: 10/8/2026
Status: ❌ Closed
Base:
main← Head:pr/aux-cpus📝 Commits (2)
75ac2b0--aux-cpus: put the engine's threads that are neither pool workers nor the host on spare CPUs (Linux, off by default)1e80ce9docs: replace the evidence placeholder in the thread-placement section with the measured result📊 Changes
13 files changed (+725 additions, -10 deletions)
View changed files
📝
CMakeLists.txt(+5 -0)📝
docs/DETAILS.md(+42 -0)➕
include/strata/platform/aux_cpus.hpp(+361 -0)📝
serve/server.py(+6 -0)📝
serve/test_server.py(+8 -0)📝
src/core/expert_source.cpp(+5 -1)📝
src/core/session.cpp(+2 -0)📝
src/kernels/cpu/pool.cpp(+2 -0)📝
src/ngram/ple_reader.cpp(+2 -1)📝
src/platform/direct_file.cpp(+3 -2)📝
src/prefill/prefill.cpp(+14 -1)📝
src/program/generate.cpp(+58 -5)➕
tests/platform/aux_cpus_test.cpp(+217 -0)📄 Description
Title
Issue: Related: none found (searched 2026-10-07 and 2026-10-08). Nearby: #1166 moves the host thread to its SMT sibling, #501 / #626 pin the host, #1436 gives replicas disjoint core masks; none places the engine's other threads.
Summary
Why it matters: the host thread is the one that answers every layer's doorbell during decode. Threads the engine starts later inherit its single CPU, and the CUDA driver's threads float over every CPU, the pool workers' included, so the host gets preempted in the middle of a window. Moving those threads to spare CPUs gave +10% decode on our box with no change to any result:
--aux-cpusoffauto--aux-cpus off|auto|LIST(orSTRATA_AUX_CPUS):autotakes the host core's SMT siblings, then CPUs of physical cores with no worker, never one that shares a core with a worker. It moves threads only, never a result. Default off: the hooks do nothing.What changed
include/strata/platform/aux_cpus.hpp(new, header only): spare-CPU derivation, list parser,pin_current_thread(), a sweep over/proc/self/taskfor the driver's threads, a way back to the old mask. Workers and host are never moved. Empty off Linux.src/program/generate.cpp: flag, variable, start-up plan, per-request switch; pins the adaptive tier's threads, stdin reader, watchdog.expert_source.cpp,ple_reader.cpp,direct_file.cpp,prefill.cpp: pin the look-ahead, PLE and file readers, prefill helpers, Stager copy threads (STRATA_AUX_STAGER=0leaves those).session.cpp,pool.cpp: mark host and workers.serve/server.py,serve/test_server.py:strata_tune {"aux_cpus": 1|0}is forwarded.tests/platform/aux_cpus_test.cpp+CMakeLists.txt;docs/DETAILS.md: section "Thread placement".Extra Notes
Measured on engine 0.1.40.3 (
d5ea713) plus this change; the branch itself is cut from mainfb58e0d.Machine: 2x RTX 3080 20 GB (220 W), Xeon E5-2696 v4 (16 pool workers, host on CPU 2, helpers on CPU 24), 24 logical CPUs in the container, UD-Q4_K_XL, layer split 23,
--batch-mtp, adaptive tier on. Same binary in every arm, only the flag differs.auto. That preemption causes the loss is our inference; the counters do not prove it.Checked:
aux_cpus_test, pool and direct-file CPU tests,python -m unittest discover -s serve(594 tests), CUDA build. Not built or run: HIP, SYCL, Windows, macOS. The no-spare-CPU path was not tested.STRATA_ADAPT_JOB_CPUstill wins for the adaptive tier's job thread. Not covered: the Python launcher, the host thread.Context: this change is part of the setup measured in the community benchmark #1640.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.