merge: claude/conversation-cache follow-ups (cache-off control in the smoke, job 411 record: resumed chat B greedy-equal to a full read, TTFT 9.5 s -> 1.6 s)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -373,7 +373,10 @@ fn timed(stack: &mut OriginalServeStack<'_, '_>, prompt: &[u32], max_new: usize,
|
||||
tokens.extend_from_slice(round);
|
||||
Ok(())
|
||||
}, &mut || false)
|
||||
.unwrap_or_else(|e| panic!("conversation smoke request failed: {e:?}"));
|
||||
.unwrap_or_else(|e| {
|
||||
eprintln!("CONV FAILED n={} error={e:?} health={:?}", prompt.len(), stack.health());
|
||||
panic!("conversation smoke request failed: {e:?}")
|
||||
});
|
||||
assert_eq!(outcome.produced, tokens.len());
|
||||
(tokens, first.unwrap_or(f64::NAN), started.elapsed().as_secs_f64() * 1e3, stack.reused_tokens())
|
||||
}
|
||||
@@ -384,7 +387,8 @@ fn timed(stack: &mut OriginalServeStack<'_, '_>, prompt: &[u32], max_new: usize,
|
||||
/// tokens of the same request read from the empty prompt (`forget_conversation`). Prints TTFT for both.
|
||||
/// Extra inputs: `LELEKA_CONVERSATION_SYSTEM_REPEAT` (system prompt repetitions, default 120 = a root checkpoint
|
||||
/// past 2048 tokens), `LELEKA_CONVERSATION_MAX_NEW` (default 48). `STRATA_CKPT_REREAD=1` turns every restore
|
||||
/// into a re-read (the Original's check of the checkpoint).
|
||||
/// into a re-read (the Original's check of the checkpoint). `LELEKA_CONVERSATION_CACHE=off` runs the same requests
|
||||
/// with the cache off (the control: nothing is reused and the second read of B must repeat the first).
|
||||
#[test]
|
||||
#[ignore = "one explicitly scheduled inherited KAR+MTP load and GPU; no live-owner overlap"]
|
||||
fn original_serve_conversation_smoke_resume_matches_a_full_read() {
|
||||
@@ -423,7 +427,9 @@ fn original_serve_conversation_smoke_resume_matches_a_full_read() {
|
||||
let mut config = StackConfig::new(8192);
|
||||
config.capacity = env::var("LELEKA_ORIGINAL_SERVE_CAPACITY").ok().and_then(|v| v.parse().ok()).unwrap_or(1024);
|
||||
config.rt_directory = env::var_os("LELEKA_ORIGINAL_SERVE_RT_DIR").map(PathBuf::from);
|
||||
config.conversation = Some(crate::qwen_forward::original_serve_stack::ConversationConfig::original());
|
||||
let cache = env::var("LELEKA_CONVERSATION_CACHE").map_or(true, |v| v != "off");
|
||||
config.conversation = cache.then(crate::qwen_forward::original_serve_stack::ConversationConfig::original);
|
||||
eprintln!("CONV cache={}", if cache { "on" } else { "off" });
|
||||
let mut stack = match OriginalServeStack::open(&binding, context.as_ref(), Rc::clone(&context), config) {
|
||||
Ok(stack) => stack,
|
||||
Err(failure) => panic!("the Original serve stack did not open: {}", failure.describe()),
|
||||
@@ -453,7 +459,11 @@ fn original_serve_conversation_smoke_resume_matches_a_full_read() {
|
||||
second.extend(tokenizer.encode(next_turn, true).expect("second turn"));
|
||||
let (cached, ttft_b, total_b, reused_b) = timed(&mut stack, &second, max_new, eos);
|
||||
eprintln!("CONV B(cache) n={} reused={reused_b} ttft={ttft_b:.1}ms total={total_b:.1}ms out={cached:?}", second.len());
|
||||
assert!(reused_b > 0 || env::var_os("STRATA_CKPT_REREAD").is_some(), "the second turn must resume from a checkpoint");
|
||||
if cache {
|
||||
assert!(reused_b > 0 || env::var_os("STRATA_CKPT_REREAD").is_some(), "the second turn must resume from a checkpoint");
|
||||
} else {
|
||||
assert_eq!(reused_b, 0, "nothing is reused with the cache off");
|
||||
}
|
||||
assert_eq!(stack.health(), None);
|
||||
|
||||
// 3. the same second request read from the empty prompt
|
||||
|
||||
+25
-6
@@ -103,8 +103,8 @@ DMA share and adaptive swaps (they need the registered model bank), and every re
|
||||
|
||||
## Conversation cache
|
||||
|
||||
`--prompt-cache N` (`StackConfig::conversation`; **off by default** until the real-model smoke below has passed
|
||||
on a GPU, the Original's default is 6), `--prompt-cache-every N` (16384), `--prompt-cache-root N` (2048),
|
||||
`--prompt-cache N` (`StackConfig::conversation`; **off by default**: the real-model smoke below passed once (job
|
||||
411); the Original's default is 6, to be adopted after the uncovered cases listed under Open items have a run), `--prompt-cache-every N` (16384), `--prompt-cache-root N` (2048),
|
||||
`--turn-token ID` (248045, negative = none), `STRATA_CKPT_REREAD=1` (re-read instead of restore, the Original's
|
||||
check of a checkpoint). Code: `qwen_forward/original_serve_conversation.rs` over the golden-tested policy in
|
||||
`conversation/manager.rs`.
|
||||
@@ -176,9 +176,11 @@ first missing producer's name; that is the expected result until they are bound.
|
||||
* Commit/draft overlap of the Original is traded for exactness (see above).
|
||||
* `draft_first` (CLI only), scaled RoPE tables (`STRATA_ROPE_TABLE`), multi-stage and vision requests are not
|
||||
supported.
|
||||
* Conversation cache: bound (see above) but off by default and not yet run on a GPU; parking and live
|
||||
continuation after an undrafted last window are not bound. The one-token prompt (no prompt append, so no
|
||||
streamed-KV resolver) is fixed by `OriginalQsaMappedJournal::ensure_resolver` at assemble (GPU test passes).
|
||||
* Conversation cache: bound (see above), off by default; one real-model run so far (job 411, below). Parking
|
||||
and live continuation after an undrafted last window are not bound; cancellation, sampled requests, prompts
|
||||
past one root/periodic checkpoint and `STRATA_CKPT_REREAD` have no GPU run yet. The one-token prompt (no
|
||||
prompt append, so no streamed-KV resolver) is fixed by `OriginalQsaMappedJournal::ensure_resolver` at assemble
|
||||
(model-free GPU test and the real-model smoke pass).
|
||||
* Host-side rolling costs not measured: 12 small device checkpoints per committed round, one GDN readback per
|
||||
request when `settle_state` is on.
|
||||
|
||||
@@ -188,4 +190,21 @@ Same inputs as the serve smoke; `--exact backend::original_serve_smoke::original
|
||||
It serves a one-token prompt first, then chat A, then chat B = A + reply + a new user turn (must resume,
|
||||
`reused > 0`), then B again read from 0 (`forget_conversation`), asserting equal greedy tokens and printing TTFT
|
||||
on the `CONV` lines, then a new chat sharing the system prompt (root checkpoint). Optional
|
||||
`LELEKA_CONVERSATION_SYSTEM_REPEAT` (120), `LELEKA_CONVERSATION_MAX_NEW` (48), `STRATA_CKPT_REREAD=1`.
|
||||
`LELEKA_CONVERSATION_SYSTEM_REPEAT` (120), `LELEKA_CONVERSATION_MAX_NEW` (48), `STRATA_CKPT_REREAD=1`;
|
||||
`LELEKA_CONVERSATION_CACHE=off` is the control (same requests, nothing reused).
|
||||
|
||||
Job 411 (RTX 5090, 2026-10-16, branch `claude/conversation-cache` 562f35d = bring-up e9995d8 + 791a4fa, capacity
|
||||
1024, budget 24 GiB, greedy, max_new 48, one run each, no warm-up beyond the requests listed):
|
||||
|
||||
| request | n | reused | TTFT ms (cache on) | TTFT ms (cache off control) |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| one-token prompt (first after open) | 1 | 0 | 684 | 1155 |
|
||||
| chat A (cold) | 2300 | 0 | 9787 | 9183 |
|
||||
| chat B = A + reply + new turn | 2364 | 2297 | 1646 | 9547 (reused 0) |
|
||||
| chat B read from 0 (`forget_conversation`) | 2364 | 0 | 10331 | 9619 |
|
||||
| new chat, same system prompt (root) | 2301 | 2286 | 983 | 9144 (reused 0) |
|
||||
|
||||
Greedy tokens of B resumed == B read from 0 (38 tokens, identical) in the cache-on run; the off run also
|
||||
repeats B exactly. Chat A's last two of 48 tokens differ between the two runs (both read A cold, reused 0): a
|
||||
run-to-run difference unrelated to the cache, not investigated. This is one sample per cell, not a
|
||||
performance qualification.
|
||||
|
||||
Reference in New Issue
Block a user