Repository navigation
Share prefix KV cache between instances and hosts through a selene pool manager - #92
Merged
Merged
Conversation
yatesdr
force-pushed
the
selene-pr2
branch
2 times, most recently
from
October 26, 2026 17:18
7625d0a to
4d8288e
Compare
yatesdr
force-pushed
the
selene-pr2
branch
3 times, most recently
from
October 28, 2026 06:12
f49fb20 to
989c798
Compare
Add an optional Selene pool so Flare instances can share prefix KV checkpoints across processes and hosts. Without --prefix-cache-pool, Flare keeps using Selene's in-process host tiers as before. - selene::shared holds the protocol and the definitions both sides use: wire messages, framing, rank slices, identity, limits, the record format and disk engine, the prefix index, regions, TLS setup and RDMA verbs. - The selene manager (binary selene) owns one pool's DRAM and NVMe store, keeps an index of what every attached instance holds, and brokers lookup, claim, copy and release with fencing and quarantine. Copies use shared-memory windows on one host, a TCP or TLS data channel between hosts, relay through the manager, and experimental write-only RDMA. - The pool client performs lookups, restores, exports and puts. A single-process instance is a world of one rank; multi-host tensor-parallel instances use per-rank slices and one rank link. - Host tiers never drop a record mid-chain. Records move VRAM to DRAM to local NVMe to the pool, demoted ahead of need and dropped only at the end of the chain. An opt-in --prefix-cache-drain-on-shutdown persists DRAM-only records on a clean stop. - Flare exposes checkpoint export chains and eviction headroom, attaches the pool at startup within its host and device budgets, and degrades to local tiers when the manager is unavailable. Design-Signed-Off-By: yatesdr; design-review=1c01
yatesdr
marked this pull request as ready for review
October 28, 2026 06:27
This was referenced Oct 29, 2026
Raydius
added a commit
to Raydius/flare-local-inference
that referenced
this pull request
Nov 2, 2026
Merge local main (31 landed commits: Selene pool prefix-cache sharing NVIDIA#92, row-scaled FP8 DSpark weights NVIDIA#121, FlashInfer source identities NVIDIA#120) into wt/dflash-s-e2vk so the mixed-prefill branch can fast-forward main. The merge is main's own landed history; auto-merge touched docs/cli-design.md and flare/src/cli.rs without conflicts. No product code authored in this commit; branch tests were recorded per change at their own commits. Design-Signed-Off-By: omp agent (qllm/qLLM); design-review=1c01
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.
What
This PR shares prefix KV cache between Flare instances and hosts. It builds on #80 (the host tiers in
selene/) and #101 (the flattened layout).selene(library) gains the pool client and asharedmodule of definitions used by both sides.selene-manager(new crate, binaryselene) is an optional sidecar that owns one pool's DRAM and NVMe store.Without
--prefix-cache-pool, Flare runs selene's host tiers in process as today: no sidecar, nothing new running.Pool addresses take three forms:
unix:PATH: the same host, using shared memory;HOST:PORT: plain TCP;tls:HOST:PORT: TLS.How it works
--prefix-cache-drain-on-shutdown[=DURATION]opts in to persisting them, most recent first.rdmacargo feature, as a write-only carrier: one signalled write per window.Layout
selene/src/shared/selene/src/pool/selene-manager/src/store/(records),pool/(sessions, index, claims, relay),data/(data channel and RDMA), service and config.The dependency direction is one-way: the manager depends on
selene, andselenenever depends on the manager. CI runs both crates' tests.Validation
CPU, on this commit:
test-supportruntime-package,server--testschecks pass for both crates.GPU (SM120; Qwen TP1 and TP2, and a TP4 MoE model), on the same code before the final rebase:
Correctness. Every restore checked matched a GPU-resident continuation by its top-20 logprob distribution: local and pooled, from DRAM and NVMe, across replicas, after restarts, and across hosts.
Restore speed, 32k-token prefix:
Across hosts over plain TCP, a 30k-token restore takes about 0.6 s.
Concurrency. Up to 4 concurrent cross-replica restores, with no recomputes.
Performance against main. Offload off, local tiers and pool all fell within main's own run-to-run spread for TTFT, decode and throughput, on TP1, TP2 replicas and the TP4 model.
Faults. Manager kill and restart, source killed mid-export, replica restart and TLS refusals were all safe and fell back to local tiers. Manager disk recovery came back intact.
Soaks. 30–100 minutes with mixed lengths and random restarts: no errors outside injected faults, and flat resource use.
Bursts on a TP4 MoE model, on this commit:
Local tiers keep the same number of records as main under eviction.
Status and limitations
--prefix-cache-disk-transportand theprefix_cache.disk_transportsetting. Thedirect(GPUDirect Storage) value was declared but rejected as unavailable, sostagedis the only transport and needs no option.