Skip to content

[https://nvbugs/6428069][fix] Move use_host_stop_criteria from SampleStateTorch onto… - #16135

Open
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6428069
Open

[https://nvbugs/6428069][fix] Move use_host_stop_criteria from SampleStateTorch onto…#16135
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6428069

Conversation

@trtllm-agent

@trtllm-agent trtllm-agent commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Root cause: use_host_stop_criteria lived on outer SampleStateTorch, not on the host object propagated across PP ring send/recv, so non-last PP ranks kept flag=False and dereferenced a None finish_reasons.
  • Fix: Move use_host_stop_criteria from SampleStateTorch onto SampleStateTensorsHostTorch; update the one reader and the unit test; remove the eight nvbugs/6428069 waivers.
  • Automated fix generated by repair-bot

Test plan

  • Verify fix on the same GPU type as the original failure
  • Check for regressions in related tests

Links

Summary by CodeRabbit

  • Bug Fixes

    • Improved how stop conditions are tracked during generation, making request handling more consistent and reliable.
    • Adjusted sample-state handling so host-side criteria are applied in the right place.
  • Tests

    • Updated test coverage to match the new stop-criteria behavior.
    • Refined integration test waivers to reflect the current expected set of scenarios.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The use_host_stop_criteria boolean field is relocated from SampleStateTorch to SampleStateTensorsHostTorch, with consumer code (update_requests(), sample_async()) and a unit test updated accordingly. Separately, waiver entries in waives.txt are narrowed/removed for several disaggregated serving test configurations.

Changes

Host stop criteria field relocation

Layer / File(s) Summary
Move field and update consumers
tensorrt_llm/_torch/pyexecutor/sampler/sampler.py, tests/unittest/_torch/sampler/test_torch_sampler.py
use_host_stop_criteria moves from SampleStateTorch to SampleStateTensorsHostTorch; update_requests() and sample_async() are updated to read/set it from state.host, and the corresponding unit test assertion order is updated to match.

Test waiver list updates

Layer / File(s) Summary
Update disaggregated serving waivers
tests/integration/test_lists/waives.txt
SKIP entries for TestLlama3_1_8BInstruct are narrowed to specific gen_tp/ctx_pp=2 combinations, test_ngram, and tp1pp2 cases, and two TinyLlama disaggregated waiver entries are removed.

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

Possibly related PRs

  • NVIDIA/TensorRT-LLM#16103: Both PRs modify overlapping SKIP/waiver entries in tests/integration/test_lists/waives.txt for disaggregated serving test configurations.

Suggested reviewers: yuxianq, dongxuy04

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is specific, concise, and matches the main change of moving use_host_stop_criteria to host state.
Description check ✅ Passed The description clearly covers the root cause, fix, tests, and bug link, even though it does not use the template headings exactly.
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
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch repair-bot-bug6428069

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.

🧹 Nitpick comments (1)
tests/unittest/_torch/sampler/test_torch_sampler.py (1)

932-934: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

LGTM for the assertion update itself, matching the new field location.

One coverage gap worth flagging: this test exercises sample_async/update_requests within a single sampler instance and doesn't cover the actual PP send/recv boundary that caused bug 6428069 (non-last ranks receiving state.host without the flag). Consider a lightweight unit test that pickles/round-trips (or otherwise simulates the PP transfer of) SampleStateTensorsHostTorch to assert use_host_stop_criteria survives, complementing the disaggregated PP integration tests already re-enabled by this PR.

As per path instructions for tests/**: "suggest concrete list file names and whether coverage is sufficient, insufficient, or needs follow-up outside the PR."

🤖 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/sampler/test_torch_sampler.py` around lines 932 - 934,
Coverage is insufficient for the PP transfer path: the current test only checks
`sample_async` and `update_requests` inside one `TorchSampler` instance, so it
does not verify that `SampleStateTensorsHostTorch.use_host_stop_criteria`
survives the send/recv boundary. Add a lightweight unit test in
`tests/unittest/_torch/sampler/test_torch_sampler.py` that round-trips or
simulates serialization for `SampleStateTensorsHostTorch` and asserts
`use_host_stop_criteria` remains set on the received `state.host`. This should
complement, not replace, the existing disaggregated PP integration tests already
covered elsewhere in the PR.

Source: Path instructions

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

Nitpick comments:
In `@tests/unittest/_torch/sampler/test_torch_sampler.py`:
- Around line 932-934: Coverage is insufficient for the PP transfer path: the
current test only checks `sample_async` and `update_requests` inside one
`TorchSampler` instance, so it does not verify that
`SampleStateTensorsHostTorch.use_host_stop_criteria` survives the send/recv
boundary. Add a lightweight unit test in
`tests/unittest/_torch/sampler/test_torch_sampler.py` that round-trips or
simulates serialization for `SampleStateTensorsHostTorch` and asserts
`use_host_stop_criteria` remains set on the received `state.host`. This should
complement, not replace, the existing disaggregated PP integration tests already
covered elsewhere in the PR.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a8365454-2569-4bac-8dab-fba3226a42dd

📥 Commits

Reviewing files that changed from the base of the PR and between 5ce293f and 0b942e8.

📒 Files selected for processing (3)
  • tensorrt_llm/_torch/pyexecutor/sampler/sampler.py
  • tests/integration/test_lists/waives.txt
  • tests/unittest/_torch/sampler/test_torch_sampler.py
💤 Files with no reviewable changes (1)
  • tests/integration/test_lists/waives.txt

The 'use_host_stop_criteria' flag was stored on SampleStateTorch (top-level),
so it only lived on the last PP rank that actually ran sample_async(). Under
PP>=2, non-last ranks recv only sample_state.host from the previous rank via
_ring_broadcast_sample_state and keep their locally-constructed SampleStateTorch
with the default flag=False. update_requests() on those ranks then went down
the device finish-reasons path and dereferenced state.host.finish_reasons,
which is None on the host-stop path -- causing IndexError in finish_if_reason.

Move the flag into SampleStateTensorsHostTorch so it travels together with
finish_reasons through the PP send/recv chain and update the single read site
plus the corresponding sampler unit test. Remove the eight nvbugs/6428069
waivers so the fixed disagg PP tests re-enter CI.

Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com>
@trtllm-agent
trtllm-agent force-pushed the repair-bot-bug6428069 branch from 0b942e8 to 1429a84 Compare July 8, 2026 20:43
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