Sliding window 30+20 + GEN 0 cache pre-warm (pre-warm-on-change)
Window: MAIN_AREA 30 + BUFFER 20 (same 50 cap) halves rotation frequency. context: shared compose_prefix (byte-exact prefix of compose) + notepad_fingerprint (rendered header body, excludes updated_at). inkling: build_prefix_ids renders without finish_prompt. service: prewarm() sends GEN 0 directly (no PerfMeter/DB). sessions: schedule_prewarm at turn end on pending rotation OR notepad-dirty (ws=0 normalized); session_chat loads only the window subset. examples/prewarm_bench.rs: joint GEN 0 -> RESUME bench, PASS on HIP (cached==L==385). Verified live all-agent: notepad write -> pre-warm 1468 -> next turn cached_tokens==1468. Tests: prefix property, opener-skip, GEN 0 primitive, notepad fingerprint. Suite 162 passed + 3 ignored.
This commit is contained in:
1 parent
0ce84581a4
commit
a52bec97d4
12 files changed
+650
-59
No files matched your search
@@ -153,3 +153,22 @@ async fn request_stop_signals_the_owner_without_taking_the_lock() {
|
||||
assert!(engine.is_idle());
|
||||
engine.shutdown().await.unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn gen_zero_prefills_without_generating() {
|
||||
// The cache pre-warm primitive: GEN 0 prefills the ids and emits one DONE
|
||||
// with zero generated tokens (no T lines), prompt_tokens = the prefix length.
|
||||
let engine = start_mock().await;
|
||||
let out = engine
|
||||
.generate(0, &Sampling::default(), &[1, 2, 3, 4], |_| {})
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(out.tokens.is_empty(), "GEN 0 generates no tokens");
|
||||
let done = out.done.unwrap();
|
||||
assert_eq!(done.generated, 0);
|
||||
assert_eq!(done.prompt_tokens, 4);
|
||||
assert_eq!(done.finish, "length");
|
||||
// the wires are free again: a real turn queues/runs normally after the warm
|
||||
assert!(engine.is_idle());
|
||||
engine.shutdown().await.unwrap();
|
||||
}
|
||||
Reference in new issue
Block a user