Skip to content

[None][fix] Propagate host stop criteria across PP ranks - #16096

Open
mingyangHao wants to merge 3 commits into
NVIDIA:mainfrom
mingyangHao:codex/pr15920-pp-stop-fix
Open

[None][fix] Propagate host stop criteria across PP ranks#16096
mingyangHao wants to merge 3 commits into
NVIDIA:mainfrom
mingyangHao:codex/pr15920-pp-stop-fix

Conversation

@mingyangHao

@mingyangHao mingyangHao commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Description

PR #15920 moved greedy stop-criteria checks to the host. In pipeline-parallel execution, use_host_stop_criteria was
stored on the outer SampleStateTorch, while _ring_broadcast_sample_state() only broadcasts sample_state.host.

As a result, non-last PP ranks reconstructed the sample state with use_host_stop_criteria=False and attempted to process
device finish reasons, even though the host fast path intentionally leaves finish_reasons unset.

This change:

  • Moves use_host_stop_criteria into SampleStateTensorsHostTorch, which is already broadcast between PP ranks.
  • Updates update_requests() to read the flag from the broadcast host state.
  • Adds regression coverage that reconstructs the outer sample state using only the broadcast host data.

Performance Impact

No measurable performance impact is expected. This change adds only one boolean to the existing serialized PP payload and
introduces no additional CUDA kernels, synchronization, device-to-host copies, or collectives. The host stop-criteria fast
path introduced by #15920 remains unchanged.

Validation

Passed:

  • TestFinishReasons::test_host_stop_criteria_fast_path — 4 cases
  • test_tinyllama_logits_processor_2gpu[1-2] on 2× B200
  • test_tinyllama_logits_processor_tp2pp2 on 4× B200
  • Ruff and format checks
  • Pre-commit checks

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.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of stop conditions during sampling, making request completion behavior more reliable.
    • Preserved fast-path behavior for stop-criteria checks while ensuring finish states are handled consistently.

@mingyangHao
mingyangHao requested a review from a team as a code owner July 8, 2026 03:15
@mingyangHao
mingyangHao requested a review from lancelly July 8, 2026 03:15
@mingyangHao
mingyangHao requested a review from chienchunhung July 8, 2026 03:16
@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run

@coderabbitai

coderabbitai Bot commented Jul 8, 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: 99ca6869-9995-4821-9d42-197750ee2b55

📥 Commits

Reviewing files that changed from the base of the PR and between bc62489 and 841ce21.

📒 Files selected for processing (2)
  • tensorrt_llm/_torch/pyexecutor/sampler.py
  • tests/unittest/_torch/sampler/test_torch_sampler.py

📝 Walkthrough

Walkthrough

The use_host_stop_criteria boolean field is moved from SampleStateTorch to SampleStateTensorsHostTorch in the TensorRT-LLM torch sampler. update_requests() and sample_async() are updated accordingly, and the corresponding unit test is adjusted to reference the field via the host object.

Changes

Host stop-criteria flag relocation

Layer / File(s) Summary
Field relocation and usage update
tensorrt_llm/_torch/pyexecutor/sampler.py
use_host_stop_criteria field moved from SampleStateTorch to SampleStateTensorsHostTorch; update_requests reads it via state.host.use_host_stop_criteria; sample_async sets it within the host=SampleStateTensorsHostTorch(...) construction.
Test updates for relocated flag
tests/unittest/_torch/sampler/test_torch_sampler.py
Test imports SampleStateTorch, asserts state.host.use_host_stop_criteria and state.host.finish_reasons, and reconstructs a transferred_state for update_requests calls.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, follows the required template, and accurately describes the main change.
Description check ✅ Passed The description is mostly complete and matches the template, with clear issue, fix, impact, and validation details.
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.

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58132 [ run ] triggered by Bot. Commit: 841ce21 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58132 [ run ] completed with state SUCCESS. Commit: 841ce21
/LLM/main/L0_MergeRequest_PR pipeline #46790 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

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

Thanks for the fix!

@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58162 [ run ] triggered by Bot. Commit: 841ce21 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58162 [ run ] completed with state FAILURE. Commit: 841ce21
/LLM/main/L0_MergeRequest_PR pipeline #46811 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

@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run --add-multi-gpu-test --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58241 [ run ] triggered by Bot. Commit: 841ce21 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58241 [ run ] completed with state SUCCESS. Commit: 841ce21
/LLM/main/L0_MergeRequest_PR pipeline #46882 completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

CI Report

Link to invocation

Reland the host-side greedy stop-criteria fast path from NVIDIA#15920 after its temporary revert in NVIDIA#16163.

Signed-off-by: Mingyang Hao <200044211+mingyangHao@users.noreply.github.com>
Signed-off-by: Mingyang Hao <200044211+mingyangHao@users.noreply.github.com>
@mingyangHao
mingyangHao force-pushed the codex/pr15920-pp-stop-fix branch from 87b65a1 to c0c45c7 Compare July 9, 2026 07:23
Remove the PP sampler waivers introduced by NVIDIA#16103, NVIDIA#16105, NVIDIA#16127, and NVIDIA#16146. Also remove overlapping PP and gpu2 waivers from NVIDIA#16109, plus the PP2 waiver added by NVIDIA#16169, so the restored pre-NVIDIA#15920 sampler path is exercised in CI.

Signed-off-by: Mingyang Hao <200044211+mingyangHao@users.noreply.github.com>
@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run --add-multi-gpu-test --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58414 [ run ] triggered by Bot. Commit: 0095402 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58414 [ run ] completed with state ABORTED. Commit: 0095402
/LLM/main/L0_MergeRequest_PR pipeline #47032 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants