[GW][HIP][LD] Link vetta-infer to strata-ctl; isolate GPU tests; size KV per pass
End-to-end verified: strata-ctl --serve spawns vetta-infer and serves the OpenAI-compatible API. Live: 'capital of France' -> Paris (finish stop), and Italian multi-turn context -> Napoli. Two wire-compat gaps closed: - accept '--serve <dir>' alias (strata-ctl engine_argv prepends --serve). - emit the EOS token as 'T <eos>' before 'DONE ... stop', matching the reference strata-inkling --serve (strata-ctl's dialect decoder reads the end-of-sampling channel token). chat parity now EXACT incl. EOS. GPU test isolation (the 5th full-model test OOM'd): HIP-visible VRAM is 48 GiB (model 18 GiB; one live instance peaks ~15 GiB and releases cleanly). The OOM was the harness, not a leak: the thread-local DeviceBuf pool retains buffers for each libtest worker thread's lifetime, so 5 engines' weights accumulated past 48 GiB. Fix: gw gpu_isolated() runs heavy tests under a serial lock with the pool disabled via a new safe hip::set_buf_pool_enabled (no env mutation, gw stays unsafe-free), so every drop hipFrees between tests. KV sizing: LayerState.k_cache/v_cache are now Vec sized to the passes a layer actually runs (core 3, prelude/coda 1) instead of 3 for every layer, removing ~1.6 GiB of unused KV at max context. Parity unchanged (EXACT 16 tok). Suite: workspace -D warnings green; 18 ld + 18 hip + 5 gw GPU; 5 Lean 0 sorryAx.
This commit is contained in:
1 parent
b9cac6d0df
commit
7790f48c27
7 files changed
+97
-18
No files matched your search
@@ -243,10 +243,10 @@ pub fn serve_gen(
|
||||
finish = "nonfinite";
|
||||
break;
|
||||
}
|
||||
if rep.token == eng.eos {
|
||||
finish = "stop";
|
||||
break;
|
||||
}
|
||||
// Emit the EOS token as `T <eos>` before closing, exactly like the
|
||||
// reference strata-inkling --serve: strata-ctl's Inkling dialect decoder
|
||||
// reads the end-of-sampling channel token to close the model turn.
|
||||
let is_eos = rep.token == eng.eos;
|
||||
match sess.on_token(rep.token as u32) {
|
||||
Ok(lines) => emit_all(emit, lines),
|
||||
Err(e) => {
|
||||
@@ -255,6 +255,10 @@ pub fn serve_gen(
|
||||
return;
|
||||
}
|
||||
}
|
||||
if is_eos {
|
||||
finish = "stop";
|
||||
break;
|
||||
}
|
||||
history.push(rep.token);
|
||||
if step + 1 == g.max_new {
|
||||
finish = "length";
|
||||
@@ -366,6 +370,7 @@ mod tests {
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn serve_gen_paris_wire() {
|
||||
crate::gpu_isolated(|| {
|
||||
let eng = InklingEngine::new("/mnt/models/Inkling/safetensors").unwrap();
|
||||
let g = match parse_serve_line("GEN 4 temperature=0 371,151451,149879,151194,149884", eng.vocab()).unwrap() {
|
||||
ServeCommand::Gen(g) => g,
|
||||
@@ -381,12 +386,14 @@ mod tests {
|
||||
let dones: Vec<&String> = lines.iter().filter(|l| l.starts_with("DONE ")).collect();
|
||||
assert_eq!(dones.len(), 1, "exactly one DONE per request");
|
||||
assert!(dones[0].ends_with("length") || dones[0].ends_with("stop"));
|
||||
});
|
||||
}
|
||||
|
||||
/// GPU integration: `GEN 0` pre-warm emits DONE with zero tokens (Theorem 7).
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn serve_gen_prewarm_no_tokens() {
|
||||
crate::gpu_isolated(|| {
|
||||
let eng = InklingEngine::new("/mnt/models/Inkling/safetensors").unwrap();
|
||||
let g = match parse_serve_line("GEN 0 371,151451", eng.vocab()).unwrap() {
|
||||
ServeCommand::Gen(g) => g,
|
||||
@@ -397,6 +404,7 @@ mod tests {
|
||||
serve_gen(&eng, &g, &stop, &mut |l| lines.push(l));
|
||||
assert!(!lines.iter().any(|l| l.starts_with("T ")), "pre-warm emits no tokens");
|
||||
assert!(lines.iter().any(|l| l.starts_with("DONE 0 2")), "DONE 0 2 ...");
|
||||
});
|
||||
}
|
||||
|
||||
/// GPU regression: multi-token decode must match the reference EXACTLY. This
|
||||
@@ -408,6 +416,7 @@ mod tests {
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn serve_gen_multi_token_parity() {
|
||||
crate::gpu_isolated(|| {
|
||||
let eng = InklingEngine::new("/mnt/models/Inkling/safetensors").unwrap();
|
||||
let g = match parse_serve_line("GEN 16 temperature=0 371,151451,149879,151194,149884", eng.vocab()).unwrap() {
|
||||
ServeCommand::Gen(g) => g,
|
||||
@@ -422,5 +431,33 @@ mod tests {
|
||||
.collect();
|
||||
let want = [152717, 13, 68014, 32, 13, 220, 44781, 164452, 68014, 33, 13, 220, 57345, 745, 164452, 68014];
|
||||
assert_eq!(tokens, want, "multi-token decode must match reference exactly");
|
||||
});
|
||||
}
|
||||
|
||||
/// GPU regression: the EOS token must be emitted as `T <eos>` before
|
||||
/// `DONE ... stop` (wire-compatible with strata-inkling --serve, whose
|
||||
/// dialect decoder in strata-ctl reads the end-of-sampling channel token).
|
||||
/// Sequence measured against the reference for the effort-0 capital chat.
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn serve_gen_emits_eos_then_stop() {
|
||||
crate::gpu_isolated(|| {
|
||||
let eng = InklingEngine::new("/mnt/models/Inkling/safetensors").unwrap();
|
||||
let ids = "200002,200004,34182,279,154554,150628,25,220,15,200010,200000,200004,1775,149884,149876,151451,149879,151194,30,154710,149881,150011,151290,13,200010,200001,200004";
|
||||
let g = match parse_serve_line(&format!("GEN 8 temperature=0 {ids}"), eng.vocab()).unwrap() {
|
||||
ServeCommand::Gen(g) => g,
|
||||
_ => panic!("expected Gen"),
|
||||
};
|
||||
let stop = AtomicBool::new(false);
|
||||
let mut lines: Vec<String> = Vec::new();
|
||||
serve_gen(&eng, &g, &stop, &mut |l| lines.push(l));
|
||||
let tokens: Vec<i32> = lines.iter()
|
||||
.filter(|l| l.starts_with("T "))
|
||||
.map(|l| l[2..].trim().parse().unwrap())
|
||||
.collect();
|
||||
assert_eq!(tokens, [3967, 198, 200010, 200006], "EOS must be emitted as the last T");
|
||||
let done = lines.iter().find(|l| l.starts_with("DONE ")).expect("one DONE");
|
||||
assert!(done.ends_with(" stop"), "finish must be stop, got {done}");
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user