Skip to content

[None][fix] enable DSv4 overlap slot headroom without MTP - #17282

Open
reasonsolo wants to merge 1 commit into
NVIDIA:mainfrom
reasonsolo:fix/dsv4-overlap-slot-headroom-draft0
Open

[None][fix] enable DSv4 overlap slot headroom without MTP#17282
reasonsolo wants to merge 1 commit into
NVIDIA:mainfrom
reasonsolo:fix/dsv4-overlap-slot-headroom-draft0

Conversation

@reasonsolo

@reasonsolo reasonsolo commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

With overlap scheduling, requests completed in the previous iteration still hold their sequence slots when the next iteration calls prepare_resources(). Meanwhile, the scheduler has already removed those terminal requests from its capacity budget and may schedule replacement requests or ADP dummy requests.

This creates a transient requirement of up to 2 * max_batch_size sequence slots.

DeepSeek-V4 already had this overlap headroom, but it was incorrectly restricted to one-model MTP configurations. With draft length 0, the slot pool remained at max_batch_size, allowing dummy allocation to fail when the pool was saturated.

Once some rank event loops exited with NoFreeSlotsError, the remaining ranks blocked in distributed collectives, presenting externally as a server hang.

Dev Engineer Review

  • DeepSeek-V4 overlap headroom now applies when overlap scheduling is enabled, regardless of MTP or speculative decoding.
  • Updated the helper signature, caller, and initialization comment for consistency.
  • The change supports 2 * max_batch_size sequence-slot headroom and prevents NoFreeSlotsError during overlap scheduling.
  • No configuration or test-list files changed.

QA Engineer Review

  • Modified the DeepSeek-V4 overlap-headroom gate test in tests/unittest/_torch/executor/test_seq_slot_sizing.py.
  • The test covers model type, pipeline parallelism, and overlap-scheduler settings without speculative-decoding parameters.
  • No corresponding test-db/ or qa/ entry was changed.
  • Verdict: needs follow-up because CI test-list coverage was not confirmed.

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.

@reasonsolo

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2267d819-38c4-4d9b-a433-803120c79c8b

📥 Commits

Reviewing files that changed from the base of the PR and between 89bba4c and e2f7e71.

📒 Files selected for processing (3)
  • tensorrt_llm/_torch/pyexecutor/_util.py
  • tensorrt_llm/_torch/pyexecutor/model_engine.py
  • tests/unittest/_torch/executor/test_seq_slot_sizing.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • tensorrt_llm/_torch/pyexecutor/model_engine.py
  • tensorrt_llm/_torch/pyexecutor/_util.py
  • tests/unittest/_torch/executor/test_seq_slot_sizing.py

Walkthrough

DeepSeek-V4 overlap headroom now applies for non-pipeline-parallel execution whenever overlap scheduling is enabled. The model engine and tests no longer use speculative-decoding or MTP configuration for this decision.

Changes

DSv4 overlap headroom

Layer / File(s) Summary
Update eligibility and validate sequence-slot sizing
tensorrt_llm/_torch/pyexecutor/_util.py, tensorrt_llm/_torch/pyexecutor/model_engine.py, tests/unittest/_torch/executor/test_seq_slot_sizing.py
The headroom gate now uses model type, pipeline parallelism, and overlap-scheduler status. Model-engine wiring, documentation, and tests reflect eligibility with or without speculative decoding.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: allisonlim-nv

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description clearly explains the failure and impact, but it does not document the relevant test coverage or checklist results. Add the relevant test names and results, and complete the applicable PR checklist items.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the fix: enabling DeepSeek-V4 overlap slot headroom without MTP.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/unittest/_torch/executor/test_seq_slot_sizing.py (1)

50-52: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add annotations to the modified test function.

test_dsv4_overlap_headroom_gate has untyped parameters and no return annotation. Add precise parameter annotations and -> None.

Proposed change
 def test_dsv4_overlap_headroom_gate(
-    model_type, pp_size, disable_overlap, expected
-) :
+    model_type: str,
+    pp_size: int,
+    disable_overlap: bool,
+    expected: bool,
+) -> None:

As per coding guidelines, annotate every function.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unittest/_torch/executor/test_seq_slot_sizing.py` around lines 50 - 52,
Update the test_dsv4_overlap_headroom_gate function signature with precise
annotations for model_type, pp_size, disable_overlap, and expected, and add a ->
None return annotation. Preserve the existing parameterization and test
behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/unittest/_torch/executor/test_seq_slot_sizing.py`:
- Around line 42-56: Complete the coverage follow-up for
test_dsv4_overlap_headroom_gate by running pytest tests/unittest/ and reporting
the results; preserve the existing parameterized cases and test behavior.

---

Nitpick comments:
In `@tests/unittest/_torch/executor/test_seq_slot_sizing.py`:
- Around line 50-52: Update the test_dsv4_overlap_headroom_gate function
signature with precise annotations for model_type, pp_size, disable_overlap, and
expected, and add a -> None return annotation. Preserve the existing
parameterization and test behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 5a15a08d-d92f-4ad4-b6eb-603d9dd513b8

📥 Commits

Reviewing files that changed from the base of the PR and between 7f1f219 and d55d013.

📒 Files selected for processing (3)
  • tensorrt_llm/_torch/pyexecutor/_util.py
  • tensorrt_llm/_torch/pyexecutor/model_engine.py
  • tests/unittest/_torch/executor/test_seq_slot_sizing.py

Comment thread tests/unittest/_torch/executor/test_seq_slot_sizing.py Outdated
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63941 [ run ] triggered by Bot. Commit: d55d013 Link to invocation

Signed-off-by: Lizhi Zhou <lizhiz@oci-aga-slurm-1-login-01.cm.cluster>
@reasonsolo
reasonsolo force-pushed the fix/dsv4-overlap-slot-headroom-draft0 branch from d55d013 to e2f7e71 Compare August 5, 2026 05:21
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@reasonsolo

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63947 [ run ] triggered by Bot. Commit: e2f7e71 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63941 [ run ] completed with state ABORTED. Commit: d55d013

Link to invocation

@reasonsolo
reasonsolo enabled auto-merge (squash) August 5, 2026 07:27
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63947 [ run ] completed with state SUCCESS. Commit: e2f7e71
/LLM/main/L0_MergeRequest_PR pipeline #51882 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

@reasonsolo

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64021 [ run ] triggered by Bot. Commit: e2f7e71 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64021 [ run ] completed with state SUCCESS. Commit: e2f7e71
/LLM/main/L0_MergeRequest_PR pipeline #51952 completed with status: 'UNSTABLE'

CI Report

⚠️ Multi-GPU Label Required:
Multi-GPU tests require the ci: full pre-merge approved label on this PR. Ask a member of NVIDIA/trt-llm-ci-approvers to add the label, then re-trigger CI with the same bot command (no rebase needed).

⚠️ 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

Link to invocation

@longlee0622

Copy link
Copy Markdown
Collaborator

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64041 [ run ] triggered by Bot. Commit: e2f7e71 Link to invocation

@brnguyen2 brnguyen2 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.

Approving — the comments below are optional touch-ups, not blockers.

Reasoning holds up: the 2× transient demand comes from the overlap scheduler's slot lifetime, which is orthogonal to draft length, so the MTP condition in #16279 was over-narrow. Callers are consistent — sampler args ([_util.py:2948](https://github.com/NVIDIA/TensorRT-LLM/pull/17282/files#diff-5f0e349b724e8ad501e0ae859c992801e631217a8d52acfa40e24a8fe95bbbcbR2948)) and guided decoder (py_executor_creator.py:787) both size off model_engine.max_num_seq_slots, so widening the gate propagates everywhere it should.

Two things worth noting before merge:

  • Test coverage is still gate-boolean only. test_seq_slot_sizing.py asserts what the predicate returns, not that a saturated pool + ADP dummy under overlap no longer raises NoFreeSlotsError. If you have a repro from the hang, an executor-level test (even with a stub engine, like test_py_executor.py:1323 does) would pin the actual invariant.
  • The PR body describes the failure well; please put that text in the ## Description section of the template rather than leaving it above, and fill in ## Test Coverage with what you ran on real DSv4 (draft_len 0, overlap on).

model_type: Optional[str], mapping: Mapping,
disable_overlap_scheduler: bool) -> bool:
"""Gate extra sequence slots to the non-PP DSv4 overlap path."""
return (should_enable_dsv4_adp_dummy_fixes(model_type, mapping)

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.

The mechanism you describe in the PR body — terminal requests holding slots while the V2 scheduler backfills their seats — is model-agnostic. Every non-PP model with overlap scheduling has the same latent 2× demand; DSv4 just happens to be the one where ADP dummy requests saturate the pool often enough to hit it. Keeping the gate model-scoped is a defensible risk call for a fix PR, but it means the same hang is still reachable elsewhere. Is there a follow-up ticket to validate and generalize? Worth naming it in the docstring so this doesn't sit as a permanent special case.

# decoding. PP remains on its established path.
self._enable_dsv4_adp_dummy_fixes = (should_enable_dsv4_adp_dummy_fixes(
model_type, mapping))
self._enable_dsv4_overlap_headroom = (

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.

This now doubles the slot pool for every non-PP DSv4 run, including plain no-spec-decode serving, which doubles the sampler's per-slot state (TorchSampler.Args.max_num_sequences) and the guided-decoder allocation. Previously only MTP configs paid that. Did you measure the host/device memory delta on a large max_batch_size config? If it's non-trivial, worth a line in the PR description so it isn't a surprise in perf triage.

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

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

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