Persist disjoint Strata and Qwen CPU placement with bounded TTS threads

This commit is contained in:
Mikei386 committed 2026-10-22 14:12:30 +02:00
1 parent 0e3ad518d3
commit ba4904ea78
13 files changed
+356 -11

No files matched your search

+77
View File
@@ -0,0 +1,77 @@
# CPU-Zuordnung für Strata und Qwen-TTS
Die optionale Datei `DECK_STATE_DIR/cpu-partition.json` trennt die Linux-CPU-
Zuordnung beider Worker. Ohne diese Datei bleibt das bisherige Verhalten erhalten.
Auf Athena (Ryzen 5 5600, sechs echte Kerne, zwölf SMT-Threads) ist vorgesehen:
```json
{
"version": 1,
"strata": [0, 1, 2, 3, 6, 7, 8, 9],
"qwen_tts": [4, 5, 10, 11],
"qwen_generation_threads": 2,
"qwen_codec_threads": 2,
"qwen_cpu_flash_attention": false
}
```
Die IDs sind **logische CPUs**, keine Anzahl echter Kerne. Die SMT-Paare dieses
Hosts lauten 0/6, 1/7, 2/8, 3/9, 4/10 und 5/11. Strata erhält vier echte Kerne,
Qwen-TTS zwei. Diese Host-Zuordnung nicht ungeprüft auf einen anderen Rechner
übertragen. Deck prüft verfügbare IDs, Überschneidungen und vollständige SMT-Paare
vor dem Start; eine ungültige Zuordnung wird nicht still ignoriert.
## Umsetzung und Grenzen
`cpu_partition.py` setzt die Startaffinität vor `exec`, ohne `preexec_fn` im
mehrthreadigen Deck-Server. Der Strata-Python-Server und seine Kinder erben die
Strata-Zuordnung. Zusätzlich verwendet die unveränderte offizielle Engine ihre
dokumentierten Optionen: Host auf CPU0, Expertenpool auf1/2/3, Hilfsthreads auf
6/7/8/9 (`--host-core`, `--pool-cores`, `--pool-workers`, `--aux-cpus`). Bei
aktivierter Aufteilung hält Deck `strata_tune.aux_cpus=1` gesetzt, weil ein
requestseitiges Abschalten die native Hilfsthread-Zuordnung aufheben würde.
Die übrigen Sampling-, GPU-, Kontext- und Slot-Einstellungen bleiben erhalten.
Qwen erbt den gesamten TTS-CPU-Bereich ohne zusätzliche Bindung jedes einzelnen
Bibliotheksthreads. Threadzahlen und CPU-Flash-Attention sind ausdrücklich in
derselben Datei gespeichert; auf zwei echten Kernen werden zwei Generierungs-
und zwei Codec-Threads verwendet, CPU-Flash-Attention aus. Zwei Codec-Frames
und Nice10 bleiben erhalten. Die vorherigen vier plus vier Threads waren im
Zweikern-Test deutlich langsamer. Eine andere optionale Einstellung wird nicht
aus einem versteckten Hook oder einer veränderten Bibliothek geladen.
Ohne Aufteilungsdatei bleiben vier plus vier Threads und CPU-Flash-Attention an.
Das sind Affinitätseinstellungen für diese beiden Worker, **keine exklusive
Host-Cpuset-Partition**. Betriebssystem, andere Dienste und Deck-Hilfsprozesse
können diese CPUs weiterhin verwenden. Native Bibliotheken könnten Affinität
selbst verändern; deshalb bei Laufzeitupdates alle Threadmasken unter echter
Last erneut prüfen. Die Strata-Optionen decken auch ihre eigens gepinnten
Pool-, Host- und Hilfsthreads ab. Keine Bibliothek wurde dafür gepatcht.
## Installation, Neustart und Wiederherstellung
Die Datei gehört dem Deck-Dienstbenutzer (0600). Änderungen im Leerlauf
vornehmen und die Worker regulär neu laden. Laufende Arbeit nicht abbrechen.
Die aktuelle Containerinstallation benötigt insgesamt `cpu_limit:12` in ihrer
Host-`installation.json`; das gemeinsame Acht-CPU-Limit würde beide Worker
weiterhin zusammen drosseln. `deploy/install.py` übernimmt diesen bestehenden
Manifestwert bei jeder Neuerstellung. Die CPU-Datei liegt im persistenten
Zustandsvolume und ist in Decks validierter, verschlüsselter
Konfigurationssicherung enthalten.
Für den nativen Debian/systemd-Betrieb dieselbe Datei in die ausdrücklich
konfigurierte Zustandswurzel zurückspielen, Dienstbenutzerrechte erhalten und
den aktualisierten Deck-Code einschließlich `cpu_partition.py` installieren.
Der übergeordnete Dienst muss alle zugeordneten CPUs erreichen dürfen:
auf diesem Host `CPUQuota=1200%`, kein übergeordnetes `AllowedCPUs`, das einen
der beiden Bereiche ausschließt. Die Worker brauchen weder Docker-Zugriff noch
einen zusätzlichen Dienst. Vor dem Start auf neuer Hardware die reale Topologie
prüfen und die Zuordnung anpassen. Der vollständige native Neuaufbau bleibt
innerhalb der bestehenden [Installationsanforderungen](../deploy/NATIVE_INSTALL_REQUIREMENTS.md)
noch separat abzunehmen; diese Änderung behauptet keinen vollständigen Host-Restore.
Rückfall im Leerlauf: `cpu-partition.json` aus der aktiven Zustandswurzel entfernen
und Worker regulär neu starten. Die Quota kann anschließend auf den vorherigen
Manifestwert8 zurückgesetzt werden. Ein Rückfall auf ein älteres Deck-Image
benötigt ebenfalls das Entfernen dieser Datei, da ältere Versionen sie nicht
auswerten. Keine Profile, Stimmen, Modelle oder Zugangsdaten dafür löschen.
+14
View File
@@ -1,3 +1,17 @@
## Strata/TTS CPU allocation ·22 October2026
Saved allocation:Strata0–3/6–9(four physical cores/eight SMT threads),
Qwen-TTS4–5/10–11(two physical cores/four SMT threads). Shared Deck quota12,
RAM59GiB and GPU settings unchanged. Qwen uses explicitly saved2generation/
2codec threads, CPU-Flash-Attention off; no native per-thread pinning.
No Hermes configuration or extra persistent service was introduced.
This is worker affinity, not host-wide exclusive CPUs or a guarantee of smooth
Conduit playback. Final live TTS test:17.76s audio in22.07s (RTF1.243), all
observed worker affinities disjoint. Two physical TTS cores still fall short of
realtime. Earlier CPU8 entries below describe their historical state.
[Configuration/native restore](CPU_PARTITION.md) ·
[Activation and test limitations](maintenance/2026-10-22-cpu-partition.md).
## Qwen Q4 CPU speech ·22 October2026
Michael selected Qwen0.6B Q4_K_M with the existing Q8 codec and Anna reference.
+7 -2
View File
@@ -40,8 +40,13 @@ dieselbe private Anna-Referenz und die bereits installierte CPU-Laufzeit0.4.2.
## Ressourcen und Verhalten
- Vier Generierungs- und vier Decoder-Threads, zwei Codec-Frames (160ms),
CPU-Fused-Attention; feste deterministische Sampling-Einstellungen wie im Test.
Optionale feste Trennung von Strata und Qwen auf vollständige physische Kerne:
[CPU-Zuordnung, native Einrichtung und Rückfall](CPU_PARTITION.md).
- Ohne CPU-Aufteilungsdatei vier Generierungs- und vier Decoder-Threads,
CPU-Fused-Attention. Die optionale Aufteilungsdatei speichert abweichende
Threadzahlen und den CPU-Attention-Modus ausdrücklich. Zwei Codec-Frames
(160ms) und feste deterministische Sampling-Einstellungen bleiben erhalten.
- Gespeicherte Referenzmerkmale werden im persistenten Worker einmal vorbereitet.
Referenzdaten verlassen Athena nicht. Native Bibliotheksausgaben gelangen
nicht in das JSON-Steuerprotokoll; Prompts werden nicht protokolliert.
@@ -0,0 +1,106 @@
# Strata/TTS CPU partition ·22 October2026
Michael requested eight logical CPUs for Strata and the remaining four for
Qwen-TTS, without sharing physical cores between them. Ryzen5 5600 has six
physical cores and twelve SMT threads. The saved allocation is Strata0–3/6–9
(four physical cores), Qwen4–5/10–11(two physical cores).
The shared Deck quota must be12, not8. Otherwise a cgroup-wide eight-CPU time
budget still couples the two workers. The host install manifest persists12;
`DECK_STATE_DIR/cpu-partition.json` persists their independent placements.
RAM remains59GiB; GPU order, split16, reserves1024MiB each, Strata IQ3 dual
slots/context, QwenQ4/codec/Anna and all Hermes settings are unchanged.
## Implementation and persistence
Deck's small exec launcher sets initial Linux affinity. Official Strata flags
place its host on the first allowed core, pool workers on1/2/3, helpers on6–9.
The installed engine expects `--host-core first`, not a numericCPU ID. An
initial numeric argument caused startup rejection; the previous container and
manifest were restored before the corrected version was activated. No user
chat/profile/model files were changed during that recovery.
The original upstream engine/server and native Qwen library remain unmodified.
Qwen inherits its process affinity; its separate native per-thread masks remain
off. The final explicit settings use2generation/2codec threads and disable
CPU-Flash-Attention on this two-core allocation, preserving2codecframes/Nice10.
Without a partition file, the old4/4/CPU-Flash-Attention defaults remain intact.
Deck holds Strata's helper placement on per request.
Settings validation rejects shared physical cores, missing SMT siblings,
unavailable IDs and malformed masks. No partition file means previous behavior.
The new file is part of validated encrypted settings backup; its real settings
restore and removal when restoring an older backup were tested locally.
Maintenance stage:`/opt/athena-deck-dev/cpu-partition-20261022`. Public source
transfers have old/new SHA256 checks; originals are scoped code-only copies.
The only private rollback artifact is the previous installation manifest.
No broad state/appdata backup, private audio copy or new auxiliary service.
Activation checks the normal authenticated API twice for0active requests.
Only the existing Deck container is restarted. A minimal code-only image layer
uses the normal explicit installer FILES list on the current runtime; no apt,
compiler, model download, image flattening or Hermes image build is involved.
Prior image remains available; stale stopped maintenance containers are removed
after successful verification.
See[CPU configuration and native restore](../CPU_PARTITION.md) for the complete
file, Linux/systemd requirements, host-affinity limitations and rollback. The
full native installer/host restore remains an existing open qualification.
## Validation
32 focused CPU/Qwen/Strata/settings-backup tests passed with the existing
bundled Python/cryptography runtime. The broader98-test attempt passed the
streaming/endpoint tests with2pre-existing skips; its2backup cases initially
needed the already installed cryptography dependency and then passed in the
focused run. Python compilation and diff whitespace checks passed.
The bounded benchmark sends synthetic LLM and TTS requests through the existing
normal Athena API. It discards PCM after counting bytes/arrival times; no user
utterance or recording is inspected. `before.json` and `after.json` contain
technical results only. It is not an actual Conduit phone/playback test.
Before partitioning:18.08s PCM in18.855s (RTF1.043), firstPCM0.660s,
longest arrival gap1.500s, computed additional startup reserve6.718s. Strata
ran10.764s/566completion tokens, with10.032s overlap. The initial process-tree
observer missed thread-owned children and recorded no baseline masks; that
observer was fixed before the final affinity test. Baseline timing is unaffected.
This single request pair is not a replicated causal throughput benchmark.
The initial partition trial with4/4threads and native per-thread masks produced
the same18.08s PCM in133.568s (RTF7.388); the trace confirmed all Strata threads
stayed on0–3/6–9 and Qwen on4–5/10–11. Allowing the existing Qwen threads to
move within its four logical CPUs did not fix it:163.544s/18.08s, RTF9.046.
These intermediate worker settings were rejected. They must not be documented
as successful realtime speech merely because the CPU sets were disjoint.
A separate bounded native CPU test with2/2threads, no explicit per-thread mask
and no CPU-Flash-Attention environment override generated18.08s in22.488s
(RTF1.244), firstPCM0.384s, load3.032s. It used the existing host CPU venv,
the same public Q4/Q8-codec files and existing private Anna reference in place,
without copying/saving audio. The transient unit was limited to90s,6GiB/no swap,
the same four TTS logical CPUs, private devices/network andNice10. This host
Python test is not identical to the production container runtime or evidence
of a complete Conduit fix. An additional2/1test with explicit CPU-Flash-Attention
did not finish successfully within its bounded probe;1/1was therefore not run.
Thread count and the CPU attention path were not independently isolated in
these trials, so do not assign their speed difference to only one setting.
## Final production verification
Active image:`athena-deck-standalone:c7daa70ee03cd944`, shared quota12,
saved2/2thread/CPU-Flash-Attention-off settings. Original Strata dual model
reloaded through the normal one-token API:HTTP200,46.292s including loading.
The final test sent only the synthetic TTS passage because an existing Strata
request was active and Michael said“jetzt los”. No additional LLM request was
started; the existing request was not read or cancelled. Its exact generation
overlap and load characteristics were not measured, so this is not a matched
comparison with the earlier synthetic pair.
Final TTS:17.76s PCM in22.068s, RTF1.243, firstPCM0.571s, longest packet gap
0.425s, calculated extra startup reserve3.875s. All observed Qwen threads had
mask4–5/10–11. Strata host0, experts1/2/3, all other observed native threads6–9.
No observed physical-core overlap. This verifies the requested partition;
**two physical TTS cores still did not sustain realtime speech**. No actual
Conduit call/handset playback was triggered or claimed fixed. The separate
thread/attention tuning changed the sample's duration slightly; no audio-
identity or perceptual-quality equivalence claim is made.