fix#5
Merged
Merged
Conversation
kmbandy
added a commit
that referenced
this pull request
Jul 6, 2026
…ed gate #5, default off) Today the pool carves n_slots FIXED slots each = max_page_size, so a small attn/norm page occupies a full max-size slot and the pool holds far fewer pages resident than VRAM allows (measured 863 pages, 64 slots x 69.7 MB). This gates a size-class arena: one buffer of the same budget, carved into variable-size slots on demand from per-class free lists + a high-water bump cursor + per-class LRU (mirrors the P4 host-tier slab). Packs many more pages resident -> less eviction, higher prefetch hit-rate. WP_SIZE_CLASS_SLOTS unset/0 -> byte-identical fixed-slot behavior (every alloc_slot/slot_ptr/slot_size/release_slot/lru_slot path gates on the flag). alloc_slot(size) threads the page size through all call sites; slot_size(idx) returns the slot's class so padding memset shrinks to near-zero. P3 P2P now exports the whole arena via pool_base()/pool_size() (== slot_ptr(0)/total in fixed mode). New tests exercise the size-class path with env set locally. Contracts preserved: pin/refcount skip+return -1, on_evict_ + per-class LRU, hot-set two-pass, stable slot addresses, per-slot padding size. KNOWN RISK (validate on hardware): size-class eviction can only reclaim a slot of class >= the requested size (no coalescing of small slots into a large one). A large REQUIRED page can therefore get alloc_slot -> -1 even when smaller unpinned slots are evictable, failing page_in_sync_. Fixed mode never had this. Fix direction if it bites: reserve N max-size slots, or add compaction. Gated off; safe to commit unvalidated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014ZRfPpL8XFzk1hep9MMg9P
kmbandy
added a commit
that referenced
this pull request
Jul 6, 2026
/#5) + known size-class risk Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014ZRfPpL8XFzk1hep9MMg9P
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Additional information
Requirements