Skip to content

fix#5

Merged
kmbandy merged 1 commit into
masterfrom
origin/master
Apr 23, 2026
Merged

fix#5
kmbandy merged 1 commit into
masterfrom
origin/master

Conversation

@kmbandy

@kmbandy kmbandy commented Apr 23, 2026

Copy link
Copy Markdown
Owner

Overview

Additional information

Requirements

@kmbandy
kmbandy merged commit 1f0fb2e into master Apr 23, 2026
15 of 54 checks passed
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant