Skip to content

[None][fix] Add ray stage with 4 h100 gpus to CI and fix sampled logprobs in TRTLLM sampler#9970

Closed
shuyixiong wants to merge 2 commits intoNVIDIA:mainfrom
shuyixiong:user/shuyix/add_ray_stage
Closed

[None][fix] Add ray stage with 4 h100 gpus to CI and fix sampled logprobs in TRTLLM sampler#9970
shuyixiong wants to merge 2 commits intoNVIDIA:mainfrom
shuyixiong:user/shuyix/add_ray_stage

Conversation

@shuyixiong
Copy link
Collaborator

@shuyixiong shuyixiong commented Dec 13, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Fixed logprob-to-request association in beam sampling logic to ensure accurate probability calculations.
  • Chores

    • Expanded test infrastructure with additional GPU configurations.

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

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)

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

@shuyixiong shuyixiong changed the title Add ray stage with 4 h100 gpus to CI [None][fix] Add ray stage with 4 h100 gpus to CI and fix TRTLLM sampler Dec 13, 2025
@shuyixiong
Copy link
Collaborator Author

/bot run --stage-list "DGX_H100-4_GPUs-PyTorch-Ray-1"

@shuyixiong shuyixiong changed the title [None][fix] Add ray stage with 4 h100 gpus to CI and fix TRTLLM sampler [None][fix] Add ray stage with 4 h100 gpus to CI and fix sampled logprobs in TRTLLM sampler Dec 13, 2025
@tensorrt-cicd
Copy link
Collaborator

PR_Github #28100 [ run ] triggered by Bot. Commit: 623d88c

@tensorrt-cicd
Copy link
Collaborator

PR_Github #28100 [ run ] completed with state DISABLED
CI server is currently disabled for scheduled maintenance. Estimated completion time: 10 AM PST on 12/13.

Copy link
Member

@tongyuantongyu tongyuantongyu left a comment

Choose a reason for hiding this comment

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

LGTM

@shuyixiong
Copy link
Collaborator Author

/bot run --disable-fail-fast

@shuyixiong shuyixiong force-pushed the user/shuyix/add_ray_stage branch from 623d88c to 23378a6 Compare December 14, 2025 03:08
@shuyixiong shuyixiong marked this pull request as ready for review December 14, 2025 03:09
@shuyixiong shuyixiong requested review from a team as code owners December 14, 2025 03:09
@shuyixiong
Copy link
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #28187 [ run ] triggered by Bot. Commit: 23378a6

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 14, 2025

📝 Walkthrough

Walkthrough

Changes expand multi-GPU test detection in merge request pipelines, add a new DGX H100 test configuration to the test matrix, and refactor logprob assignment logic in the PyTorch executor sampler to use zip() for correct seq_slot pairing.

Changes

Cohort / File(s) Summary
Jenkins CI Configuration
jenkins/L0_MergeRequest.groovy, jenkins/L0_Test.groovy
Added multi-GPU detection path for ray orchestrator unit tests; introduced new DGX_H100-4_GPUs-PyTorch-Ray test configuration to x86 and x86 Slurm test matrices
PyTorch Executor Sampling
tensorrt_llm/_torch/pyexecutor/sampler.py
Refactored logprob iteration in update_requests_single_beam_single_step to use zip(seq_slots, reqs_with_new_tokens) for correct alignment of logprobs with per-request seq_slot values

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • jenkins/L0_Test.groovy: Verify DGX_H100 configuration parameters match intended test specifications and resource requirements.
  • tensorrt_llm/_torch/pyexecutor/sampler.py: Confirm zip() pairing logic correctly maps logprobs to seq_slots across all sampling paths and edge cases (e.g., empty lists, single-request scenarios).

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description only contains the template placeholder text with no actual content filled in for Description, Test Coverage, or specific details about the changes and their rationale. Fill in the Description section explaining the issue and solution, the Test Coverage section listing relevant tests, and provide meaningful details beyond the template structure.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes both main changes: adding a Ray CI stage with 4 H100 GPUs and fixing sampled logprobs in the TRTLLM sampler, matching the code changes in the PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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)
jenkins/L0_MergeRequest.groovy (1)

660-770: Multi-GPU detection: new Ray orchestrator path is correct; consider safer matching than contains() on a joined string.
Adding tests/unittest/_torch/ray_orchestrator/multi_gpu/ correctly makes Ray multi-GPU test edits trigger multi-GPU CI. However, changedFileListStr.contains(prefix) can false-positive and is harder to reason about than per-path checks.

Suggested refactor (behavior-preserving for typical prefixes, avoids substring edge cases):

-    def changedFileListStr = ","
     def relatedFileChanged = false
     try {
-        changedFileListStr = changedFileList.join(", ")
-        relatedFileChanged = relatedFileList.any { it ->
-            if (changedFileListStr.contains(it)) {
-                return true
-            }
-        }
+        relatedFileChanged = changedFileList.any { file ->
+            relatedFileList.any { rel -> file?.startsWith(rel) || file == rel }
+        }
     }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a5a3722 and 23378a6.

📒 Files selected for processing (3)
  • jenkins/L0_MergeRequest.groovy (1 hunks)
  • jenkins/L0_Test.groovy (1 hunks)
  • tensorrt_llm/_torch/pyexecutor/sampler.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.py: The code developed for TensorRT-LLM should conform to Python 3.8+
Indent Python code with 4 spaces; do not use tabs
Always maintain the namespace when importing in Python, even if only one class or function from a module is used (e.g., use from package.subpackage import foo and then foo.SomeClass() instead of from package.subpackage.foo import SomeClass)
Python filenames should use snake_case (e.g., some_file.py)
Python class names should use PascalCase (e.g., class SomeClass)
Python function and method names should use snake_case (e.g., def my_awesome_function():)
Python local variable names should use snake_case, with prefix k for variable names that start with a number (e.g., k_99th_percentile = ...)
Python global variables should use upper snake_case with prefix G (e.g., G_MY_GLOBAL = ...)
Python constants should use upper snake_case (e.g., MY_CONSTANT = ...)
Avoid shadowing variables declared in an outer scope in Python
Initialize all externally visible members of a Python class in the constructor
For Python interfaces that may be used outside a file, prefer docstrings over comments
Python comments should be reserved for code within a function, or interfaces that are local to a file
Use Google style docstrings for Python classes and functions, which can be parsed by Sphinx
Python attributes and variables can be documented inline with type and description (e.g., self.x = 5 followed by """<type>: Description of 'x'""" )
Avoid using reflection in Python when functionality can be easily achieved without reflection
When using try-except blocks in Python, limit the except clause to the smallest set of specific errors possible instead of catching all exceptions
When using try-except blocks in Python to handle multiple possible variable types (duck-typing), keep the body of the try as small as possible and use the else block to implement the logic

Files:

  • tensorrt_llm/_torch/pyexecutor/sampler.py
**/*.{cpp,h,cu,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

All TensorRT-LLM Open Source Software code files should contain an NVIDIA copyright header that includes the current year at the top

Files:

  • tensorrt_llm/_torch/pyexecutor/sampler.py
🧠 Learnings (6)
📓 Common learnings
Learnt from: pengbowang-nv
Repo: NVIDIA/TensorRT-LLM PR: 7192
File: tests/integration/test_lists/test-db/l0_dgx_b200.yml:56-72
Timestamp: 2025-08-26T09:49:04.956Z
Learning: In TensorRT-LLM test configuration files, the test scheduling system handles wildcard matching with special rules that prevent duplicate test execution even when the same tests appear in multiple yaml files with overlapping GPU wildcards (e.g., "*b200*" and "*gb200*").
📚 Learning: 2025-12-12T03:27:18.859Z
Learnt from: tongyuantongyu
Repo: NVIDIA/TensorRT-LLM PR: 9655
File: tensorrt_llm/_torch/pyexecutor/sampler.py:3031-3031
Timestamp: 2025-12-12T03:27:18.859Z
Learning: In tensorrt_llm/_torch/pyexecutor/sampler.py, when reviewing code that iterates through requests, ensure it does not convert excessive data into Python lists. Instead, the code should use torch.gather or indexing to gather only the data that will be used in the for loop before converting to Python lists. This minimizes data movement and improves performance.

Applied to files:

  • tensorrt_llm/_torch/pyexecutor/sampler.py
📚 Learning: 2025-12-12T03:27:08.565Z
Learnt from: tongyuantongyu
Repo: NVIDIA/TensorRT-LLM PR: 9655
File: tensorrt_llm/_torch/pyexecutor/sampler.py:3031-3031
Timestamp: 2025-12-12T03:27:08.565Z
Learning: In files under tensorrt_llm/_torch/pyexecutor, avoid accessing torch.Tensor objects inside for-loops when iterating over requests. Convert batched tensors to Python lists beforehand using tensor.tolist(), and then iterate over those lists. This improves performance by reducing tensor-bound operations inside hot loops. Apply this pattern to similar code paths that process batches to access simple Python data structures (lists) inside loops.

Applied to files:

  • tensorrt_llm/_torch/pyexecutor/sampler.py
📚 Learning: 2025-08-28T10:25:22.370Z
Learnt from: ixlmar
Repo: NVIDIA/TensorRT-LLM PR: 7294
File: tensorrt_llm/_torch/pyexecutor/sampler.py:887-891
Timestamp: 2025-08-28T10:25:22.370Z
Learning: In tensorrt_llm/_torch/pyexecutor/sampler.py, the draft_probs and target_probs tensors have shapes [1, steps] not [steps, vocab_size] as might be expected, making the .squeeze(0) operations appropriate for removing the batch dimension of size 1.

Applied to files:

  • tensorrt_llm/_torch/pyexecutor/sampler.py
📚 Learning: 2025-08-13T16:20:37.987Z
Learnt from: dcampora
Repo: NVIDIA/TensorRT-LLM PR: 6867
File: tensorrt_llm/_torch/pyexecutor/sampler.py:67-72
Timestamp: 2025-08-13T16:20:37.987Z
Learning: In TensorRT-LLM sampler code, performance is prioritized over additional validation checks. The beam_width helper method intentionally returns the first request's beam_width without validating consistency across all requests to avoid performance overhead from iterating through the entire batch.

Applied to files:

  • tensorrt_llm/_torch/pyexecutor/sampler.py
📚 Learning: 2025-08-28T10:22:02.288Z
Learnt from: ixlmar
Repo: NVIDIA/TensorRT-LLM PR: 7294
File: tensorrt_llm/_torch/pyexecutor/sampler.py:1191-1197
Timestamp: 2025-08-28T10:22:02.288Z
Learning: In tensorrt_llm/_torch/pyexecutor/sampler.py, the object identity comparison `softmax_req_indices is not group_req_indices_cuda` on line ~1191 is intentional and used as an optimization to determine whether to reuse an existing indexer or create a new one, based on which code path was taken during tensor assignment.

Applied to files:

  • tensorrt_llm/_torch/pyexecutor/sampler.py
🪛 Ruff (0.14.8)
tensorrt_llm/_torch/pyexecutor/sampler.py

3052-3052: zip() without an explicit strict= parameter

Add explicit value for parameter strict=

(B905)

🔇 Additional comments (1)
jenkins/L0_Test.groovy (1)

2934-2957: New DGX H100 x4 Ray stage wiring looks consistent with existing routing (Ray + multi-GPU).
The added "DGX_H100-4_GPUs-PyTorch-Ray-1" entry should (a) pick up Ray via -Ray- and (b) be classified as multi-GPU via 4_GPUs, matching the PR intent.

log_probs_host = log_probs_host_tensor[seq_slots, 0, seq_lens].tolist()
idx = 0
for request in reqs_with_new_tokens:
for seq_slot, request in zip(seq_slots, reqs_with_new_tokens):
Copy link
Contributor

@coderabbitai coderabbitai bot Dec 14, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: Incorrect pairing of seq_slots with requests.

The zip(seq_slots, reqs_with_new_tokens) creates incorrect pairings because seq_slots is filtered (lines 3042-3048) to contain only requests where py_return_log_probs=True, while reqs_with_new_tokens contains all requests. When their lengths differ, zip() stops at the shorter length, causing:

  1. Requests with log probs may be paired with wrong seq_slots
  2. Some requests may be skipped entirely

Apply this fix to filter reqs_with_new_tokens before zipping:

+            reqs_with_log_probs = [r for r in reqs_with_new_tokens if r.py_return_log_probs]
             idx = 0
-            for seq_slot, request in zip(seq_slots, reqs_with_new_tokens):
-                if request.py_return_log_probs:
+            for seq_slot, request in zip(seq_slots, reqs_with_log_probs, strict=True):
                     log_probs = [
                         {
                             new_tokens_host[seq_slot]: Logprob(
                                 logprob=log_probs_host[idx],
                                 rank=1,
                             )
                         }
                     ]
                     cum_log_probs = [cum_log_probs_host[seq_slot]]
                     request.py_result.append_log_probs([log_probs], cum_log_probs)
                     idx += 1

The strict=True parameter ensures the lengths match and will raise an error if they don't, preventing silent data corruption.

🧰 Tools
🪛 Ruff (0.14.8)

3052-3052: zip() without an explicit strict= parameter

Add explicit value for parameter strict=

(B905)

🤖 Prompt for AI Agents
In tensorrt_llm/_torch/pyexecutor/sampler.py around line 3052, the loop uses
zip(seq_slots, reqs_with_new_tokens) which pairs filtered seq_slots (only
requests with py_return_log_probs=True) with the full reqs_with_new_tokens list,
causing mispairing and dropped requests; fix by first filtering
reqs_with_new_tokens to the same subset used to build seq_slots (i.e., only
those requests where py_return_log_probs is True) and then iterate with
zip(filtered_seq_slots, filtered_reqs_with_new_tokens, strict=True) so lengths
must match and Python will raise if they do not, preventing silent data
corruption.

Copy link
Member

Choose a reason for hiding this comment

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

This is valid issue. @shuyixiong please change to read from request.py_seq_slot sirectly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Collaborator Author

@shuyixiong shuyixiong Dec 14, 2025

Choose a reason for hiding this comment

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

Thanks. Changed in this commit.

@tensorrt-cicd
Copy link
Collaborator

PR_Github #28188 [ run ] triggered by Bot. Commit: 23378a6

@shuyixiong shuyixiong force-pushed the user/shuyix/add_ray_stage branch from 23378a6 to 46d5570 Compare December 14, 2025 04:31
@shuyixiong
Copy link
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #28202 [ run ] triggered by Bot. Commit: 46d5570

Signed-off-by: Shuyi Xiong <219646547+shuyixiong@users.noreply.github.com>
@shuyixiong shuyixiong force-pushed the user/shuyix/add_ray_stage branch from 46d5570 to 355d142 Compare December 14, 2025 08:27
@shuyixiong
Copy link
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #28235 [ run ] triggered by Bot. Commit: 355d142

Signed-off-by: Shuyi Xiong <219646547+shuyixiong@users.noreply.github.com>
@shuyixiong shuyixiong force-pushed the user/shuyix/add_ray_stage branch from 355d142 to c5f2a72 Compare December 14, 2025 11:46
@shuyixiong
Copy link
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #28244 [ run ] triggered by Bot. Commit: c5f2a72

@tensorrt-cicd
Copy link
Collaborator

PR_Github #28244 [ run ] completed with state SUCCESS. Commit: c5f2a72
/LLM/main/L0_MergeRequest_PR pipeline #21597 completed with status: 'FAILURE'

@shuyixiong
Copy link
Collaborator Author

Close this PR, since all the changes will be included in other PRs. Sampler fix in PR9655, ray stage added in PR9737

@shuyixiong shuyixiong closed this Dec 17, 2025
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.

3 participants