vllm-kvblockd 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,56 @@
1
+ # ── PRIVATE RESEARCH VAULT — never commit ─────────────────────────
2
+ # All competitive research, strategy, business plans, drafts, and course material.
3
+ research/
4
+
5
+ # OS noise
6
+ .DS_Store
7
+
8
+ # Build artifacts
9
+ bin/
10
+ dist/
11
+ *.prof
12
+ *.test
13
+ testdata/corpus-large/
14
+
15
+ # External build dependencies fetched at build time (never vendored):
16
+ # ai-dynamo/nixl checkout for the adapters/nixl plugin (see its README).
17
+ build-deps/
18
+ adapters/nixl/build/
19
+
20
+ # Local env
21
+ .env
22
+
23
+ # Soak ARTIFACTS (logs, JSONL, pprof snapshots) — never the driver source
24
+ /soak
25
+ /soak.jsonl
26
+ bench/rigs/aws-soak/results/
27
+ bench/rigs/aws-dramgate/allocs-*.pb.gz
28
+
29
+ # Claude session rules — private, never push
30
+ CLAUDE.md
31
+
32
+ # Compiled command binaries accidentally built into the tree
33
+ /xferspike
34
+ /kvblockd
35
+ /kvbctl
36
+ cmd/xferspike/xferspike
37
+
38
+ # Python
39
+ __pycache__/
40
+ *.pyc
41
+ .pytest_cache/
42
+ .ruff_cache/
43
+ *.egg-info/
44
+ python/**/dist/
45
+
46
+ # mutation-testing artifacts
47
+ report.json
48
+ bench/rigs/*/.rig-state
49
+
50
+ # locally built bench binaries
51
+ /kvbench
52
+ /crash
53
+ /getbench
54
+ internal/store/modeltest/testdata/rapid/
55
+ bench/rigs/aws-s3soak/results/
56
+ .claude/
@@ -0,0 +1,31 @@
1
+ # DEFERRED: GPU end-to-end for the SecondaryTierManager altitude
2
+
3
+ `tier_manager.py` (KvblockdTierManager under vLLM's `OffloadingConnector` +
4
+ `TieringOffloadingSpec`) is **code-complete and unit-tested** against the
5
+ pinned v0.25.0 contract (UPSTREAM.lock): synthetic primary memoryview,
6
+ hand-built `JobMetadata`, byte-exact round-trips, RETRY→HIT lookup
7
+ transitions, failure jobs, and `drain_jobs` semantics — all green with a real
8
+ kvblockd daemon on the other end of the wire.
9
+
10
+ What is NOT yet proven: the `OffloadingConnector` path end-to-end on a real
11
+ GPU. That path cannot run on the vLLM CPU backend (it is CUDA/ROCm/XPU only),
12
+ so the GPU e2e is deferred rather than faked. There is no silently-skipped
13
+ green: the CPU e2e gate is carried by `connector.py` alone
14
+ (`.github/workflows/vllm-native-cpu.yml`).
15
+
16
+ ## Revisit trigger
17
+
18
+ Run the GPU validation session before any release or announcement that claims
19
+ the tier-manager (`OffloadingConnector`) path — the claim must not outrun the
20
+ evidence.
21
+
22
+ ## Validation checklist for that session
23
+
24
+ - vLLM v0.25.x + `vllm-kvblockd` installed; kvblockd daemon co-located.
25
+ - `OffloadingConnector` + `TieringOffloadingSpec` with the `kvblockd`
26
+ secondary tier; `kv_offload_benchmark.py`-style workload: 10k unique
27
+ 512-token requests, prefix caching off, Llama-3.1-8B (or a comparable
28
+ model that fits the available GPU).
29
+ - PASS = non-zero secondary-tier hits, byte-correct outputs,
30
+ `drain_jobs` clean shutdown under load, TTFT before/after captured.
31
+ - Result logged in `docs/INTEGRATIONS.md`.
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.4
2
+ Name: vllm-kvblockd
3
+ Version: 0.1.0
4
+ Summary: vLLM native KV-transfer adapter backed by kvblockd (KVConnectorBase_V1 + SecondaryTierManager)
5
+ Author-email: Rudray Mehra <rudraymehra@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Requires-Python: >=3.10
8
+ Requires-Dist: blake3>=0.4
9
+ Requires-Dist: kvblockd>=0.1.0
10
+ Requires-Dist: numpy
11
+ Provides-Extra: test
12
+ Requires-Dist: pytest>=8; extra == 'test'
13
+ Requires-Dist: torch; extra == 'test'
14
+ Provides-Extra: vllm
15
+ Requires-Dist: vllm<0.26,>=0.22; extra == 'vllm'
16
+ Description-Content-Type: text/markdown
17
+
18
+ # vllm-kvblockd
19
+
20
+ Native vLLM KVConnector-v1 for [kvblockd](https://github.com/rudraymehra/KVStash) —
21
+ the single-binary LLM KV-cache store (DRAM → NVMe → S3 over plain TCP).
22
+ This connector produced every published TTFT number in the repo
23
+ (receipts: `docs/BENCHMARKS.md`, `docs/CLAIMS.md`).
24
+
25
+ Quick start: `docs/INTEGRATIONS.md` → "vLLM native connector".
26
+ TP=1 only (refuses multi-GPU at boot); requires `PYTHONHASHSEED=0`.
@@ -0,0 +1,9 @@
1
+ # vllm-kvblockd
2
+
3
+ Native vLLM KVConnector-v1 for [kvblockd](https://github.com/rudraymehra/KVStash) —
4
+ the single-binary LLM KV-cache store (DRAM → NVMe → S3 over plain TCP).
5
+ This connector produced every published TTFT number in the repo
6
+ (receipts: `docs/BENCHMARKS.md`, `docs/CLAIMS.md`).
7
+
8
+ Quick start: `docs/INTEGRATIONS.md` → "vLLM native connector".
9
+ TP=1 only (refuses multi-GPU at boot); requires `PYTHONHASHSEED=0`.
@@ -0,0 +1,58 @@
1
+ # UPSTREAM.lock — the exact vLLM sources this adapter was written against.
2
+ #
3
+ # Pinned: vllm-project/vllm tag v0.25.0
4
+ # commit 702f4814fe54fabff350d43cb753ae3e47c0c276 (tag object, fetched 2026-07-20)
5
+ #
6
+ # Files read at that tag (copies vendored under upstream_refs/, names
7
+ # disambiguated because two of them are both called base.py):
8
+ #
9
+ # vllm/distributed/kv_transfer/kv_connector/v1/base.py
10
+ # -> upstream_refs/kv_connector_v1_base.py (KVConnectorBase_V1)
11
+ # vllm/distributed/kv_transfer/kv_connector/v1/example_connector.py
12
+ # -> upstream_refs/example_connector.py (SharedStorageConnector was
13
+ # RENAMED to ExampleConnector before v0.25.0 — the model this
14
+ # connector's design follows)
15
+ # vllm/distributed/kv_transfer/kv_connector/factory.py
16
+ # -> upstream_refs/kv_connector_factory.py (external load path +
17
+ # 3-arg-constructor enforcement + HMA gate)
18
+ # vllm/v1/kv_offload/base.py
19
+ # -> upstream_refs/kv_offload_base.py (OffloadKey, ReqContext,
20
+ # LookupResult, OffloadingSpec)
21
+ # vllm/v1/kv_offload/tiering/base.py
22
+ # -> upstream_refs/tiering_base.py (SecondaryTierManager,
23
+ # JobMetadata, JobResult)
24
+ # vllm/v1/kv_offload/tiering/factory.py
25
+ # -> upstream_refs/tiering_factory.py (SecondaryTierFactory)
26
+ # vllm/v1/kv_offload/tiering/async_lookup.py
27
+ # -> upstream_refs/tiering_async_lookup.py (AsyncLookupManager — the
28
+ # model for our _AsyncExistsBatcher; we vendor the PATTERN, not the import)
29
+ # vllm/v1/kv_offload/tiering/fs/manager.py
30
+ # -> upstream_refs/tiering_fs_manager.py (FileSystemTierManager — the
31
+ # model implementation: strides[0] block size, DualQueueThreadPool)
32
+ #
33
+ # Churn survey across the tested version window (verified against raw tags 2026-07-20):
34
+ # - KVConnectorBase_V1.__init__(vllm_config, role, kv_cache_config) — IDENTICAL
35
+ # 3-arg signature at v0.22.1, v0.23.0, v0.24.0, v0.25.0. The connector factory
36
+ # at v0.25.0 additionally REFUSES external connectors without a
37
+ # kv_cache_config kwarg, so the 3-arg form is mandatory and safe window-wide.
38
+ # - vllm/v1/kv_offload/tiering/{base,factory}.py present with the same
39
+ # SecondaryTierManager.__init__(offloading_spec, primary_kv_view, tier_type)
40
+ # at v0.22.1 and v0.23.0 (and v0.25.0). No documented skip is currently
41
+ # needed in the CI version matrix; the import check still prints SKIP (exit 0) if a
42
+ # future/older release lacks the tiering module.
43
+ # - HMA gate (v0.25.0 factory): a connector that does not implement SupportsHMA
44
+ # cannot be created unless --disable-hybrid-kv-cache-manager is passed.
45
+ # KvblockdConnector does not implement SupportsHMA in v0.1 -> the CPU e2e
46
+ # serve line carries that flag (bench/e2e/vllm-native-cpu.sh).
47
+ # - RFC-vs-merged delta: the RFC-era tier config carried module_path/class_name
48
+ # INSIDE the tier dict. The MERGED v0.25.0 SecondaryTierFactory ignores
49
+ # those keys (registry-only resolution) and passes every non-"type" key to
50
+ # the tier constructor. Working out-of-tree loading goes through
51
+ # OffloadingSpecFactory: spec_name=KvblockdTieringSpec +
52
+ # spec_module_path=vllm_kvblockd.tier_manager (importing our module is what
53
+ # registers the "kvblockd" tier type). KvblockdTierManager still ACCEPTS
54
+ # and ignores module_path/class_name kwargs so RFC-shaped configs don't
55
+ # crash. The merged code is the contract, not the RFC.
56
+ #
57
+ # Re-verify this file's survey (and refresh upstream_refs/) before every vLLM
58
+ # version bump — see the CHURN-WATCH header in src/vllm_kvblockd/connector.py.
@@ -0,0 +1,39 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "vllm-kvblockd"
7
+ version = "0.1.0"
8
+ description = "vLLM native KV-transfer adapter backed by kvblockd (KVConnectorBase_V1 + SecondaryTierManager)"
9
+ requires-python = ">=3.10"
10
+ readme = "README.md"
11
+ license = "Apache-2.0"
12
+ authors = [{ name = "Rudray Mehra", email = "rudraymehra@gmail.com" }]
13
+ dependencies = [
14
+ "kvblockd>=0.1.0",
15
+ "numpy", # JobMetadata.block_ids is an np.ndarray; also zero-copy tensor views
16
+ "blake3>=0.4", # config.py imports it directly (key derivation core) — declare
17
+ # what we import, never lean on kvblockd's transitive pin (matching version)
18
+ ]
19
+
20
+ [project.optional-dependencies]
21
+ # vllm is NEVER a hard runtime dep: the plugin is loaded BY vllm
22
+ # (kv_connector_module_path / spec_module_path), so a hard pin would make the
23
+ # package uninstallable next to a vllm the resolver dislikes. The pin lives
24
+ # here, as the tested window (the last 4 minor releases).
25
+ vllm = ["vllm>=0.22,<0.26"]
26
+ test = ["pytest>=8", "torch"]
27
+
28
+ [tool.hatch.build.targets.wheel]
29
+ packages = ["src/vllm_kvblockd"]
30
+
31
+ [tool.hatch.build.targets.sdist]
32
+ # Vendored upstream reference copies are for contract review, not distribution.
33
+ exclude = ["upstream_refs"]
34
+
35
+ [tool.ruff]
36
+ line-length = 100
37
+ target-version = "py310"
38
+ # Vendored vLLM reference copies (UPSTREAM.lock) are upstream's style, not ours.
39
+ extend-exclude = ["upstream_refs"]
@@ -0,0 +1,49 @@
1
+ """vllm-kvblockd — vLLM native adapter for the kvblockd KV-cache block store.
2
+
3
+ Two integration altitudes, one package (see UPSTREAM.lock for the pinned
4
+ vLLM contract):
5
+
6
+ CONNECTOR (CPU-capable, the e2e-gated one):
7
+ --kv-transfer-config '{"kv_connector": "KvblockdConnector",
8
+ "kv_role": "kv_both",
9
+ "kv_connector_module_path": "vllm_kvblockd.connector",
10
+ "kv_connector_extra_config": {
11
+ "kvblockd_endpoint": "kvblockd://127.0.0.1:9440",
12
+ "kvblockd_namespace": "vllm",
13
+ "kvblockd_token": "..."}}'
14
+ (v0.25 factory note: serve with --disable-hybrid-kv-cache-manager.)
15
+
16
+ SECONDARY TIER (GPU serving via OffloadingConnector; e2e deferred, DEFER.md):
17
+ --kv-transfer-config '{"kv_connector": "OffloadingConnector",
18
+ "kv_role": "kv_both",
19
+ "kv_connector_extra_config": {
20
+ "cpu_bytes_to_use": 64000000000,
21
+ "spec_name": "KvblockdTieringSpec",
22
+ "spec_module_path": "vllm_kvblockd.tier_manager",
23
+ "secondary_tiers": [{
24
+ "type": "kvblockd",
25
+ "endpoint": "kvblockd://127.0.0.1:9440",
26
+ "namespace": "vllm",
27
+ "token": "..."}]}}'
28
+ Importing vllm_kvblockd.tier_manager (which spec_module_path does) is
29
+ what registers the "kvblockd" tier type with SecondaryTierFactory.
30
+
31
+ Both classes import and instantiate WITHOUT vllm installed (the CI
32
+ import check relies on this); vllm is an optional extra, never a hard
33
+ dependency — the plugin is loaded BY vllm.
34
+ """
35
+
36
+ from vllm_kvblockd.config import AdapterConfig, block_chain_keys, chain_seed, fingerprint
37
+ from vllm_kvblockd.connector import KvblockdConnector, KvblockdConnectorMetadata
38
+ from vllm_kvblockd.tier_manager import KvblockdTierManager
39
+
40
+ __all__ = [
41
+ "AdapterConfig",
42
+ "KvblockdConnector",
43
+ "KvblockdConnectorMetadata",
44
+ "KvblockdTierManager",
45
+ "block_chain_keys",
46
+ "chain_seed",
47
+ "fingerprint",
48
+ ]
49
+ __version__ = "0.1.0"