Repository navigation
[None][feat] Add native sleep and wakeup to KV cache manager V2 - #20087
yizhang-nv wants to merge 30 commits into
Conversation
e091bcb to
5d355ff
Compare
adf9793 to
bf67d6b
Compare
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
V2 keeps KV data in native pools, so tagged allocations made while building a V2 manager hold metadata only. Preserve them as a whole in KvCacheCreator.build_managers instead of wrapping individual buffers, which also covers every V2 subclass. - Zero FP4 MLA pools on wakeup: the fixed-width PV path reads whole V-scale pages, including tiles the initial zeroing covered. - Reject KV sleep for MiniMaxM3 index-V buffers, which are indexed by slot outside the native pools. - Warn instead of failing when the host tier is smaller than the GPU quota for CPU/PINNED sleep. Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.com>
|
@yizhang-nv I opened draft successor #21221 from my fork to drive this work forward. It preserves all 30 original commits, authorship and sign-offs, with the same head The scope remains native V2 sleep/wake. Snapshot-specific integration and transfer reconstruction will stay separate, and the current transceiver restriction remains in place. Rebase, review and fresh verification are pending in the successor. Can we use #21221 for follow-up development and keep this PR as the original reference? I have left this PR open. Please flag any pending work or review context to carry forward; targeted KV-manager review would be welcome. |
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
@chienchunhung LGTM |
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Consolidate the implementation from NVIDIA#20087, originally authored by Yi Zhang, and continue it in NVIDIA#21221. Release native GPU and host backing through V2 cache tiers. Preserve metadata addresses and refresh KV/SSM indices before graph replay. Integrate with MPI and Ray memory controls and add native, graph, and serving tests. Include the successor self-review fix: reject V2 KV sleep with KV-moving connectors until their memory-registration lifecycle is supported. Keep capacity-only connectors and model-only sleep available. Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Description
Enable sleep/wakeup with KV-cache manager V2 while retaining native cache objects and their logical state. Wakeup uses ordinary page and scratch allocation. GPU pool virtual addresses and metadata buffers stay stable; refreshed KV/SSM indices let captured CUDA graphs address the restored pages even when slot IDs change.
NONE/MEMSETdiscard reusable prefixes and release GPU and HOST pool backing without backing discarded contents up to disk. Retained cold pages are initialized through the existing codec;MEMSETzeros restored GPU contents.CPU/PINNEDpreserve contents through native host tiers and migration. Host-capacity checks run only when a preserving KV release is requested; weights-only and discard modes do not impose a global backup quota.Sleep drains user requests; internal dummy/padding caches survive. HOST base addresses and individual slot IDs may change. The CUDA Graph contract is stable GPU pool/metadata addresses with current indices. Transition failures retain the existing fail-stop service contract.
Test Coverage
Validation uses a shared B200 development container (
umbriel-b200-043) and the standard SM100 build. Full stdout/stderr are saved outside the repository under/home/scratch.yizhan_sw_1/logs/2026-10-16/umbriel-b200-043/trim_tests_*. Tests remain selected by the existing CI lists.The test changes are limited to migrating the existing sleep tests to real V2 execution (asserting the live manager is
KVCacheManagerV2, on every rank for TP2) plus one check per new contract. Results ata1fac4449c:test_kvcm2_integration,test_py_executor,test_kv_pool_rebalance,test_seq_slot_sizing,test_ray_sleep_state,test_sleep_collective_rpc_guards): 684 passed (the guard file was re-run after a stub fix: 86 passed).Independent native-state and Python-integration reviews, fresh skeptical review, and actual
claude-opus-5-5review plus focused follow-up cover the final implementation. Review fixes retain failed-resume scratch cleanup, globally order cold-page initialization, correct the graph test's K/V-page indexing and preserve replay controls. The later test-only trimming was not re-run through the external reviews. Wakeup latency is unmeasured; full hybrid-model graph replay and the optional non-affine GDN descriptor fallback have not been exercised at runtime.PR Checklist