fix(app): resident launcher apps are not games, and the TTS keeps its share of the card
On the game PC, Wallpaper Engine (steamapps\common\wallpaper_engine) and the Riot client's crash handler (Riot Games\Riot Client) were taken for games running behind other windows as the services started, so no reading of other programs was kept and the game stage placed 0 GiB of experts instead of 2. - A launcher's own folders and non-game apps under its game folder are not game folders (Steamworks Shared, wallpaper_engine; Launcher, Epic Online Services; Riot Client). - The game log tab names the program found running at the start. - The placement keeps the TTS's share (MeloTTS, 1005 MiB, M0 tts_melo) beside the STT's, and takes the worker's loaded models off what the card holds, so a start (TTS not yet loaded) and a switch (TTS loaded) place the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -253,8 +253,8 @@ pub trait LlmBrain: Send + Sync {
|
||||
/// `ready` (with whether a game runs) or `paused`.
|
||||
fn llm_state(&self, state: &str, game: bool) -> bool;
|
||||
async fn wait_llm_idle(&self, id: u64, t: std::time::Duration) -> bool;
|
||||
/// The STT worker's model is loaded (on the graphics card).
|
||||
fn stt_on_card(&self) -> bool;
|
||||
/// What the worker's loaded models (STT, TTS) hold on the graphics card, in MiB.
|
||||
fn worker_models_mib(&self) -> i64;
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
@@ -268,8 +268,8 @@ impl LlmBrain for WorkerClient {
|
||||
async fn wait_llm_idle(&self, id: u64, t: std::time::Duration) -> bool {
|
||||
WorkerClient::wait_llm_idle(self, id, t).await
|
||||
}
|
||||
fn stt_on_card(&self) -> bool {
|
||||
self.hello().is_some_and(|h| h.stt_ready)
|
||||
fn worker_models_mib(&self) -> i64 {
|
||||
self.hello().map_or(0, |h| crate::placement::worker_models_mib(h.stt_ready, h.tts_ready))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ async fn perf_loop(settings: crate::settings::Settings, llm: Arc<Llm>, brain: Ar
|
||||
if !brain.wait_llm_idle(id, std::time::Duration::from_secs(120)).await {
|
||||
crate::warn_log!("perf", "Warning: the brain did not finish its answers in 2 minutes; switching anyway");
|
||||
}
|
||||
let ended = match llm.switch(&settings, want, brain.stt_on_card(), game()).await {
|
||||
let ended = match llm.switch(&settings, want, brain.worker_models_mib(), game()).await {
|
||||
Ok(ended) => {
|
||||
retry.succeeded();
|
||||
actual = want;
|
||||
@@ -328,7 +328,7 @@ async fn perf_loop(settings: crate::settings::Settings, llm: Arc<Llm>, brain: Ar
|
||||
}
|
||||
Err(e) => {
|
||||
crate::error_log!("perf", "the LLM did not start in the {want:?} stage: {e}; going back to {actual:?}");
|
||||
let back = match llm.switch(&settings, actual, brain.stt_on_card(), game()).await {
|
||||
let back = match llm.switch(&settings, actual, brain.worker_models_mib(), game()).await {
|
||||
Ok(ended) => ended,
|
||||
Err(e) => {
|
||||
crate::error_log!("perf", "the LLM did not come back in the {actual:?} stage either: {e}");
|
||||
@@ -396,8 +396,8 @@ mod perf_tests {
|
||||
self.0.lock().unwrap().push("waited".into());
|
||||
true
|
||||
}
|
||||
fn stt_on_card(&self) -> bool {
|
||||
false
|
||||
fn worker_models_mib(&self) -> i64 {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -497,7 +497,7 @@ mod perf_tests {
|
||||
#[cfg(unix)]
|
||||
#[tokio::test]
|
||||
async fn going_back_to_normal_while_the_game_runs_keeps_the_reading_from_before_the_game() {
|
||||
// 24 GB card; other programs 1460 MiB at the start. A game (2500 MiB) starts; the first
|
||||
// 24 GB card; other programs `OTHERS` at the start. A game (2500 MiB) starts; the first
|
||||
// game start fails and the normal stage comes back while the game still runs; the second
|
||||
// try works. It must count other programs from the reading before the game, not one that
|
||||
// has the game in it.
|
||||
@@ -508,7 +508,7 @@ mod perf_tests {
|
||||
let exe = crate::strata::tests::fake_strata(&l, &format!(
|
||||
"case \"$*\" in *'--context 16384'*'expert-vram=0'*) ;; *'--context 16384'*) if [ ! -e '{fo}' ]; then touch '{fo}'; exit 4; fi;; esac; rm -f '{g}'; echo 'strata-q36: (1.10 GiB staging) on 16 CPU threads' >> '{log}'; echo 'Strata is serving.'",
|
||||
fo = failed_once.display(), g = l.data.join("gone").display(), log = log.display()));
|
||||
let others = Arc::new(std::sync::atomic::AtomicI64::new(1460));
|
||||
let others = Arc::new(std::sync::atomic::AtomicI64::new(crate::strata::tests::OTHERS));
|
||||
let calls = l.data.join("calls");
|
||||
let o2 = others.clone();
|
||||
let llm = Arc::new(Llm::with_exe(l.clone(), exe).with_gpu(Arc::new(move || {
|
||||
@@ -518,7 +518,7 @@ mod perf_tests {
|
||||
})));
|
||||
let s = crate::settings::parse_settings(&serde_json::json!({"llm": {"port": port}})).unwrap();
|
||||
llm.start(&s).await.unwrap();
|
||||
others.store(1460 + 2500, Ordering::SeqCst);
|
||||
others.store(crate::strata::tests::OTHERS + 2500, Ordering::SeqCst);
|
||||
let brain = Arc::new(FakeBrain::default());
|
||||
let task = tokio::spawn(perf_loop(s, llm.clone(), brain.clone(), Arc::new(|| true), Duration::from_millis(300)));
|
||||
for _ in 0..100 {
|
||||
@@ -529,8 +529,8 @@ mod perf_tests {
|
||||
assert!(failed_once.exists(), "the first game start failed");
|
||||
assert_eq!(llm.stage_view()["stage"], serde_json::json!("gaming"));
|
||||
let probe16 = crate::placement::Probe { context: 16384, parallel: 1, gpu: "GPU-test".into(), model_mib: 9874, staging_gib: 1.1 };
|
||||
let right = crate::placement::game(24576, 1460, &probe16, 8192).expert_gib;
|
||||
let wrong = crate::placement::game(24576, 1460 + 2500, &probe16, 8192).expert_gib;
|
||||
let right = crate::placement::game(24576, crate::strata::tests::OTHERS, &probe16, 8192).expert_gib;
|
||||
let wrong = crate::placement::game(24576, crate::strata::tests::OTHERS + 2500, &probe16, 8192).expert_gib;
|
||||
assert_ne!(right, wrong);
|
||||
assert!(launches(&l).last().unwrap().contains(&format!("--set expert-vram={right} ")), "{:?}", launches(&l));
|
||||
}
|
||||
@@ -551,8 +551,8 @@ mod perf_tests {
|
||||
async fn wait_llm_idle(&self, _id: u64, _t: Duration) -> bool {
|
||||
true
|
||||
}
|
||||
fn stt_on_card(&self) -> bool {
|
||||
false
|
||||
fn worker_models_mib(&self) -> i64 {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user