chore: stabilize current head before Phase 10a QC

This commit is contained in:
2026-05-10 23:00:25 +01:00
parent c95a5da077
commit b463c32f17
24 changed files with 238 additions and 89 deletions

View File

@@ -113,7 +113,9 @@ mod tests {
fn with_thread_env_lock<R>(body: impl FnOnce() -> R) -> R {
use std::sync::Mutex;
static THREAD_ENV_LOCK: Mutex<()> = Mutex::new(());
let _lock = THREAD_ENV_LOCK.lock().expect("tuning thread-env lock poisoned");
let _lock = THREAD_ENV_LOCK
.lock()
.expect("tuning thread-env lock poisoned");
body()
}
@@ -126,8 +128,10 @@ mod tests {
with_thread_env_lock(|| {
std::env::remove_var("MAGNOTIA_INFERENCE_THREADS");
let n = inference_thread_count(Workload::Llm, false);
assert!(n >= MIN_INFERENCE_THREADS && n <= MAX_INFERENCE_THREADS,
"got {n}, expected within [{MIN_INFERENCE_THREADS}, {MAX_INFERENCE_THREADS}]");
assert!(
(MIN_INFERENCE_THREADS..=MAX_INFERENCE_THREADS).contains(&n),
"got {n}, expected within [{MIN_INFERENCE_THREADS}, {MAX_INFERENCE_THREADS}]"
);
});
}
@@ -175,8 +179,10 @@ mod tests {
std::env::remove_var("MAGNOTIA_INFERENCE_THREADS");
crate::power::with_override(Some(PowerState::OnAc), || {
let n = inference_thread_count(Workload::Llm, true);
assert!(n <= GPU_FLOOR_LLM.max(MIN_INFERENCE_THREADS),
"Llm with GPU offload should clamp to {GPU_FLOOR_LLM}, got {n}");
assert!(
n <= GPU_FLOOR_LLM.max(MIN_INFERENCE_THREADS),
"Llm with GPU offload should clamp to {GPU_FLOOR_LLM}, got {n}"
);
assert!(n >= MIN_INFERENCE_THREADS);
});
});
@@ -196,11 +202,12 @@ mod tests {
});
}
const _: () = assert!(GPU_FLOOR_WHISPER >= GPU_FLOOR_LLM);
#[test]
fn whisper_gpu_floor_is_at_least_llm_gpu_floor() {
// Architectural invariant: whisper retains CPU work even when
// GPU-offloaded; its floor must not be lower than the LLM's.
assert!(GPU_FLOOR_WHISPER >= GPU_FLOOR_LLM);
}
#[test]