fix(runtime): Original serve load now loads the retained expert source

leleka-inference --backend-mode original failed at Load with
'MoeWeightCache::new_original_prompt_arena: InputRead': only the optimized (experimental)
path called load_resident_expert_source, the Original path assumed the serve smoke had done it.
Load it for the Original path (RAM-resident; LELEKA_ORIGINAL_SERVE_EXPERT_SOURCE=mapped selects
the low-RAM mapping). run-e2e.sh fails fast on a leleka-load failure.

Found by the first stack run on the RTX 5090 (job 940); verified by job 941.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Pavlo Ratushnyi
2026-10-17 14:57:56 +02:00
co-authored by Claude Sonnet 5.5
parent b4d12bdd53
commit 9b56aec2ec
2 changed files with 43 additions and 0 deletions
+40
View File
@@ -1288,6 +1288,46 @@ fn serve_load(
));
}
}
// The Original serve path reads its routed experts from the retained model bank (CPU pool, PCIe staging, VRAM tier
// fills): the RAM-resident source as the serve smoke does, or with LELEKA_ORIGINAL_SERVE_EXPERT_SOURCE=mapped the
// low-RAM read-only mapping of shard 0 (the laptop profile). Without it the stack cannot open (found by the e2e run:
// `new_original_prompt_arena: InputRead`).
if original.is_some() {
let mapped = std::env::var("LELEKA_ORIGINAL_SERVE_EXPERT_SOURCE").is_ok_and(|v| v == "mapped");
#[cfg(target_os = "linux")]
let loaded_source = if mapped {
binding.load_mapped_expert_source()
} else {
binding.load_resident_expert_source()
};
#[cfg(not(target_os = "linux"))]
let loaded_source = {
let _ = mapped;
binding.load_resident_expert_source()
};
loaded_source.map_err(|error| {
use std::io::Write;
let _ = writeln!(
std::io::stderr().lock(),
"leleka-load phase={:?} class={error:?} (retained expert source)",
LoadPhase::SelectedBinding
);
load_failure(
LoadPhase::SelectedBinding,
match error {
InputBindingError::Allocation => exhausted("resident expert RAM unavailable"),
InputBindingError::Read => unavailable("resident expert source read failed"),
_ => invalid("resident expert source admission failed"),
},
)
})?;
if shared.shutdown.load(Ordering::Acquire) {
return Err(load_failure(
LoadPhase::Cancellation,
unavailable("native load cancelled"),
));
}
}
let driver = Driver::load()
.map_err(|_| load_failure(LoadPhase::Driver, unavailable("CUDA driver unavailable")))?;
let device = driver
+3
View File
@@ -137,6 +137,9 @@ for i in $(seq 1 480); do
st=$(CLI status 2>&1)
if echo "$st" | grep -Eq '"model_ready" *: *true'; then ready=1; break; fi
alive "$PID_INF" || { log "leleka-inference died during load"; tail -30 "$OUT/inference.log"; exit 5; }
if grep -q '^leleka-load phase=' "$OUT/inference.log" 2>/dev/null; then
log "load failed:"; grep -E '^leleka-(load|serve)' "$OUT/inference.log" | head -10; echo "$st" | head -12; exit 5
fi
sleep 5
done
LOAD_S=$(( $(date +%s) - T_LOAD ))