Skip to content

Conversation

@QiJune
Copy link
Collaborator

@QiJune QiJune commented Nov 1, 2025

Summary by CodeRabbit

Release Notes

Refactor

  • Consolidated PyTorch backend configuration into unified LlmArgs object throughout the codebase, simplifying configuration management.
  • Updated internal APIs for executor and resource creation to use the consolidated configuration approach.
  • Removed deprecated configuration helper methods from public APIs.

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

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 1, 2025

📝 Walkthrough

Walkthrough

This PR refactors the codebase to replace PyTorchConfig with TorchLlmArgs as the primary configuration object. It removes the PyTorchConfig class entirely, eliminates get_pytorch_backend_config() helper methods, and updates all call sites to pass the full llm_args object for configuration propagation.

Changes

Cohort / File(s) Summary
Configuration removal
tensorrt_llm/_torch/pyexecutor/config.py
Removed entire PyTorchConfig dataclass and _construct_checkpoint_loader helper function, eliminating the PyTorch-specific configuration surface.
PyExecutor refactoring
tensorrt_llm/_torch/pyexecutor/_util.py
Replaced pytorch_backend_config parameter with llm_args (TorchLlmArgs) across KvCacheCreator, create_py_executor_instance, and instantiate_sampler. Updated all internal logic to derive configuration from llm_args fields instead of separate config object.
Model loader updates
tensorrt_llm/_torch/pyexecutor/model_loader.py, tensorrt_llm/_torch/pyexecutor/model_engine.py
Moved _construct_checkpoint_loader function from config.py to model_loader.py; updated ModelLoader constructor signature to accept llm_args and updated KV cache validation error messages to reference llm_args.KvCacheConfig.dtype.
Executor creation refactoring
tensorrt_llm/_torch/pyexecutor/py_executor_creator.py
Replaced all PyTorchConfig references with llm_args-derived fields; updated attn_backend checks, sampler selection logic, and cuda graph handling to source from llm_args instead of separate backend config.
Auto-deploy configuration
tensorrt_llm/_torch/auto_deploy/llm.py, tensorrt_llm/_torch/auto_deploy/llm_args.py, tensorrt_llm/_torch/auto_deploy/shim/ad_executor.py
Removed get_pytorch_backend_config() method from LlmArgs; changed autodeploy executor configuration to receive full llm_args object instead of extracted backend config; removed type assertion in ad_executor.
Public API cleanup
tensorrt_llm/llmapi/llm_args.py, tensorrt_llm/executor/base_worker.py
Removed TorchLlmArgs.get_pytorch_backend_config() helper method; updated base_worker to pass entire llm_args to autodeploy executor instead of calling removed helper.
Example and test updates
examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py, tests/unittest/_torch/auto_deploy/.../test_llm_config.py, tests/unittest/_torch/modeling/test_modeling_llama_min_latency.py
Updated example code to use MoeConfig in pytorch_config_params; removed test validating get_pytorch_backend_config() return; replaced PyTorchConfig usage with direct ModelConfig.enable_min_latency boolean attribute.

Sequence Diagram

sequenceDiagram
    participant User
    participant Worker as base_worker
    participant Executor as py_executor_creator
    participant PyExec as PyExecutor

    rect rgb(200, 220, 240)
    Note over Worker,PyExec: Old Flow (with PyTorchConfig)
    User->>Worker: initialize with llm_args
    Worker->>Worker: pytorch_cfg = llm_args.get_pytorch_backend_config()
    Worker->>Executor: create_py_executor(pytorch_cfg)
    Executor->>Executor: derive settings from pytorch_cfg
    Executor->>PyExec: KvCacheCreator(pytorch_cfg)
    end

    rect rgb(220, 240, 200)
    Note over Worker,PyExec: New Flow (with TorchLlmArgs)
    User->>Worker: initialize with llm_args
    Worker->>Executor: create_py_executor(llm_args)
    Executor->>Executor: derive settings from llm_args
    Executor->>PyExec: KvCacheCreator(llm_args)
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

  • High-risk areas requiring careful verification:
    • tensorrt_llm/_torch/pyexecutor/_util.py: Extensive parameter replacement across multiple functions and internal field references; ensure all pytorch_backend_config accesses are correctly migrated to llm_args equivalent fields
    • tensorrt_llm/_torch/pyexecutor/py_executor_creator.py: Multiple attn_backend and config checks now derive from llm_args; verify logic paths remain equivalent and sampler selection criteria are correctly preserved
    • tensorrt_llm/_torch/pyexecutor/model_loader.py: Function relocation and signature changes; confirm _construct_checkpoint_loader behavior is unchanged and imports are properly wired
    • Type signature changes across call chains must be validated for consistency (e.g., TorchLlmArgs vs LlmArgs usage in different modules)

Possibly related PRs

Suggested reviewers

  • syuoni
  • netanel-haber
  • Superjomn

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ⚠️ Warning The PR description provided by the author consists entirely of the repository's PR template with all required sections left empty or containing only template comments. The Description section lacks any explanation of what is being changed or why, the Test Coverage section is blank with no test cases identified, and while the PR Checklist has one final checkbox marked, the individual checklist items (coding guidelines, test cases, dependencies, CODEOWNERS, documentation) are not individually confirmed or addressed. The PR title exists in the GitHub metadata as "[TRTLLM-9065][chore] remove PyTorchConfig completely," but no substantive content fills the template sections to explain the scope and rationale of the changes. The author should complete the PR description by: providing a clear explanation in the Description section of what PyTorchConfig is being removed and why this refactoring is beneficial; listing the specific tests in Test Coverage that validate these changes (such as the test files mentioned in the raw_summary); and individually confirming each PR Checklist item with explicit statements about how the PR adheres to coding guidelines, includes test coverage, handles dependencies, updates documentation, etc. This will ensure reviewers have the necessary context to understand and evaluate the refactoring work.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "[TRTLLM-9065][chore] remove PyTorchConfig completely" accurately and directly describes the main objective of the changeset. The raw summary confirms that the PR removes the PyTorchConfig class from config.py, eliminates related helper functions, and replaces all references to PyTorchConfig across multiple files with TorchLlmArgs. The title follows the required format with a valid JIRA ticket, type designation, and concise descriptive text that a teammate scanning history would immediately understand as a configuration class removal.
✨ 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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tensorrt_llm/_torch/pyexecutor/model_loader.py (1)

19-27: Drop stale LoadFormat import from .config.

With PyTorchConfig being removed, .config no longer exports LoadFormat, so this import will raise at import time. The new LoadFormat coming from llm_args is the one we should keep—please delete the .config import to avoid an immediate ImportError.

-from .config import LoadFormat
📜 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 89e0117 and c649d35.

📒 Files selected for processing (13)
  • examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py (2 hunks)
  • tensorrt_llm/_torch/auto_deploy/llm.py (1 hunks)
  • tensorrt_llm/_torch/auto_deploy/llm_args.py (0 hunks)
  • tensorrt_llm/_torch/auto_deploy/shim/ad_executor.py (0 hunks)
  • tensorrt_llm/_torch/pyexecutor/_util.py (11 hunks)
  • tensorrt_llm/_torch/pyexecutor/config.py (0 hunks)
  • tensorrt_llm/_torch/pyexecutor/model_engine.py (1 hunks)
  • tensorrt_llm/_torch/pyexecutor/model_loader.py (4 hunks)
  • tensorrt_llm/_torch/pyexecutor/py_executor_creator.py (9 hunks)
  • tensorrt_llm/executor/base_worker.py (1 hunks)
  • tensorrt_llm/llmapi/llm_args.py (1 hunks)
  • tests/unittest/_torch/auto_deploy/unit/singlegpu/shim/test_llm_config.py (0 hunks)
  • tests/unittest/_torch/modeling/test_modeling_llama_min_latency.py (2 hunks)
💤 Files with no reviewable changes (4)
  • tensorrt_llm/_torch/auto_deploy/llm_args.py
  • tests/unittest/_torch/auto_deploy/unit/singlegpu/shim/test_llm_config.py
  • tensorrt_llm/_torch/pyexecutor/config.py
  • tensorrt_llm/_torch/auto_deploy/shim/ad_executor.py
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Use only spaces, no tabs; indent with 4 spaces.

Files:

  • tensorrt_llm/_torch/auto_deploy/llm.py
  • tensorrt_llm/llmapi/llm_args.py
  • tensorrt_llm/_torch/pyexecutor/_util.py
  • tensorrt_llm/executor/base_worker.py
  • tensorrt_llm/_torch/pyexecutor/py_executor_creator.py
  • examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py
  • tensorrt_llm/_torch/pyexecutor/model_engine.py
  • tests/unittest/_torch/modeling/test_modeling_llama_min_latency.py
  • tensorrt_llm/_torch/pyexecutor/model_loader.py
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.py: Python code must target Python 3.8+.
Indent Python code with 4 spaces; do not use tabs.
Maintain module namespace when importing; prefer 'from package.subpackage import foo' then 'foo.SomeClass()' instead of importing the class directly.
Python filenames should be snake_case (e.g., some_file.py).
Python classes use PascalCase names.
Functions and methods use snake_case names.
Local variables use snake_case; prefix 'k' for variables that start with a number (e.g., k_99th_percentile).
Global variables use upper SNAKE_CASE prefixed with 'G' (e.g., G_MY_GLOBAL).
Constants use upper SNAKE_CASE (e.g., MY_CONSTANT).
Avoid shadowing variables from an outer scope.
Initialize all externally visible members of a class in the constructor.
Prefer docstrings for interfaces that may be used outside a file; comments for in-function or file-local interfaces.
Use Google-style docstrings for classes and functions (Sphinx-parsable).
Document attributes and variables inline so they render under the class/function docstring.
Avoid reflection when a simpler, explicit approach suffices (e.g., avoid dict(**locals()) patterns).
In try/except, catch the most specific exceptions possible.
For duck-typing try/except, keep the try body minimal and use else for the main logic.

Files:

  • tensorrt_llm/_torch/auto_deploy/llm.py
  • tensorrt_llm/llmapi/llm_args.py
  • tensorrt_llm/_torch/pyexecutor/_util.py
  • tensorrt_llm/executor/base_worker.py
  • tensorrt_llm/_torch/pyexecutor/py_executor_creator.py
  • examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py
  • tensorrt_llm/_torch/pyexecutor/model_engine.py
  • tests/unittest/_torch/modeling/test_modeling_llama_min_latency.py
  • tensorrt_llm/_torch/pyexecutor/model_loader.py
**/*.{cpp,cxx,cc,h,hpp,hh,hxx,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Prepend the NVIDIA Apache-2.0 copyright header with current year to the top of all source files (e.g., .cpp, .h, .cu, .py).

Files:

  • tensorrt_llm/_torch/auto_deploy/llm.py
  • tensorrt_llm/llmapi/llm_args.py
  • tensorrt_llm/_torch/pyexecutor/_util.py
  • tensorrt_llm/executor/base_worker.py
  • tensorrt_llm/_torch/pyexecutor/py_executor_creator.py
  • examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py
  • tensorrt_llm/_torch/pyexecutor/model_engine.py
  • tests/unittest/_torch/modeling/test_modeling_llama_min_latency.py
  • tensorrt_llm/_torch/pyexecutor/model_loader.py
🧠 Learnings (22)
📓 Common learnings
Learnt from: venkywonka
Repo: NVIDIA/TensorRT-LLM PR: 6029
File: .github/pull_request_template.md:45-53
Timestamp: 2025-08-27T17:50:13.264Z
Learning: For PR templates in TensorRT-LLM, avoid suggesting changes that would increase developer overhead, such as converting plain bullets to mandatory checkboxes. The team prefers guidance-style bullets that don't require explicit interaction to reduce friction in the PR creation process.
Learnt from: jiaganc
Repo: NVIDIA/TensorRT-LLM PR: 7031
File: tensorrt_llm/bench/dataclasses/configuration.py:90-104
Timestamp: 2025-08-26T09:37:10.463Z
Learning: In TensorRT-LLM, the `get_pytorch_perf_config()` method returns `self.pytorch_config` which can contain default `cuda_graph_config` values, so `llm_args` may already have this config before the extra options processing.
Learnt from: jiaganc
Repo: NVIDIA/TensorRT-LLM PR: 7031
File: tensorrt_llm/bench/dataclasses/configuration.py:90-104
Timestamp: 2025-08-26T09:37:10.463Z
Learning: In TensorRT-LLM's bench configuration, the `get_pytorch_perf_config()` method returns `self.pytorch_config` which is a Dict[str, Any] that can contain default values including `cuda_graph_config`, making the fallback `llm_args["cuda_graph_config"]` safe to use.
📚 Learning: 2025-08-26T09:37:10.463Z
Learnt from: jiaganc
Repo: NVIDIA/TensorRT-LLM PR: 7031
File: tensorrt_llm/bench/dataclasses/configuration.py:90-104
Timestamp: 2025-08-26T09:37:10.463Z
Learning: In TensorRT-LLM, the `get_pytorch_perf_config()` method returns `self.pytorch_config` which can contain default `cuda_graph_config` values, so `llm_args` may already have this config before the extra options processing.

Applied to files:

  • tensorrt_llm/_torch/auto_deploy/llm.py
  • tensorrt_llm/llmapi/llm_args.py
  • tensorrt_llm/_torch/pyexecutor/_util.py
  • tensorrt_llm/executor/base_worker.py
  • tensorrt_llm/_torch/pyexecutor/py_executor_creator.py
  • examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py
  • tests/unittest/_torch/modeling/test_modeling_llama_min_latency.py
  • tensorrt_llm/_torch/pyexecutor/model_loader.py
📚 Learning: 2025-08-26T09:37:10.463Z
Learnt from: jiaganc
Repo: NVIDIA/TensorRT-LLM PR: 7031
File: tensorrt_llm/bench/dataclasses/configuration.py:90-104
Timestamp: 2025-08-26T09:37:10.463Z
Learning: In TensorRT-LLM's bench configuration, the `get_pytorch_perf_config()` method returns `self.pytorch_config` which is a Dict[str, Any] that can contain default values including `cuda_graph_config`, making the fallback `llm_args["cuda_graph_config"]` safe to use.

Applied to files:

  • tensorrt_llm/_torch/auto_deploy/llm.py
  • tensorrt_llm/llmapi/llm_args.py
  • tensorrt_llm/_torch/pyexecutor/_util.py
  • tensorrt_llm/executor/base_worker.py
  • tensorrt_llm/_torch/pyexecutor/py_executor_creator.py
  • examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py
  • tests/unittest/_torch/modeling/test_modeling_llama_min_latency.py
  • tensorrt_llm/_torch/pyexecutor/model_loader.py
📚 Learning: 2025-08-19T12:45:11.997Z
Learnt from: amitz-nv
Repo: NVIDIA/TensorRT-LLM PR: 7033
File: tensorrt_llm/_torch/pyexecutor/model_engine.py:0-0
Timestamp: 2025-08-19T12:45:11.997Z
Learning: In tensorrt_llm/_torch/pyexecutor/model_engine.py, DoRA (Delta Orthogonal Rank Adaptation) functionality was removed from the PyTorch flow to eliminate issues with inverted DoRA detection logic. The original is_dora condition was checking if scaling_vec_pointer == 0, which was potentially incorrect.

Applied to files:

  • tensorrt_llm/_torch/auto_deploy/llm.py
  • tensorrt_llm/llmapi/llm_args.py
  • tensorrt_llm/_torch/pyexecutor/_util.py
  • tensorrt_llm/executor/base_worker.py
  • tensorrt_llm/_torch/pyexecutor/py_executor_creator.py
  • examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py
  • tensorrt_llm/_torch/pyexecutor/model_engine.py
📚 Learning: 2025-08-14T15:38:01.771Z
Learnt from: MatthiasKohl
Repo: NVIDIA/TensorRT-LLM PR: 6904
File: cpp/tensorrt_llm/pybind/thop/bindings.cpp:55-57
Timestamp: 2025-08-14T15:38:01.771Z
Learning: In TensorRT-LLM Python bindings, tensor parameter collections like mla_tensor_params and spec_decoding_tensor_params are kept as required parameters without defaults to maintain API consistency, even when it might affect backward compatibility.

Applied to files:

  • tensorrt_llm/llmapi/llm_args.py
  • tensorrt_llm/_torch/pyexecutor/_util.py
  • examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py
📚 Learning: 2025-08-26T06:07:02.166Z
Learnt from: shaharmor98
Repo: NVIDIA/TensorRT-LLM PR: 7231
File: tensorrt_llm/_torch/pyexecutor/_util.py:504-509
Timestamp: 2025-08-26T06:07:02.166Z
Learning: In tensorrt_llm/_torch/pyexecutor/_util.py, when calling model_engine.set_lora_model_config(), pass model_binding_config.mlp_hidden_size directly without multiplying by mapping.tp_size, as the mlp_hidden_size from get_bindings_model_config() is already the per-TP rank value needed for LoRA weight packaging.

Applied to files:

  • tensorrt_llm/_torch/pyexecutor/_util.py
  • tensorrt_llm/_torch/pyexecutor/py_executor_creator.py
  • examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py
  • tensorrt_llm/_torch/pyexecutor/model_engine.py
  • tests/unittest/_torch/modeling/test_modeling_llama_min_latency.py
📚 Learning: 2025-07-28T17:06:08.621Z
Learnt from: moraxu
Repo: NVIDIA/TensorRT-LLM PR: 6303
File: tests/integration/test_lists/qa/examples_test_list.txt:494-494
Timestamp: 2025-07-28T17:06:08.621Z
Learning: In TensorRT-LLM testing, it's common to have both CLI flow tests (test_cli_flow.py) and PyTorch API tests (test_llm_api_pytorch.py) for the same model. These serve different purposes: CLI flow tests validate the traditional command-line workflow, while PyTorch API tests validate the newer LLM API backend. Both are legitimate and should coexist.

Applied to files:

  • tensorrt_llm/_torch/pyexecutor/_util.py
  • tensorrt_llm/_torch/pyexecutor/py_executor_creator.py
  • examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py
  • tests/unittest/_torch/modeling/test_modeling_llama_min_latency.py
  • tensorrt_llm/_torch/pyexecutor/model_loader.py
📚 Learning: 2025-08-14T15:43:23.107Z
Learnt from: MatthiasKohl
Repo: NVIDIA/TensorRT-LLM PR: 6904
File: tensorrt_llm/_torch/attention_backend/trtllm.py:259-262
Timestamp: 2025-08-14T15:43:23.107Z
Learning: In TensorRT-LLM's attention backend, tensor parameters in the plan() method are assigned directly without validation (dtype, device, contiguity checks). This maintains consistency across all tensor inputs and follows the pattern of trusting callers to provide correctly formatted tensors.

Applied to files:

  • tensorrt_llm/_torch/pyexecutor/_util.py
  • tensorrt_llm/_torch/pyexecutor/py_executor_creator.py
📚 Learning: 2025-08-22T01:54:35.850Z
Learnt from: djns99
Repo: NVIDIA/TensorRT-LLM PR: 7104
File: cpp/tensorrt_llm/kernels/cutlass_kernels/include/moe_kernels.h:999-1000
Timestamp: 2025-08-22T01:54:35.850Z
Learning: The `internal_cutlass_kernels` directory in TensorRT-LLM is a mirror of an internal NVIDIA repository and maintains its own implementation and API that may diverge from the public `cutlass_kernels` version. API inconsistencies between these two directories are intentional and by design, not bugs to be fixed.

Applied to files:

  • tensorrt_llm/_torch/pyexecutor/_util.py
📚 Learning: 2025-09-23T15:12:38.312Z
Learnt from: nv-lschneider
Repo: NVIDIA/TensorRT-LLM PR: 7910
File: cpp/tensorrt_llm/thop/allreduceOp.cpp:352-446
Timestamp: 2025-09-23T15:12:38.312Z
Learning: In TensorRT-LLM NCCL device implementation, NCCL version 2.28+ requirements are handled at runtime in the nccl_device/config layer rather than with compile-time guards. This allows the allreduceOp to remain version-agnostic and delegates version compatibility validation to the appropriate lower-level components that can gracefully handle unsupported configurations.

Applied to files:

  • tensorrt_llm/_torch/pyexecutor/_util.py
📚 Learning: 2025-08-14T21:04:50.248Z
Learnt from: thorjohnsen
Repo: NVIDIA/TensorRT-LLM PR: 6910
File: cpp/tensorrt_llm/batch_manager/kvCacheManager.cpp:0-0
Timestamp: 2025-08-14T21:04:50.248Z
Learning: In KV cache onboarding logic during prefill in cpp/tensorrt_llm/batch_manager/kvCacheManager.cpp, when calculating which blocks fall within the attention window, use getTokensPerBlock() to advance token indices rather than block->getUniqueTokens().size(), because the calculation needs to consider the post-prefill state where blocks will be filled to capacity, not their current token count.

Applied to files:

  • tensorrt_llm/_torch/pyexecutor/_util.py
  • tensorrt_llm/_torch/pyexecutor/py_executor_creator.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/_util.py
  • tensorrt_llm/_torch/pyexecutor/py_executor_creator.py
📚 Learning: 2025-07-17T09:01:27.402Z
Learnt from: amitz-nv
Repo: NVIDIA/TensorRT-LLM PR: 5616
File: tensorrt_llm/executor/worker.py:375-384
Timestamp: 2025-07-17T09:01:27.402Z
Learning: In tensorrt_llm/executor/worker.py, the LoRA adapter cache optimization logic that checks `is_adapter_in_cpu_cache()` and conditionally passes None for weights/config has a known race condition issue that cannot be solved with simple error handling or verification checks. This is a known limitation that requires a more comprehensive solution.

Applied to files:

  • tensorrt_llm/executor/base_worker.py
📚 Learning: 2025-08-19T12:45:35.429Z
Learnt from: amitz-nv
Repo: NVIDIA/TensorRT-LLM PR: 7033
File: tensorrt_llm/_torch/pyexecutor/model_engine.py:2086-2092
Timestamp: 2025-08-19T12:45:35.429Z
Learning: DoRA (Delta Orthogonal Rank Adaptation) functionality has been removed from the PyTorch flow in tensorrt_llm/_torch/pyexecutor/model_engine.py. The is_dora field is computed but not used downstream in the PyTorch flow, so converting it to a tensor would be wasteful overhead.

Applied to files:

  • tensorrt_llm/_torch/pyexecutor/py_executor_creator.py
📚 Learning: 2025-08-06T13:58:07.506Z
Learnt from: galagam
Repo: NVIDIA/TensorRT-LLM PR: 6487
File: tests/unittest/_torch/auto_deploy/unit/singlegpu/test_ad_trtllm_bench.py:1-12
Timestamp: 2025-08-06T13:58:07.506Z
Learning: In TensorRT-LLM, test files (files under tests/ directories) do not require NVIDIA copyright headers, unlike production source code files. Test files typically start directly with imports, docstrings, or code.

Applied to files:

  • tensorrt_llm/_torch/pyexecutor/py_executor_creator.py
  • examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py
📚 Learning: 2025-08-14T23:23:27.449Z
Learnt from: djns99
Repo: NVIDIA/TensorRT-LLM PR: 6915
File: cpp/tensorrt_llm/kernels/cutlass_kernels/moe_gemm/moe_kernels.cu:4010-4012
Timestamp: 2025-08-14T23:23:27.449Z
Learning: For MOE (Mixture of Experts) code reviews in TensorRT-LLM, avoid repeatedly suggesting finalize fusion validation checks and safety assertions. The user djns99 has indicated these suggestions are repetitive and unwanted across multiple MOE-related changes.

Applied to files:

  • examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py
📚 Learning: 2025-09-09T09:40:45.658Z
Learnt from: fredricz-20070104
Repo: NVIDIA/TensorRT-LLM PR: 7645
File: tests/integration/test_lists/qa/llm_function_core.txt:648-648
Timestamp: 2025-09-09T09:40:45.658Z
Learning: In TensorRT-LLM test lists, it's common and intentional for the same test to appear in multiple test list files when they serve different purposes (e.g., llm_function_core.txt for comprehensive core functionality testing and llm_function_core_sanity.txt for quick sanity checks). This duplication allows tests to be run in different testing contexts.

Applied to files:

  • examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py
📚 Learning: 2025-08-01T15:14:45.673Z
Learnt from: yibinl-nvidia
Repo: NVIDIA/TensorRT-LLM PR: 6506
File: examples/models/core/mixtral/requirements.txt:3-3
Timestamp: 2025-08-01T15:14:45.673Z
Learning: In TensorRT-LLM, examples directory can have different dependency versions than the root requirements.txt file. Version conflicts between root and examples dependencies are acceptable because examples are designed to be standalone and self-contained.

Applied to files:

  • examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py
📚 Learning: 2025-08-09T02:04:49.623Z
Learnt from: Fridah-nv
Repo: NVIDIA/TensorRT-LLM PR: 6760
File: tensorrt_llm/_torch/auto_deploy/models/quant_config_reader.py:81-98
Timestamp: 2025-08-09T02:04:49.623Z
Learning: In TensorRT-LLM's auto_deploy module, torch.dtype values in configuration dictionaries must be stored as string representations (e.g., "float16" instead of torch.float16) because OmegaConf.merge does not support torch.dtype types. These string representations are converted to actual torch.dtype objects in downstream code.

Applied to files:

  • examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py
📚 Learning: 2025-10-20T16:54:09.824Z
Learnt from: nvchenghaoz
Repo: NVIDIA/TensorRT-LLM PR: 8469
File: tensorrt_llm/_torch/auto_deploy/custom_ops/rms_norm.py:6-6
Timestamp: 2025-10-20T16:54:09.824Z
Learning: In tensorrt_llm/_torch/auto_deploy/custom_ops/rms_norm.py, the import `from ...modules.mamba.layernorm_gated import _layer_norm_fwd` is correct and should not be changed to modules.fla.layernorm_gated. The _layer_norm_fwd function exists in both modules/mamba/layernorm_gated.py and modules/fla/layernorm_gated.py, but the mamba version is the intended implementation for this use case.

Applied to files:

  • tensorrt_llm/_torch/pyexecutor/model_engine.py
📚 Learning: 2025-08-21T02:39:12.009Z
Learnt from: djns99
Repo: NVIDIA/TensorRT-LLM PR: 7104
File: cpp/tensorrt_llm/kernels/cutlass_kernels/moe_gemm/moe_kernels.cu:1475-1480
Timestamp: 2025-08-21T02:39:12.009Z
Learning: The min latency mode functionality in TensorRT-LLM MOE kernels (cpp/tensorrt_llm/kernels/cutlass_kernels/moe_gemm/moe_kernels.cu) is deprecated and no longer being maintained/updated, as confirmed by djns99. Bug reports and optimization suggestions for the computeStridesTmaWarpSpecializedLowLatencyKernel and related min latency code paths should be deprioritized.

Applied to files:

  • tests/unittest/_torch/modeling/test_modeling_llama_min_latency.py
📚 Learning: 2025-09-16T09:30:09.716Z
Learnt from: tongyuantongyu
Repo: NVIDIA/TensorRT-LLM PR: 7763
File: cpp/tensorrt_llm/CMakeLists.txt:297-301
Timestamp: 2025-09-16T09:30:09.716Z
Learning: In the TensorRT-LLM project, NCCL libraries are loaded earlier by PyTorch libraries or the bindings library, so the main shared library doesn't need NCCL paths in its RPATH - the libraries will already be available in the process address space when needed.

Applied to files:

  • tests/unittest/_torch/modeling/test_modeling_llama_min_latency.py
🧬 Code graph analysis (5)
tensorrt_llm/_torch/pyexecutor/_util.py (2)
tensorrt_llm/llmapi/llm_args.py (4)
  • TorchLlmArgs (2404-2828)
  • extra_resource_managers (2625-2626)
  • extra_resource_managers (2629-2630)
  • SamplerType (2343-2347)
tensorrt_llm/_torch/pyexecutor/model_engine.py (1)
  • PyTorchModelEngine (128-2538)
tensorrt_llm/_torch/pyexecutor/py_executor_creator.py (2)
tensorrt_llm/llmapi/llm_args.py (5)
  • spec_dec_mode (528-535)
  • spec_dec_mode (666-671)
  • spec_dec_mode (720-723)
  • spec_dec_mode (853-860)
  • LoadFormat (2335-2340)
tensorrt_llm/_torch/pyexecutor/_util.py (2)
  • validate_feature_combination (980-1073)
  • _adjust_torch_mem_fraction (933-977)
examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py (1)
tensorrt_llm/llmapi/llm_args.py (1)
  • MoeConfig (264-298)
tensorrt_llm/_torch/pyexecutor/model_engine.py (1)
tensorrt_llm/_torch/pyexecutor/model_loader.py (1)
  • _construct_checkpoint_loader (157-179)
tensorrt_llm/_torch/pyexecutor/model_loader.py (3)
tensorrt_llm/_torch/models/checkpoints/base_checkpoint_loader.py (1)
  • BaseCheckpointLoader (19-87)
tensorrt_llm/llmapi/llm_args.py (1)
  • LoadFormat (2335-2340)
tensorrt_llm/_torch/models/modeling_utils.py (2)
  • get_checkpoint_weight_loader (699-702)
  • get_config_loader (705-708)
🔇 Additional comments (7)
examples/llm-eval/lm-eval-harness/lm_eval_tensorrt_llm.py (2)

40-40: LGTM: Import is correctly added.

The import of MoeConfig from tensorrt_llm.llmapi.llm_args is necessary for the configuration refactoring and follows the module namespace import style.


98-102: All parameters properly accepted by TORCH_LLM constructor and recognized in TorchLlmArgs.

The MoeConfig instantiation is correct. The three parameters in pytorch_config_params (moe_config, cuda_graph_config, print_iter_log) are all valid TorchLlmArgs fields and will be properly handled by the LLM constructor through **kwargs unpacking.

PyTorchConfig still exists in the codebase (serialization.py, bench/dataclasses/), but these are in separate modules unrelated to the reviewed file. The lm_eval_tensorrt_llm.py file properly removes its PyTorchConfig dependency.

tensorrt_llm/_torch/auto_deploy/llm.py (1)

178-178: LGTM - Configuration refactor aligns with PR objective.

The change from passing self.args.get_pytorch_backend_config() to passing self.args directly simplifies configuration propagation by eliminating the intermediate PyTorchConfig object. This aligns with the PR's goal to remove PyTorchConfig completely.

tests/unittest/_torch/modeling/test_modeling_llama_min_latency.py (2)

160-160: LGTM - Simplified configuration approach.

Setting enable_min_latency directly on ModelConfig eliminates the need for PyTorchConfig and simplifies the test setup. The change is consistent with the PR's refactoring objective.


292-292: LGTM - Consistent with test refactoring.

Same configuration simplification as line 160, applied to the accuracy comparison test. The direct field assignment approach is cleaner and eliminates PyTorchConfig dependency.

tensorrt_llm/llmapi/llm_args.py (1)

11-12: LGTM - Import cleanup.

The simplified typing imports consolidate the import statement without changing runtime behavior. This is standard cleanup accompanying the removal of PyTorchConfig-related code.

tensorrt_llm/executor/base_worker.py (1)

131-131: LGTM - Consistent configuration refactor.

Passing self.llm_args directly instead of self.llm_args.get_pytorch_backend_config() eliminates the PyTorchConfig intermediate object. This change mirrors the refactoring in tensorrt_llm/_torch/auto_deploy/llm.py and aligns with the PR's objective to remove PyTorchConfig completely.

@QiJune
Copy link
Collaborator Author

QiJune commented Nov 1, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23257 [ run ] triggered by Bot. Commit: c649d35

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23257 [ run ] completed with state FAILURE. Commit: c649d35
/LLM/main/L0_MergeRequest_PR pipeline #17526 completed with status: 'FAILURE'

@QiJune
Copy link
Collaborator Author

QiJune commented Nov 2, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23274 [ run ] triggered by Bot. Commit: 19e083e

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23274 [ run ] completed with state FAILURE. Commit: 19e083e
/LLM/main/L0_MergeRequest_PR pipeline #17537 completed with status: 'FAILURE'

Signed-off-by: junq <[email protected]>
Signed-off-by: junq <[email protected]>
@QiJune
Copy link
Collaborator Author

QiJune commented Nov 2, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23278 [ run ] triggered by Bot. Commit: b0b3011

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23278 [ run ] completed with state FAILURE. Commit: b0b3011
/LLM/main/L0_MergeRequest_PR pipeline #17541 completed with status: 'FAILURE'

Signed-off-by: junq <[email protected]>
@QiJune
Copy link
Collaborator Author

QiJune commented Nov 2, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23282 [ run ] triggered by Bot. Commit: 8910a7b

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23282 [ run ] completed with state SUCCESS. Commit: 8910a7b
/LLM/main/L0_MergeRequest_PR pipeline #17545 completed with status: 'FAILURE'

Signed-off-by: junq <[email protected]>
@QiJune QiJune requested a review from a team as a code owner November 2, 2025 10:58
@QiJune
Copy link
Collaborator Author

QiJune commented Nov 2, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23289 [ run ] triggered by Bot. Commit: 9b4fefa

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23289 [ run ] completed with state SUCCESS. Commit: 9b4fefa
/LLM/main/L0_MergeRequest_PR pipeline #17550 completed with status: 'FAILURE'

Signed-off-by: junq <[email protected]>
@QiJune
Copy link
Collaborator Author

QiJune commented Nov 2, 2025

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23290 [ run ] triggered by Bot. Commit: 2d812d9

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23290 [ run ] completed with state SUCCESS. Commit: 2d812d9
/LLM/main/L0_MergeRequest_PR pipeline #17551 completed with status: 'FAILURE'

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.

2 participants