Skip to content

Conversation

ziyixiong-nv
Copy link
Collaborator

@ziyixiong-nv ziyixiong-nv commented Sep 29, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Correctly enables speculative decoding during CUDA graph warmup for draft models even when draft length is set to zero.
    • Ensures draft-state updates occur consistently, preventing missed updates and related warmup inconsistencies.
  • Performance

    • Improves reliability of CUDA graph warmup in speculative decoding workflows, reducing potential stalls or inefficiencies when using draft models.
  • Stability

    • More predictable behavior for draft-model configurations across different draft length settings.

Description

  • When creating CUDA graph for draft model, we only need to create the instance for either CDL or non-CDL.

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

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

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.

@ziyixiong-nv
Copy link
Collaborator Author

/bot run

Copy link
Contributor

coderabbitai bot commented Sep 29, 2025

📝 Walkthrough

Walkthrough

The CUDA graph warmup logic in model_engine.py now sets enable_spec_decode to true when either draft_len > 0 or the model is a draft model. The draft-state update and subsequent forward path use this flag, affecting per-request draft state updates and speculative decoding during warmup.

Changes

Cohort / File(s) Summary
Speculative decoding enablement during CUDA graph warmup
tensorrt_llm/_torch/pyexecutor/model_engine.py
enable_spec_decode now considers draft_len > 0 or is_draft_model; draft-state update call uses self.enable_spec_decode instead of only draft_len > 0; control flow allows draft models with draft_len == 0 to participate in spec decode during warmup; added clarifying comment.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller
  participant ModelEngine
  participant DraftState
  participant CUDAGraphWarmup as CUDA Graph Warmup

  rect rgb(235,245,255)
    note over ModelEngine: Warmup phase
    Caller->>ModelEngine: warmup()
    ModelEngine->>ModelEngine: compute enable_spec_decode = (draft_len > 0) OR is_draft_model
    alt enable_spec_decode == true
      ModelEngine->>DraftState: update_per_request_state()
    else
      note over ModelEngine: Skip draft-state update
    end
    ModelEngine->>CUDAGraphWarmup: capture forward()
    CUDAGraphWarmup-->>ModelEngine: graph captured
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks and finishing touches

❌ Failed checks (3 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ⚠️ Warning The pull request description does not follow the repository’s required template because it lacks the formatted PR title line (e.g., “[JIRA ticket][type] Summary”), the Description section is minimal and not explicitly labeled according to the template, and the Test Coverage section is present but empty. While a PR Checklist is included, key sections are incomplete or missing critical information needed for reviewers to understand the change and associated tests. This makes it unclear whether all template requirements are met. Please add the templated title line at the top of the PR description, populate the Description section with a clear explanation of the issue and the solution, list relevant test cases under Test Coverage, and ensure all PR Checklist items are consciously reviewed and either checked or rationalized.
Title Check ⚠️ Warning The title “[https://nvbugs/5534705][fix] Skip unnecessary CUDA graph capture” refers to skipping graph captures, but the pull request actually updates draft model inference state and enables speculative decoding during CUDA graph warmup rather than focusing on skipping captures. This mismatch between the described change and the implementation makes the title misleading. Therefore, the title does not clearly summarize the primary change of enabling spec decode for draft models with zero draft_len. Rename the title to emphasize the actual fix, for example: “[fix] Enable speculative decoding and update draft model inference state during CUDA graph warmup,” so it accurately reflects the core change.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • 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
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

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

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20200 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20200 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #15234 completed with status: 'FAILURE'

@ziyixiong-nv ziyixiong-nv marked this pull request as draft September 29, 2025 04:48
@ziyixiong-nv ziyixiong-nv changed the title [https://nvbugs/5534705][fix] Update inference state for draft model in warmup [https://nvbugs/5534705][fix] Swap the order of cuda graph creation Sep 29, 2025
@ziyixiong-nv
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20280 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20280 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #15292 completed with status: 'FAILURE'

@ziyixiong-nv ziyixiong-nv marked this pull request as ready for review September 30, 2025 10:21
@ziyixiong-nv
Copy link
Collaborator Author

/bot run

@ziyixiong-nv ziyixiong-nv changed the title [https://nvbugs/5534705][fix] Swap the order of cuda graph creation [https://nvbugs/5534705][fix] Skip unnecessary CUDA graph capture Sep 30, 2025
@tensorrt-cicd
Copy link
Collaborator

PR_Github #20367 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20367 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #15363 completed with status: 'FAILURE'

@ziyixiong-nv ziyixiong-nv force-pushed the dev-fxiong-bug5534705 branch from d25f71d to b5b00ce Compare October 1, 2025 01:56
@ziyixiong-nv
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20435 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20435 [ run ] completed with state DISABLED
L0 testing is limited to prioritized users. User ziyixiong-nv is not in the prioritized list. L0 testing cannot be triggered.

@ziyixiong-nv
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20503 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20503 [ run ] completed with state ABORTED
LLM/main/L0_MergeRequest_PR #15466 (Blue Ocean) completed with status: ABORTED

@ziyixiong-nv
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20514 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20514 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #15473 completed with status: 'FAILURE'

@ziyixiong-nv ziyixiong-nv force-pushed the dev-fxiong-bug5534705 branch from b5b00ce to 11de1dc Compare October 3, 2025 01:40
@ziyixiong-nv
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20562 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20562 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #15519 completed with status: 'FAILURE'

@ziyixiong-nv
Copy link
Collaborator Author

/bot run

@ziyixiong-nv ziyixiong-nv enabled auto-merge (squash) October 3, 2025 13:27
@tensorrt-cicd
Copy link
Collaborator

PR_Github #20585 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20585 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #15539 completed with status: 'FAILURE'

@ziyixiong-nv ziyixiong-nv force-pushed the dev-fxiong-bug5534705 branch from 11de1dc to 4d78488 Compare October 4, 2025 02:41
@ziyixiong-nv
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20623 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #20623 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #15570 completed with status: 'FAILURE'

@ziyixiong-nv
Copy link
Collaborator Author

/bot run

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