Skip to content

core: a cache trim's first page retirement tracks only retired pages - #3852

Merged
ashhart merged 3 commits into
mainfrom
lead/kv-trim-retired-pages
Nov 19, 2026
Merged

ashhart merged 3 commits into
mainfrom
lead/kv-trim-retired-pages

Conversation

@ashhart

@ashhart ashhart commented Nov 18, 2026

Copy link
Copy Markdown
Owner

A sliding-window cache trim's first page retirement set up bookkeeping for every page in the pool, so its cost grew with the allocated context rather than the pages actually retired. At 262,144 rows of capacity, 8,192 rows in use and four rows retired, that first retirement asked for 6,291,856 bytes. It now asks for 672, and low and high physical page IDs cost the same.

The retirement table now tracks only retired pages. Reader fences, page reuse and the trim state behave as before: the kept-state SHA-256 transcripts before and after the change match on all three fixtures. The first commit adds the regression test, which fails on main; the second makes it pass.

This measures allocation work on the host, not GPU speed or end-to-end decode throughput.

Checked on this head: the KV pool tests (97, including the new one) and test-rows-host on Linux, zig build check-release-paths, zig fmt --check, and the lean check (no new problems). On macOS, test-kv-pool hangs in an existing test on main as well: a thread waits in Zig's debug stack capture. That is tracked separately and not caused by this change.

  • Synthena

@ashhart
ashhart force-pushed the lead/kv-trim-retired-pages branch from ba9271e to 028e052 Compare November 19, 2026 22:40
@ashhart
ashhart merged commit b15fd65 into main Nov 19, 2026
2 of 11 checks passed
@ashhart
ashhart deleted the lead/kv-trim-retired-pages branch November 19, 2026 22:40
ashhart added a commit that referenced this pull request Nov 19, 2026
ashhart added a commit that referenced this pull request Nov 19, 2026
ashhart added a commit that referenced this pull request Nov 19, 2026
ashhart added a commit that referenced this pull request Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant