Skip to content

Conversation

@nzmora-nvidia
Copy link
Collaborator

@nzmora-nvidia nzmora-nvidia commented Nov 8, 2025

Shorten AD graph optimization by 30% (measured on Nemotron-6):

  • A bug in the transformation interface marked all passes as not clean, regardless of what was reported by the transformation
  • Fix how the optimization passes report the results of their actions. Many passes report that the graph is not clean even when they didn't participate in the optimization. Each graph cleaning invocation can take several seconds.

Summary by CodeRabbit

Release Notes

  • Refactor
    • Enhanced transformation status reporting across optimization modules. Cleanliness and shape validity metadata now dynamically reflect whether optimizations were applied, replacing static values with result-dependent flags for more accurate feedback on transformation success.

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.

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.

@nzmora-nvidia nzmora-nvidia requested a review from a team as a code owner November 8, 2025 10:40
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 8, 2025

📝 Walkthrough

Walkthrough

Changes to TransformInfo initialization across transform implementations and interface to conditionally set is_clean and has_valid_shapes based on match counts, and updates to interface.py to initialize info as None with conditional aggregation logic.

Changes

Cohort / File(s) Summary
Core Transform Interface
tensorrt_llm/_torch/auto_deploy/transform/interface.py
Modified _apply_per_gm_or_whole_model to initialize info = None instead of TransformInfo(), with conditional aggregation using info = info & info_apply if info is not None else info_apply, changing initial assignment behavior and potentially altering return type.
Library Transform Registrations
tensorrt_llm/_torch/auto_deploy/transform/library/attention.py
Updated is_clean and has_valid_shapes flags across seven transform registrations to derive from match counts (num_kv_patterns == 0, num_eager_patterns == 0, num_patterns == 0) instead of hard-coded False values.
Library Cleanup and Elimination Transforms
tensorrt_llm/_torch/auto_deploy/transform/library/cleanup_input_constraints.py, cleanup_noop_add.py, cleanup_noop_slice.py, eliminate_redundant_transposes.py, collectives.py
Updated TransformInfo construction to include is_clean and has_valid_shapes parameters derived from match/value-range counts, replacing hard-coded values with computed booleans.
Library Quantization and Fusion Transforms
tensorrt_llm/_torch/auto_deploy/transform/library/fuse_quant.py, fused_moe.py, fusion.py, mxfp4_moe.py, quantization.py
Modified TransformInfo initialization across multiple code paths to set is_clean and has_valid_shapes based on pattern/match counts (cnt == 0, num_matches == 0) instead of static False/True values.
Library Pattern-Specific Transforms
tensorrt_llm/_torch/auto_deploy/transform/library/rms_norm.py, rope.py, sharding.py
Updated TransformInfo construction to derive is_clean and has_valid_shapes from match counts, with rope.py also adjusting skipped behavior based on optimization counts.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Areas requiring attention:

  • interface.py None initialization: Verify that _apply_per_gm_or_whole_model correctly handles the case where no iterations occur (info remains None) and that callers expect this possibility
  • Cross-file consistency: Ensure the pattern of is_clean = num_matches == 0 and has_valid_shapes = num_matches == 0 is uniformly applied across all library files as intended
  • rope.py special case: Verify the distinct handling of skipped behavior alongside is_clean/has_valid_shapes derivation

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
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 ❓ Inconclusive PR description is incomplete. While it provides a brief explanation of the issue, it lacks required sections like Description and Test Coverage. Complete the Description section explaining the solution and provide Test Coverage section listing relevant test cases that safeguard these changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: improving AD graph optimization performance by fixing how non-participating passes report their results.
✨ 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.

@nzmora-nvidia nzmora-nvidia enabled auto-merge (squash) November 8, 2025 10:54
@nzmora-nvidia
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23895 [ run ] triggered by Bot. Commit: 459a14a

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23895 [ run ] completed with state SUCCESS. Commit: 459a14a
/LLM/main/L0_MergeRequest_PR pipeline #17990 completed with status: 'FAILURE'

@nzmora-nvidia
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23897 [ run ] triggered by Bot. Commit: 459a14a

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23897 [ run ] completed with state SUCCESS. Commit: 459a14a
/LLM/main/L0_MergeRequest_PR pipeline #17992 completed with status: 'FAILURE'

@nzmora-nvidia
Copy link
Collaborator Author

/bot run

1 similar comment
@nzmora-nvidia
Copy link
Collaborator Author

/bot run

@nzmora-nvidia nzmora-nvidia requested a review from MrGeva November 9, 2025 14:43
@tensorrt-cicd
Copy link
Collaborator

PR_Github #23924 [ run ] triggered by Bot. Commit: c9c7f35

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23924 [ run ] completed with state SUCCESS. Commit: c9c7f35
/LLM/main/L0_MergeRequest_PR pipeline #18014 completed with status: 'FAILURE'

@nzmora-nvidia
Copy link
Collaborator Author

`[2025-11-09T15:51:22.082Z] import pynvml # type: ignore[import]

[2025-11-09T15:51:23.972Z] Traceback (most recent call last):

[2025-11-09T15:51:23.972Z] File "", line 1, in

[2025-11-09T15:51:23.972Z] File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/init.py", line 66, in

[2025-11-09T15:51:23.972Z] import tensorrt_llm._torch.models as torch_models

[2025-11-09T15:51:23.972Z] File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/_torch/init.py", line 1, in

[2025-11-09T15:51:23.972Z] from .llm import LLM

[2025-11-09T15:51:23.972Z] File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/_torch/llm.py", line 1, in

[2025-11-09T15:51:23.972Z] from tensorrt_llm.llmapi.llm import _TorchLLM

[2025-11-09T15:51:23.972Z] File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/llmapi/init.py", line 2, in

[2025-11-09T15:51:23.972Z] from ..executor import CompletionOutput, LoRARequest, RequestError

[2025-11-09T15:51:23.972Z] File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/executor/init.py", line 1, in

[2025-11-09T15:51:23.972Z] from .executor import *

[2025-11-09T15:51:23.972Z] File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/executor/executor.py", line 17, in

[2025-11-09T15:51:23.972Z] from tensorrt_llm.inputs.multimodal import MultimodalParams

[2025-11-09T15:51:23.972Z] File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/inputs/init.py", line 3, in

[2025-11-09T15:51:23.972Z] from .multimodal import MultimodalInput

[2025-11-09T15:51:23.972Z] File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/inputs/multimodal.py", line 10, in

[2025-11-09T15:51:23.972Z] from torchvision.transforms import ToPILImage

[2025-11-09T15:51:23.972Z] File "/usr/local/lib/python3.10/dist-packages/torchvision/init.py", line 9, in

[2025-11-09T15:51:23.972Z] from .extension import _HAS_OPS # usort:skip

[2025-11-09T15:51:23.972Z] File "/usr/local/lib/python3.10/dist-packages/torchvision/extension.py", line 92, in

[2025-11-09T15:51:23.972Z] _check_cuda_version()

[2025-11-09T15:51:23.972Z] File "/usr/local/lib/python3.10/dist-packages/torchvision/extension.py", line 78, in _check_cuda_version

[2025-11-09T15:51:23.972Z] raise RuntimeError(

[2025-11-09T15:51:23.972Z] RuntimeError: Detected that PyTorch and torchvision were compiled with different CUDA major versions. PyTorch has CUDA Version=12.8 and torchvision has CUDA Version=13.0. Please reinstall the torchvision that matches your PyTorch install.

`

Copy link
Member

@lucaslie lucaslie left a comment

Choose a reason for hiding this comment

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

Thank you for taking care of this. I had a related ticket for this in #8742. Re-assigned it to you and linked it to this PR so it gets closed when you merge the PR

@nzmora-nvidia
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24041 [ run ] triggered by Bot. Commit: 1b3cf3f

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24041 [ run ] completed with state SUCCESS. Commit: 1b3cf3f
/LLM/main/L0_MergeRequest_PR pipeline #18115 completed with status: 'FAILURE'

@nzmora-nvidia
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24310 [ run ] triggered by Bot. Commit: 80d5613

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24310 [ run ] completed with state SUCCESS. Commit: 80d5613
/LLM/main/L0_MergeRequest_PR pipeline #18341 completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

@nzmora-nvidia nzmora-nvidia merged commit 53491ff into NVIDIA:main Nov 12, 2025
5 checks passed
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.

[Feature]: AutoDeploy: skip post_clean_up logic for unused transforms to speed up transform pipeline

4 participants