Skip to content

perf(cache): skip complete CPU-hit blocks during disk reads - #1771

Merged
shihaobai merged 2 commits into
mainfrom
codex/disk-cache-suffix
Dec 1, 2026
Merged

shihaobai merged 2 commits into
mainfrom
codex/disk-cache-suffix

Conversation

@WANDY666

@WANDY666 WANDY666 commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Align the disk read start to the containing block and pass only the suffix of the cumulative page hashes and slot IDs to LightMem. This preserves partial-block reads at the CPU hit boundary.

Validation on H200-34: both tests in test_multimodal_cache_matching.py passed, covering the boundary case and a LightMem disk round trip.

Performance

This CPU microbenchmark uses a 64K-token cacheable prefix with 48K tokens already in CPU cache and 256 tokens per page. Times are medians per load_pages() call, measured with native read submission stubbed out.

Pages per LightMem block main This PR CPU time saved
1 108.1 µs 58.4 µs 49.7 µs
64 22.4 µs 15.0 µs 7.4 µs

Slicing before task preparation reduces the number of page indexes converted to a tensor and block keys formatted. Both paths submit the same block keys and destination slots to the native reader.

@shihaobai
shihaobai merged commit c75c187 into main Dec 1, 2026
1 check passed
@shihaobai
shihaobai deleted the codex/disk-cache-suffix branch December 1, 2026 08:24
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.

2 participants