Skip to content

[https://nvbugs/5764627][fix] Fix generation logits with streaming and improve runtime of logits testcase. Also fixes https://nvbugs/5573238#10637

Merged
stnie merged 7 commits intoNVIDIA:mainfrom
stnie:bugfix/5764627
Mar 2, 2026
Merged

[https://nvbugs/5764627][fix] Fix generation logits with streaming and improve runtime of logits testcase. Also fixes https://nvbugs/5573238#10637
stnie merged 7 commits intoNVIDIA:mainfrom
stnie:bugfix/5764627

Conversation

@stnie
Copy link
Collaborator

@stnie stnie commented Jan 13, 2026

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed race conditions in generation logits tracking during streaming operations.
    • Optimized memory efficiency in streaming mode by eliminating unnecessary deep copy operations.
  • Tests

    • Re-enabled previously skipped tests for logits and log probabilities functionality.
    • Enhanced test coverage and validation for streaming scenarios.

✏️ Tip: You can customize this high-level summary in your review settings.

Description

test_return_logits.py is too slow.

  • Too many llm Instances were created. This PR resolves this by changing some fixtures to parametrizations. The adjusted test only creates a total of 4 llm instances.
  • test_generate_with_return_logits and test_generate_async_with_return_logits have been consolidated into a single testcase to better reuse llm fixtures and reduce code duplication.
  • Previous xfail cases could cause the llm shutdown to hang, which resulted in the testcase waiting for timeout (120s). This PR removes the xfail cases.
  • Bug 5573238 is resolved, by creating a deep copy of the LogitsStorage when creating the response, to prevent a race condition

Test Coverage

test_return_logits.py

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)

  • 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

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

Details

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md
and the scripts/test_to_stage_mapping.py helper.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

@stnie
Copy link
Collaborator Author

stnie commented Jan 13, 2026

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #31796 [ run ] triggered by Bot. Commit: cd28b3d

@tensorrt-cicd
Copy link
Collaborator

PR_Github #31796 [ run ] completed with state SUCCESS. Commit: cd28b3d
/LLM/main/L0_MergeRequest_PR pipeline #24609 completed with status: 'FAILURE'

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

@stnie
Copy link
Collaborator Author

stnie commented Jan 14, 2026

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #31983 [ run ] triggered by Bot. Commit: cd28b3d

@tensorrt-cicd
Copy link
Collaborator

PR_Github #31983 [ run ] completed with state SUCCESS. Commit: cd28b3d
/LLM/main/L0_MergeRequest_PR pipeline #24777 completed with status: 'FAILURE'

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

@stnie stnie requested a review from Funatiq January 14, 2026 17:26
@stnie
Copy link
Collaborator Author

stnie commented Jan 14, 2026

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #32005 [ run ] triggered by Bot. Commit: 123a3bd

@tensorrt-cicd
Copy link
Collaborator

PR_Github #32005 [ run ] completed with state SUCCESS. Commit: 123a3bd
/LLM/main/L0_MergeRequest_PR pipeline #24797 completed with status: 'FAILURE'

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

Copy link
Collaborator

@ixlmar ixlmar left a comment

Choose a reason for hiding this comment

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

Commented on test changes

@stnie
Copy link
Collaborator Author

stnie commented Jan 16, 2026

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #32286 [ run ] triggered by Bot. Commit: 123a3bd

@stnie
Copy link
Collaborator Author

stnie commented Jan 16, 2026

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #32287 [ run ] triggered by Bot. Commit: 04b3472

@tensorrt-cicd
Copy link
Collaborator

PR_Github #32287 [ run ] completed with state SUCCESS. Commit: 04b3472
/LLM/main/L0_MergeRequest_PR pipeline #25023 completed with status: 'FAILURE'

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

@stnie
Copy link
Collaborator Author

stnie commented Jan 19, 2026

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #32593 [ run ] triggered by Bot. Commit: db174cd

@tensorrt-cicd
Copy link
Collaborator

PR_Github #36776 [ run ] completed with state SUCCESS. Commit: 2d545cf
/LLM/main/L0_MergeRequest_PR pipeline #28480 completed with status: 'FAILURE'

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

@stnie
Copy link
Collaborator Author

stnie commented Feb 25, 2026

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #36811 [ run ] triggered by Bot. Commit: 2d545cf Link to invocation

@tensorrt-cicd
Copy link
Collaborator

PR_Github #36811 [ run ] completed with state SUCCESS. Commit: 2d545cf
/LLM/main/L0_MergeRequest_PR pipeline #28503 completed with status: 'SUCCESS'

Link to invocation

@stnie stnie requested review from Funatiq and ixlmar February 26, 2026 08:52
… in LlmRequest and adjust generation request state management in PyExecutor.

- Added deep copy logic for generation logits in LlmRequest to prevent race conditions during IPC communication in streaming mode.
- Updated state management for generation requests in PyExecutor to ensure correct handling of generation logits after processing previous batches.

Signed-off-by: Stefan Niebler <82932102+stnie@users.noreply.github.com>
…imilar code and reduce runtime.

- Consolidated logic for checking generated outputs into a separate function to reduce redundancy.
- Updated test cases to handle both synchronous and asynchronous generation scenarios.
- Removed unused fixtures and parameters to streamline the test setup and reduce the number of created llm objects.
- unwaived testcase

Signed-off-by: Stefan Niebler <82932102+stnie@users.noreply.github.com>
- Adjusted the condition for deep copying generation logits, ensuring only necessary copies are made.
- Updated comments for clarity on the copying process of generation logits and their indices to enhance understanding of the logic.

Signed-off-by: Stefan Niebler <82932102+stnie@users.noreply.github.com>
…deep copy logic.

- Added a comment to clarify the condition for deep copying in LlmRequest.
- Adjusted logic for state management in PyExecutor for generation requests to skip unnecessary checks.
- Added assertions in unit tests to validate expected behavior in generation scenarios.

Signed-off-by: Stefan Niebler <82932102+stnie@users.noreply.github.com>
- Replace deepcopy  of LogProbStorage with copy and recreation of LogProbStorage
- add type annotation to _logit_inidices
- Remove unused code from test_logits_logprobs.py

Signed-off-by: Stefan Niebler <82932102+stnie@users.noreply.github.com>
Signed-off-by: Stefan Niebler <82932102+stnie@users.noreply.github.com>
… will finish next iteration

Signed-off-by: Stefan Niebler <82932102+stnie@users.noreply.github.com>
@stnie
Copy link
Collaborator Author

stnie commented Feb 26, 2026

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #36947 [ run ] triggered by Bot. Commit: e35f72b Link to invocation

@tensorrt-cicd
Copy link
Collaborator

PR_Github #36947 [ run ] completed with state SUCCESS. Commit: e35f72b
/LLM/main/L0_MergeRequest_PR pipeline #28609 completed with status: 'FAILURE'

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

@stnie
Copy link
Collaborator Author

stnie commented Feb 27, 2026

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #37056 [ run ] triggered by Bot. Commit: e35f72b Link to invocation

@stnie stnie changed the title [https://nvbugs/5764627,https://nvbugs/5573238][fix] Fix generation logits with streaming and improve runtime of logits testcase [https://nvbugs/5764627][fix] Fix generation logits with streaming and improve runtime of logits testcase. Also fixes https://nvbugs/5573238 Feb 27, 2026
@tensorrt-cicd
Copy link
Collaborator

PR_Github #37056 [ run ] completed with state SUCCESS. Commit: e35f72b
/LLM/main/L0_MergeRequest_PR pipeline #28691 completed with status: 'FAILURE'

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

@stnie
Copy link
Collaborator Author

stnie commented Feb 27, 2026

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #37071 [ run ] triggered by Bot. Commit: e35f72b Link to invocation

@tensorrt-cicd
Copy link
Collaborator

PR_Github #37071 [ run ] completed with state SUCCESS. Commit: e35f72b
/LLM/main/L0_MergeRequest_PR pipeline #28703 completed with status: 'SUCCESS'

Link to invocation

@stnie stnie merged commit 3b8b91f into NVIDIA:main Mar 2, 2026
6 of 7 checks passed
greg-kwasniewski1 pushed a commit to nv-auto-deploy/TensorRT-LLM that referenced this pull request Mar 2, 2026
…d improve runtime of logits testcase. Also fixes https://nvbugs/5573238 (NVIDIA#10637)

Signed-off-by: Stefan Niebler <82932102+stnie@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Mar 9, 2026
…d improve runtime of logits testcase. Also fixes https://nvbugs/5573238 (NVIDIA#10637)

Signed-off-by: Stefan Niebler <82932102+stnie@users.noreply.github.com>
tianyuz-nv pushed a commit to wanqian-nv/TensorRT-LLM that referenced this pull request Mar 19, 2026
…d improve runtime of logits testcase. Also fixes https://nvbugs/5573238 (NVIDIA#10637)

Signed-off-by: Stefan Niebler <82932102+stnie@users.noreply.github.com>
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.

5 participants