Add GPU Automatic Prefix Caching (APC) with LRU eviction - #25
Open
agrawal-nikita wants to merge 5 commits into
Open
Add GPU Automatic Prefix Caching (APC) with LRU eviction#25agrawal-nikita wants to merge 5 commits into
agrawal-nikita wants to merge 5 commits into
Conversation
added 5 commits
July 28, 2026 11:34
Signed-off-by: Nikita Agrawal <Nikita.N.Agrawal@ibm.com>
Signed-off-by: Nikita Agrawal <Nikita.N.Agrawal@ibm.com>
Signed-off-by: Nikita Agrawal <Nikita.N.Agrawal@ibm.com>
Signed-off-by: Nikita Agrawal <Nikita.N.Agrawal@ibm.com>
Signed-off-by: Nikita Agrawal <Nikita.N.Agrawal@ibm.com>
Collaborator
|
hi @agrawal-nikita - could you rebase this PR and can we review this / prepare for merging? |
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.
Adds vLLM-style Automatic Prefix Caching to the worker: KV-cache blocks already resident in GPU HBM are matched, ref-counted, and shared across requests (and across turns of the same session) instead of being recomputed. Requests skip prefill for matched prefix tokens. When HBM fills, an LRU eviction policy frees idle blocks and optionally writes them through to the CPU DRAM KVC tier so the prefix stays reusable from a slower tier.
How to test
OPAL_LOG_LEVEL=DEBUG PYTHONPATH=pwd:$PYTHONPATH python ./opal/main.py -c ./configs/defaults_apc.jsonLook for GPU APC enabled: policy=LRUPolicy... at startup,
[LRU.evict] lines on eviction, and [
APC] [Evict] ... Proactively migrated N block(s) to CPU DRAM from the monitor.
Per-tier hit rates appear in the run statistics.