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:
adm committed 2026-11-26 19:12:59 +01:00
1 parent 0ce84581a4
commit a52bec97d4
12 files changed
+650 -59

No files matched your search

+9 -1
View File
@@ -94,8 +94,16 @@ while True:
out(f"DONE {n} {len(ids)} 1.0 2.0 {'abort' if stopped else 'length'}")
continue
# GEN 0 (max_new = 0): prefill only, no generation — the cache pre-warm
# primitive. One DONE, zero tokens, prompt_tokens = len(ids), finish "length".
max_new = int(parts[1]) if parts[1].lstrip("-").isdigit() else 0
if max_new == 0:
out("RESUME 0")
out(f"DONE 0 {len(ids)} 5.0 0.0 length 0 0 0")
continue
out("RESUME 1")
out("PP 2 4 0.9 2222.2")
for t in (101, 102, 103, 104, 105):
out(f"T {t}")
out("DONE 5 4 12.5 34.0 stop 3 4 1")
out("DONE 5 4 12.5 34.0 stop 3 4 1")