[TRTLLM-11875][feat] BREAKING: MambaCacheManager based on KVCacheManagerV2 & agentic prefix caching - #16598
Conversation
|
/bot run |
|
PR_Github #60284 [ run ] triggered by Bot. Commit: |
|
PR_Github #60284 [ run ] completed with state
|
94db6dc to
6ffdf55
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #60398 [ run ] triggered by Bot. Commit: |
|
PR_Github #60398 [ run ] completed with state
|
73e76f7 to
f7770b5
Compare
|
PR_Github #61884 [ run ] triggered by Bot. Commit: |
|
/bot run --disable-fail-fast |
|
PR_Github #61884 [ run ] completed with state
|
|
PR_Github #61901 [ run ] triggered by Bot. Commit: |
|
/bot run --disable-fail-fast |
|
PR_Github #61901 [ run ] completed with state
|
|
PR_Github #61909 [ run ] triggered by Bot. Commit: |
|
/bot run --disable-fail-fast |
|
PR_Github #61909 [ run ] completed with state
|
|
PR_Github #61911 [ run ] triggered by Bot. Commit: |
|
PR_Github #61911 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #62087 [ run ] triggered by Bot. Commit: |
|
PR_Github #62087 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #62096 [ run ] triggered by Bot. Commit: |
|
PR_Github #62096 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #62139 [ run ] triggered by Bot. Commit: |
|
PR_Github #62139 [ run ] completed with state |
…dings Migrates tensorrt_llm/runtime/kv_cache_manager_v2 from pure Python to a C++ implementation under cpp/tensorrt_llm/batch_manager/kv_cache_manager_v2/ with nanobind bindings compiled into bindings.so, preserving the same public API. The dispatcher __init__.py selects the backend via TLLM_KV_CACHE_MANAGER_V2_BACKEND (default "cpp"); both backends pass the shared test suite. CODEOWNERS assigns the new C++ tree to trt-llm-kv-cache-manager-devs. Includes ports of subsequent main features: commit-min-snapshot + SWA-slot reservation, SHA-256 block-key hashing, CUDA-graph request IDs, event manager and stats API to C++, uint64 ReuseScope salt/lora_id, resume-utilization KV constraints, per-conversation KV cache block reuse (PlannedDropHandle), the reuse-probe _KVCache refactor (compute the ReuseMatch once in the manager and pass it into the cache, NVIDIA#14333), SSM-snapshot iteration stats (NVIDIA#16598), the simplified plan_committed_block_drop (db117e6276), and an MPI teardown fix for the unittest/bindings CI shard. Migration planning docs (TODO.md, MIGRATION_PLAN_CPP.md, CPP_MIGRATION_PLAN_MAIN_15633.md) are kept on a separate branch. Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
…dings Migrates tensorrt_llm/runtime/kv_cache_manager_v2 from pure Python to a C++ implementation under cpp/tensorrt_llm/batch_manager/kv_cache_manager_v2/ with nanobind bindings compiled into bindings.so, preserving the same public API. The dispatcher __init__.py selects the backend via TLLM_KV_CACHE_MANAGER_V2_BACKEND (default "cpp"); both backends pass the shared test suite. CODEOWNERS assigns the new C++ tree to trt-llm-kv-cache-manager-devs. Includes ports of subsequent main features: commit-min-snapshot + SWA-slot reservation, SHA-256 block-key hashing, CUDA-graph request IDs, event manager and stats API to C++, uint64 ReuseScope salt/lora_id, resume-utilization KV constraints, per-conversation KV cache block reuse (PlannedDropHandle), the reuse-probe _KVCache refactor (compute the ReuseMatch once in the manager and pass it into the cache, NVIDIA#14333), SSM-snapshot iteration stats (NVIDIA#16598), the simplified plan_committed_block_drop (db117e6276), and an MPI teardown fix for the unittest/bindings CI shard. Migration planning docs (TODO.md, MIGRATION_PLAN_CPP.md, CPP_MIGRATION_PLAN_MAIN_15633.md) are kept on a separate branch. Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
…n the precheck Main's d6a2d25 (NVIDIA#16598) grew _resolve_kv_cache_manager_v2_auto a third optional param and taught it to read llm_args.cache_transceiver_config to gate a V2 model default on the NIXL Python transceiver. The precheck's contract test pinned the old 2-param signature, so it failed in CI, and the driver's shim lacked cache_transceiver_config, so a V2-default model would have silently fallen back to V1 via the except path. Resolve the transceiver runtime before the V2 setting (the resolver treats an unresolved 'auto' runtime as non-PYTHON), hand the resolver the cache config through the shim, and re-anchor the contract test on the call shape the driver actually uses: first two positional params fixed, any later addition must carry a default. Signed-off-by: Chuang Zhu <111838961+chuangz0@users.noreply.github.com>
…n the precheck Main's d6a2d25 (NVIDIA#16598) grew _resolve_kv_cache_manager_v2_auto a third optional param and taught it to read llm_args.cache_transceiver_config to gate a V2 model default on the NIXL Python transceiver. The precheck's contract test pinned the old 2-param signature, so it failed in CI, and the driver's shim lacked cache_transceiver_config, so a V2-default model would have silently fallen back to V1 via the except path. Resolve the transceiver runtime before the V2 setting (the resolver treats an unresolved 'auto' runtime as non-PYTHON), hand the resolver the cache config through the shim, and re-anchor the contract test on the call shape the driver actually uses: first two positional params fixed, any later addition must carry a default. Signed-off-by: Chuang Zhu <111838961+chuangz0@users.noreply.github.com>
…dings Migrates tensorrt_llm/runtime/kv_cache_manager_v2 from pure Python to a C++ implementation under cpp/tensorrt_llm/batch_manager/kv_cache_manager_v2/ with nanobind bindings compiled into bindings.so, preserving the same public API. The dispatcher __init__.py selects the backend via TLLM_KV_CACHE_MANAGER_V2_BACKEND (default "cpp"); both backends pass the shared test suite. CODEOWNERS assigns the new C++ tree to trt-llm-kv-cache-manager-devs. Includes ports of subsequent main features: commit-min-snapshot + SWA-slot reservation, SHA-256 block-key hashing, CUDA-graph request IDs, event manager and stats API to C++, uint64 ReuseScope salt/lora_id, resume-utilization KV constraints, per-conversation KV cache block reuse (PlannedDropHandle), the reuse-probe _KVCache refactor (compute the ReuseMatch once in the manager and pass it into the cache, NVIDIA#14333), SSM-snapshot iteration stats (NVIDIA#16598), the simplified plan_committed_block_drop (db117e6276), and an MPI teardown fix for the unittest/bindings CI shard. Migration planning docs (TODO.md, MIGRATION_PLAN_CPP.md, CPP_MIGRATION_PLAN_MAIN_15633.md) are kept on a separate branch. Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
…dings Migrates tensorrt_llm/runtime/kv_cache_manager_v2 from pure Python to a C++ implementation under cpp/tensorrt_llm/batch_manager/kv_cache_manager_v2/ with nanobind bindings compiled into bindings.so, preserving the same public API. The dispatcher __init__.py selects the backend via TLLM_KV_CACHE_MANAGER_V2_BACKEND (default "cpp"); both backends pass the shared test suite. CODEOWNERS assigns the new C++ tree to trt-llm-kv-cache-manager-devs. Includes ports of subsequent main features: commit-min-snapshot + SWA-slot reservation, SHA-256 block-key hashing, CUDA-graph request IDs, event manager and stats API to C++, uint64 ReuseScope salt/lora_id, resume-utilization KV constraints, per-conversation KV cache block reuse (PlannedDropHandle), the reuse-probe _KVCache refactor (compute the ReuseMatch once in the manager and pass it into the cache, NVIDIA#14333), SSM-snapshot iteration stats (NVIDIA#16598), the simplified plan_committed_block_drop (db117e6276), and an MPI teardown fix for the unittest/bindings CI shard. Migration planning docs (TODO.md, MIGRATION_PLAN_CPP.md, CPP_MIGRATION_PLAN_MAIN_15633.md) are kept on a separate branch. Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
…dings Migrates tensorrt_llm/runtime/kv_cache_manager_v2 from pure Python to a C++ implementation under cpp/tensorrt_llm/batch_manager/kv_cache_manager_v2/ with nanobind bindings compiled into bindings.so, preserving the same public API. The dispatcher __init__.py selects the backend via TLLM_KV_CACHE_MANAGER_V2_BACKEND (default "cpp"); both backends pass the shared test suite. CODEOWNERS assigns the new C++ tree to trt-llm-kv-cache-manager-devs. Includes ports of subsequent main features: commit-min-snapshot + SWA-slot reservation, SHA-256 block-key hashing, CUDA-graph request IDs, event manager and stats API to C++, uint64 ReuseScope salt/lora_id, resume-utilization KV constraints, per-conversation KV cache block reuse (PlannedDropHandle), the reuse-probe _KVCache refactor (compute the ReuseMatch once in the manager and pass it into the cache, NVIDIA#14333), SSM-snapshot iteration stats (NVIDIA#16598), the simplified plan_committed_block_drop (db117e6276), and an MPI teardown fix for the unittest/bindings CI shard. Migration planning docs (TODO.md, MIGRATION_PLAN_CPP.md, CPP_MIGRATION_PLAN_MAIN_15633.md) are kept on a separate branch. Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
…dings Migrates tensorrt_llm/runtime/kv_cache_manager_v2 from pure Python to a C++ implementation under cpp/tensorrt_llm/batch_manager/kv_cache_manager_v2/ with nanobind bindings compiled into bindings.so, preserving the same public API. The dispatcher __init__.py selects the backend via TLLM_KV_CACHE_MANAGER_V2_BACKEND (default "cpp"); both backends pass the shared test suite. CODEOWNERS assigns the new C++ tree to trt-llm-kv-cache-manager-devs. Includes ports of subsequent main features: commit-min-snapshot + SWA-slot reservation, SHA-256 block-key hashing, CUDA-graph request IDs, event manager and stats API to C++, uint64 ReuseScope salt/lora_id, resume-utilization KV constraints, per-conversation KV cache block reuse (PlannedDropHandle), the reuse-probe _KVCache refactor (compute the ReuseMatch once in the manager and pass it into the cache, NVIDIA#14333), SSM-snapshot iteration stats (NVIDIA#16598), the simplified plan_committed_block_drop (db117e6276), and an MPI teardown fix for the unittest/bindings CI shard. Migration planning docs (TODO.md, MIGRATION_PLAN_CPP.md, CPP_MIGRATION_PLAN_MAIN_15633.md) are kept on a separate branch. Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
…dings Migrates tensorrt_llm/runtime/kv_cache_manager_v2 from pure Python to a C++ implementation under cpp/tensorrt_llm/batch_manager/kv_cache_manager_v2/ with nanobind bindings compiled into bindings.so, preserving the same public API. The dispatcher __init__.py selects the backend via TLLM_KV_CACHE_MANAGER_V2_BACKEND (default "cpp"); both backends pass the shared test suite. CODEOWNERS assigns the new C++ tree to trt-llm-kv-cache-manager-devs. Includes ports of subsequent main features: commit-min-snapshot + SWA-slot reservation, SHA-256 block-key hashing, CUDA-graph request IDs, event manager and stats API to C++, uint64 ReuseScope salt/lora_id, resume-utilization KV constraints, per-conversation KV cache block reuse (PlannedDropHandle), the reuse-probe _KVCache refactor (compute the ReuseMatch once in the manager and pass it into the cache, NVIDIA#14333), SSM-snapshot iteration stats (NVIDIA#16598), the simplified plan_committed_block_drop (db117e6276), and an MPI teardown fix for the unittest/bindings CI shard. Migration planning docs (TODO.md, MIGRATION_PLAN_CPP.md, CPP_MIGRATION_PLAN_MAIN_15633.md) are kept on a separate branch. Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
Description
This PR adds the KV-cache-manager V2 implementation for hybrid Mamba models and moves Mamba state reuse onto explicit snapshot boundaries.
Key changes:
MambaHybridCacheManagerV2, including recurrent-state allocation, replay, promotion, dynamic-tree capacity, and deterministic stochastic-rounding state.MambaStateConfigwith periodic and fixed-position snapshot policies. The legacymamba_state_cache_intervalremains accepted only as a deprecated config-file alias.This is an API/config migration: use
kv_cache_config.mamba_state_config.periodic_snapshot_intervalinstead ofkv_cache_config.mamba_state_cache_intervalin Python code.Test Coverage
Local validation after merging current
main:PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions).
If PR introduces API changes, an appropriate PR label is added, either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities.
CODEOWNERS is updated if ownership changes.
Documentation is updated as needed.
Update the TAVA architecture diagram if there is a significant design change.
The reviewers assigned automatically or manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, comment
/bot help.