Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[TRTLLM-9687][feat] Improve are_stop_words performance#11196

Merged
stnie merged 10 commits intoNVIDIA:mainNVIDIA/TensorRT-LLM:mainfrom
stnie:develop/sampler/are_stop_words_perfstnie/TensorRT-LLM:develop/sampler/are_stop_words_perfCopy head branch name to clipboard
Mar 2, 2026
Merged

[TRTLLM-9687][feat] Improve are_stop_words performance#11196
stnie merged 10 commits intoNVIDIA:mainNVIDIA/TensorRT-LLM:mainfrom
stnie:develop/sampler/are_stop_words_perfstnie/TensorRT-LLM:develop/sampler/are_stop_words_perfCopy head branch name to clipboard

Conversation

@stnie
Copy link
Copy Markdown
Collaborator

@stnie stnie commented Feb 2, 2026

Summary by CodeRabbit

  • Refactor
    • Reorganized the internal architecture of the sampling engine for improved efficiency and maintainability.
    • Enhanced stop-word recognition mechanisms and optimized buffer handling to reduce memory overhead during token generation.
    • Added comprehensive profiling support to enable detailed performance analysis and facilitate debugging.
    • Improved resource management through better buffer allocation and resizing strategies.

Description

Improve are_stop_words performance by caching stop words and past tokens in the TorchSampler Store.

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)

  • 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 stnie requested review from Funatiq and hyukn February 2, 2026 15:51
@stnie stnie force-pushed the develop/sampler/are_stop_words_perf branch from 6dd8988 to a9d586d Compare February 2, 2026 16:03
@stnie
Copy link
Copy Markdown
Collaborator Author

stnie commented Feb 2, 2026

/bot run --disable-fail-fast

1 similar comment
@tburt-nv
Copy link
Copy Markdown
Collaborator

tburt-nv commented Feb 2, 2026

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #34510 [ run ] triggered by Bot. Commit: a9d586d

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #34510 [ run ] completed with state SUCCESS. Commit: a9d586d
/LLM/main/L0_MergeRequest_PR pipeline #26628 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
Copy Markdown
Collaborator

@Funatiq Funatiq left a comment

Choose a reason for hiding this comment

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

Do we have unit tests to verify the stop words functionality?

Comment thread tensorrt_llm/_torch/pyexecutor/sampler.py Outdated
Comment thread tensorrt_llm/_torch/pyexecutor/sampler.py
Comment thread tensorrt_llm/_torch/pyexecutor/sampler.py Outdated
Comment thread tensorrt_llm/_torch/pyexecutor/sampler.py Outdated
Comment thread tensorrt_llm/_torch/pyexecutor/sampler.py Outdated
Comment thread tensorrt_llm/_torch/pyexecutor/sampler.py Outdated
@stnie stnie force-pushed the develop/sampler/are_stop_words_perf branch 2 times, most recently from 128186f to 87098cd Compare February 17, 2026 16:34
@stnie
Copy link
Copy Markdown
Collaborator Author

stnie commented Feb 17, 2026

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #36093 [ run ] triggered by Bot. Commit: 87098cd

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #36093 [ run ] completed with state SUCCESS. Commit: 87098cd
/LLM/main/L0_MergeRequest_PR pipeline #27889 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 force-pushed the develop/sampler/are_stop_words_perf branch from 4b9cd74 to db39bf7 Compare February 18, 2026 16:33
@stnie
Copy link
Copy Markdown
Collaborator Author

stnie commented Feb 18, 2026

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #36163 [ run ] triggered by Bot. Commit: db39bf7 Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #36163 [ run ] completed with state FAILURE. Commit: db39bf7
/LLM/main/L0_MergeRequest_PR pipeline #27948 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
Copy Markdown
Collaborator Author

stnie commented Feb 19, 2026

/bot run

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #36223 [ run ] triggered by Bot. Commit: db39bf7 Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #36223 [ run ] completed with state SUCCESS. Commit: db39bf7
/LLM/main/L0_MergeRequest_PR pipeline #28003 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 stnie force-pushed the develop/sampler/are_stop_words_perf branch 2 times, most recently from 09b8088 to 867daab Compare February 19, 2026 11:00
@stnie
Copy link
Copy Markdown
Collaborator Author

stnie commented Feb 19, 2026

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #36229 [ run ] triggered by Bot. Commit: 867daab Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #36229 [ run ] completed with state SUCCESS. Commit: 867daab
/LLM/main/L0_MergeRequest_PR pipeline #28008 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 stnie force-pushed the develop/sampler/are_stop_words_perf branch 2 times, most recently from 769c8c9 to bf6847d Compare February 19, 2026 17:12
@stnie
Copy link
Copy Markdown
Collaborator Author

stnie commented Feb 19, 2026

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #36260 [ run ] triggered by Bot. Commit: bf6847d Link to invocation

…nd updated testcase

- Updated wrong/stale docstrings and reformatted them to be more uniform
- Fixed a previously introduced bug, where drafts did not update their finish reasons
- Updated test_torch_sampler to test write_finish_reasons, which combines _prepare_stop_word_handling_for_finish_reasons and _write_finish_reasons

Signed-off-by: Stefan Niebler <82932102+stnie@users.noreply.github.com>
Signed-off-by: Stefan Niebler <82932102+stnie@users.noreply.github.com>
@stnie stnie force-pushed the develop/sampler/are_stop_words_perf branch from 75236af to 6fe07d7 Compare February 26, 2026 17:52
@stnie
Copy link
Copy Markdown
Collaborator Author

stnie commented Feb 26, 2026

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #36956 [ run ] triggered by Bot. Commit: 6fe07d7 Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #36956 [ run ] completed with state SUCCESS. Commit: 6fe07d7
/LLM/main/L0_MergeRequest_PR pipeline #28616 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
Copy Markdown
Collaborator Author

stnie commented Feb 27, 2026

/bot run

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #37051 [ run ] triggered by Bot. Commit: 6fe07d7 Link to invocation

Comment thread tensorrt_llm/_torch/pyexecutor/sampler.py Outdated
Comment thread tensorrt_llm/_torch/pyexecutor/sampler.py Outdated
Comment thread tensorrt_llm/_torch/pyexecutor/sampler.py Outdated
Comment thread tensorrt_llm/_torch/pyexecutor/sampler.py
@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #37051 [ run ] completed with state SUCCESS. Commit: 6fe07d7
/LLM/main/L0_MergeRequest_PR pipeline #28686 completed with status: 'SUCCESS'

Link to invocation

@stnie stnie force-pushed the develop/sampler/are_stop_words_perf branch from d9ce57e to da7fd2e Compare February 27, 2026 16:35
@stnie
Copy link
Copy Markdown
Collaborator Author

stnie commented Feb 27, 2026

/bot run --disable-fail-fast

Signed-off-by: Stefan Niebler <82932102+stnie@users.noreply.github.com>
@stnie stnie force-pushed the develop/sampler/are_stop_words_perf branch from da7fd2e to c1297fe Compare February 27, 2026 16:40
@stnie
Copy link
Copy Markdown
Collaborator Author

stnie commented Feb 27, 2026

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #37098 [ run ] triggered by Bot. Commit: c1297fe Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #37098 [ run ] completed with state SUCCESS. Commit: c1297fe
/LLM/main/L0_MergeRequest_PR pipeline #28724 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
Copy Markdown
Collaborator Author

stnie commented Mar 2, 2026

/bot run

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #37309 [ run ] triggered by Bot. Commit: c1297fe Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #37309 [ run ] completed with state ABORTED. Commit: c1297fe
/LLM/main/L0_MergeRequest_PR pipeline #28875 completed with status: 'ABORTED'

⚠️ 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
Copy Markdown
Collaborator Author

stnie commented Mar 2, 2026

/bot run

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #37323 [ run ] triggered by Bot. Commit: c1297fe Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #37323 [ run ] completed with state SUCCESS. Commit: c1297fe
/LLM/main/L0_MergeRequest_PR pipeline #28885 completed with status: 'SUCCESS'

Link to invocation

@stnie stnie merged commit a28def9 into NVIDIA:main Mar 2, 2026
5 checks passed
greg-kwasniewski1 pushed a commit to nv-auto-deploy/TensorRT-LLM that referenced this pull request Mar 2, 2026
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
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
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.