Skip to content

[None][feat] KV reuse probe - #14395

Merged
peihu-nv merged 1 commit into
NVIDIA:feat/deepseek_v4from
lancelly:feat/dsv4-with-reuse-probe
May 21, 2026
Merged

[None][feat] KV reuse probe#14395
peihu-nv merged 1 commit into
NVIDIA:feat/deepseek_v4from
lancelly:feat/dsv4-with-reuse-probe

Conversation

@lancelly

@lancelly lancelly commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Stacked on top of #14353. Adds the KV cache reuse probe API from #14333 by cherry-picking f9968c6bd3 onto the feat/dsv4-refactor-and-probe stack.

Conflict resolution notes (tensorrt_llm/runtime/kv_cache_manager_v2/_core/_kv_cache.py)

#14333 was based on main, which doesn't have DSv4's reuse-stats tracking. The cherry-pick conflicted in two regions; resolved as follows:

  1. _KVCache.__init__ — keep _pending_stats = _PendingStats() and the post-setup _refresh_generation_alloc_ready() call, while adopting the new reuse_match: ReuseMatch | None parameter from [None][feat] add KV cache reuse probe #14333.
  2. _setup_for_reuse — adopt [None][feat] add KV cache reuse probe #14333's lean shape (use match.blocks / match.num_tokens from a pre-pruned ReuseMatch), then re-insert the DSv4 stats tracking inside the per-life-cycle loop (full_reused_blocks, partial_reused_blocks, _pending_stats.record_reuse, mark_stats_dirty) using num_tokens instead of the removed get_num_matched_tokens(matched) helper. Indexing was migrated from matched[ordinal][0] to matched[ordinal] since matched is now list[Block].
  3. _KVCache.__init__ previously defaulted expected_prompt_length from len(input_tokens). After [None][feat] add KV cache reuse probe #14333 removes the input_tokens parameter, that fallback was moved up one level into KVCacheManager.create_kv_cache so the public-API behavior is preserved.

@lancelly
lancelly requested review from a team as code owners May 21, 2026 07:34
@lancelly
lancelly requested review from Superjomn, chang-l, dongxuy04 and venkywonka and removed request for a team May 21, 2026 07:34
@lancelly

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49639 [ run ] triggered by Bot. Commit: 12396e6 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49639 [ run ] completed with state SUCCESS. Commit: 12396e6
/LLM/main/L0_MergeRequest_PR pipeline #39258 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@lancelly

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49704 [ run ] triggered by Bot. Commit: 12396e6 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49704 [ run ] completed with state SUCCESS. Commit: 12396e6
/LLM/main/L0_MergeRequest_PR pipeline #39310 completed with status: 'SUCCESS'

CI Report

Link to invocation

@lancelly

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

1 similar comment
@lancelly

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49721 [ run ] triggered by Bot. Commit: 04a52f1 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49721 [ run ] completed with state SUCCESS. Commit: 04a52f1
/LLM/main/L0_MergeRequest_PR pipeline #39327 completed with status: 'SUCCESS'

CI Report

Link to invocation

Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
(cherry picked from commit f9968c6)
Signed-off-by: Lance Liao <108499334+lancelly@users.noreply.github.com>
@peihu-nv
peihu-nv force-pushed the feat/dsv4-with-reuse-probe branch from 04a52f1 to fb14a8f Compare May 21, 2026 18:47
@pcastonguay

Copy link
Copy Markdown
Collaborator

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49753 [ run ] triggered by Bot. Commit: fb14a8f Link to invocation

@peihu-nv peihu-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

One follow up needed for full E2E is wiring the probe reuse to the existing probe_prefix_match_length(...) I think.

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49753 [ run ] completed with state SUCCESS. Commit: fb14a8f
/LLM/main/L0_MergeRequest_PR pipeline #39354 completed with status: 'SUCCESS'

CI Report

Link to invocation

@peihu-nv
peihu-nv merged commit 4ef56d6 into NVIDIA:feat/deepseek_v4 May 21, 2026
6 checks passed
lfr-0531 pushed a commit to lfr-0531/TensorRT-LLM that referenced this pull request Jun 10, 2026
Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
Signed-off-by: Lance Liao <108499334+lancelly@users.noreply.github.com>
Co-authored-by: Yao Yao <lowsfer@users.noreply.github.com>
lfr-0531 pushed a commit to lfr-0531/TensorRT-LLM that referenced this pull request Jun 11, 2026
Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
Signed-off-by: Lance Liao <108499334+lancelly@users.noreply.github.com>
Co-authored-by: Yao Yao <lowsfer@users.noreply.github.com>
lfr-0531 pushed a commit to lfr-0531/TensorRT-LLM that referenced this pull request Jun 12, 2026
Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
Signed-off-by: Lance Liao <108499334+lancelly@users.noreply.github.com>
Co-authored-by: Yao Yao <lowsfer@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants