Skip to content

[None][feat] add commit-min snapshots and per-conversation KV reuse - #15916

Closed
jiaganc wants to merge 5 commits into
NVIDIA:feat/deepseek_v4from
jiaganc:codex/integrate-commit-min-snapshot
Closed

[None][feat] add commit-min snapshots and per-conversation KV reuse#15916
jiaganc wants to merge 5 commits into
NVIDIA:feat/deepseek_v4from
jiaganc:codex/integrate-commit-min-snapshot

Conversation

@jiaganc

@jiaganc jiaganc commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai summary

Description

Integrates commit_min_snapshot support from #15752 and per-conversation KV cache block reuse from #16115 into the DeepSeek-V4 feature branch.

The runtime now supports minimum snapshots for SSM reuse, including partial final-page commits. It also exposes CommittedBlockRecord, which keeps selected committed SWA-window pages reusable until the record is released. Full-attention and attention-sink pages remain managed by the existing global reuse policy; recording SSM state for a conversation remains a TODO.

The PyTorch KV cache manager V2 now:

  • propagates partial-reuse configuration to the generic and DeepSeek-V4 cache managers;
  • enables commit_min_snapshot when block reuse is enabled and the policy is not all_reusable;
  • supports all_reusable, per_request, and per_conversation policies;
  • delays per_request and per_conversation commits until the final context chunk while allowing a partial final commit;
  • tracks the active request and latest committed-block record for each conversation;
  • replaces the previous conversation record only after a completed turn is recorded successfully;
  • ignores conversation tracking for overlapping requests in the same conversation and uses per_request behavior when conversation parameters are absent.

The executor also documents a follow-up optimization: a disaggregated prefill server can pass is_end=True for the final context chunk to avoid unnecessary final-page copies.

Test Coverage

  • Added minimum-snapshot and partial-reuse configuration coverage for generic V2 and DeepSeek-V4 cache managers.
  • Added partial final-context commit and reuse-policy timing coverage.
  • Added committed-block record lifecycle coverage in tests/unittest/kv_cache_manager_v2_tests/test_kv_cache_manager_v2.py.
  • Added per-conversation chunking, fallback, divergent-turn, and overlapping-request coverage in tests/unittest/_torch/executor/test_kv_cache_manager_v2.py.
  • Extended KvCacheConfig validation coverage for per_conversation.
  • Python compilation, git diff --check, and all relevant pre-commit hooks passed locally.
  • Pytest was not run locally because the checkout's Python environment does not provide the pytest module.

PR Checklist

Please review the following before submitting this 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).

  • Any new dependencies have been scanned for license and vulnerabilities.

  • CODEOWNERS updated if ownership changes.

  • Documentation updated as needed.

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/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, please comment /bot help.

@jiaganc
jiaganc force-pushed the codex/integrate-commit-min-snapshot branch 4 times, most recently from 9217adf to b9fdcf0 Compare July 8, 2026 07:55
@jiaganc jiaganc changed the title [None][feat] integrate commit-min snapshots with V2 reuse policies [None][feat] add commit-min snapshots and per-conversation KV reuse Jul 8, 2026
jiaganc added 5 commits July 8, 2026 02:47
Signed-off-by: Jiagan Cheng <jiaganc@nvidia.com>
Signed-off-by: Jiagan Cheng <jiaganc@nvidia.com>
Signed-off-by: Jiagan Cheng <jiaganc@nvidia.com>
Signed-off-by: Jiagan Cheng <jiaganc@nvidia.com>
Signed-off-by: Jiagan Cheng <jiaganc@nvidia.com>
@jiaganc
jiaganc force-pushed the codex/integrate-commit-min-snapshot branch from 24ddbd7 to fa46198 Compare July 8, 2026 09:48
@longlee0622

Copy link
Copy Markdown
Collaborator

We no longer use the ds v4 side branch. Closing this PR. Please prepare PR against main.

@longlee0622 longlee0622 closed this Jul 9, 2026
@jiaganc
jiaganc deleted the codex/integrate-commit-min-snapshot branch July 21, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants