Skip to content

[None][fix] Release stale-range holder after _commit_block in KVCache…#14478

Open
Tabrizian wants to merge 2 commits into
NVIDIA:feat/deepseek_v4from
Tabrizian:user/imant/dsv4-kvcm-v2-stale-range-commit-fix
Open

[None][fix] Release stale-range holder after _commit_block in KVCache…#14478
Tabrizian wants to merge 2 commits into
NVIDIA:feat/deepseek_v4from
Tabrizian:user/imant/dsv4-kvcm-v2-stale-range-commit-fix

Conversation

@Tabrizian
Copy link
Copy Markdown
Member

@Tabrizian Tabrizian commented May 23, 2026

…ManagerV2

When _commit_block finalizes a block that is already inside stale_range[lc] for some finite-window lifecycle (e.g. DSv4 DSA / SWA), the freshly assigned holder (_PageHolder or _SharedPageLock from line 1268 / 1312-1325) was left in place. _check_sanity then asserted on the precondition of suspend():

/workspaces/tensorrt_llm/.../sampler.../suspend()
-> _kv_cache.py:931 assert self._check_sanity()
-> _kv_cache.py:1531 assert holder is None # for committed stale block

This trips deterministically on DSv4-Pro disagg GEN runs under MAX_UTILIZATION scheduling: when the V2 scheduler tries to suspend an in-flight request to make room, the precondition check aborts the worker. The previously-known release paths (_on_stop_committing, _unlock_stale_blocks) never revisit a committed-and-already-stale ordinal, so a 'commit-into-stale-range' case slipped through.

Fix: at the tail of _commit_block, for the committed block, iterate each non-SSM lifecycle and clear beam_block[lc] when the ordinal lies inside that lifecycle's stale_range. The committed page itself remains alive in the radix tree (committed pages are shareable across caches); only this _KVCache's redundant strong reference is dropped, restoring the 'committed AND stale -> holder is None' invariant.

Validated end-to-end on DSv4-Pro disagg sweep on Lyris GB300 (c=4/8/16/32/64, DEP8/TEP8): zero _check_sanity AssertionError across ~160k commit-into-stale events under real traffic.

@coderabbitai summary

Description

Test Coverage

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-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • 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.

…ManagerV2

When _commit_block finalizes a block that is already inside stale_range[lc]
for some finite-window lifecycle (e.g. DSv4 DSA / SWA), the freshly assigned
holder (_PageHolder or _SharedPageLock from line 1268 / 1312-1325) was left
in place. _check_sanity then asserted on the precondition of suspend():

  /workspaces/tensorrt_llm/.../sampler.../suspend()
    -> _kv_cache.py:931 assert self._check_sanity()
    -> _kv_cache.py:1531 assert holder is None   # for committed stale block

This trips deterministically on DSv4-Pro disagg GEN runs under MAX_UTILIZATION
scheduling: when the V2 scheduler tries to suspend an in-flight request to
make room, the precondition check aborts the worker. The previously-known
release paths (_on_stop_committing, _unlock_stale_blocks) never revisit a
committed-and-already-stale ordinal, so a 'commit-into-stale-range' case
slipped through.

Fix: at the tail of _commit_block, for the committed block, iterate each
non-SSM lifecycle and clear beam_block[lc] when the ordinal lies inside
that lifecycle's stale_range. The committed page itself remains alive in
the radix tree (committed pages are shareable across caches); only this
_KVCache's redundant strong reference is dropped, restoring the
'committed AND stale -> holder is None' invariant.

Validated end-to-end on DSv4-Pro disagg sweep on Lyris GB300 (c=4/8/16/32/64,
DEP8/TEP8): zero _check_sanity AssertionError across ~160k commit-into-stale
events under real traffic.

Signed-off-by: Iman Tabrizian <10105175+tabrizian@users.noreply.github.com>
@Tabrizian
Copy link
Copy Markdown
Member Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #50027 [ run ] triggered by Bot. Commit: 7ebf4a5 Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #50027 [ run ] completed with state FAILURE. Commit: 7ebf4a5
/LLM/main/L0_MergeRequest_PR pipeline #39590 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

@lfr-0531
Copy link
Copy Markdown
Collaborator

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #50071 [ run ] triggered by Bot. Commit: 192787a Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #50071 [ run ] completed with state SUCCESS. Commit: 192787a
/LLM/main/L0_MergeRequest_PR pipeline #39626 completed with status: 'SUCCESS'

CI Report

Link to invocation

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.

3 participants