Skip to content

Conversation

LinPoly
Copy link
Collaborator

@LinPoly LinPoly commented Jul 3, 2025

Description

Change default backend to PyTorch in trtllm-serve

Test Coverage

Change the existing tests.

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 [--disable-fail-fast --skip-test --stage-list "A10-1, xxx" --gpu-type "A30, H100_PCIe" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-[Post-Merge]-1, xxx"]

Launch build/test pipelines. All previously running jobs will be killed.

--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-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-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.

--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. Will also run 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-[Post-Merge]-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-[Post-Merge]-1, xxx".

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md.

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.

Summary by CodeRabbit

  • New Features

    • Added support for selecting between "pytorch" and "trt" backends in serving commands and configuration files, with "pytorch" as the default.
  • Bug Fixes

    • Ensured backend selection is always explicit and consistent across command-line options and test configurations.
  • Tests

    • Updated integration and unit tests to explicitly specify and test both "pytorch" and "trt" backends.
    • Simplified and unified backend handling in test fixtures and server argument construction.
    • Improved test fixture naming and parameterization for clarity and consistency.
  • Chores

    • Removed redundant installation steps in example-related tests.
    • Standardized string quoting and streamlined argument list construction in test files.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the default serving backend to PyTorch across the codebase and aligns all tests and CLI flags to always specify the backend explicitly.

  • Switch test fixtures to use "tensorrt" instead of None/"trt" and always include a --backend argument
  • Remove redundant conditional backend handling in tests, streamlining argument lists
  • Update serve.py so that PyTorch is the default backend in both function defaults and the CLI, and extend choice options

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/unittest/llmapi/apps/_test_openai_reasoning.py Fixture params updated to ["tensorrt","pytorch"]
tests/unittest/llmapi/apps/_test_openai_multi_nodes.py Expanded args list and always add --backend
tests/unittest/llmapi/apps/_test_openai_multi_gpu.py Unified backend handling, removed conditional branch
tests/unittest/llmapi/apps/_test_openai_misc.py Simplified arg building, always include --backend
tests/unittest/llmapi/apps/_test_openai_metrics.py Removed redundant backend="pytorch" in client setup
tests/unittest/llmapi/apps/_test_openai_completions.py Conditionally add --max_beam_width only for TRT
tests/unittest/llmapi/apps/_test_openai_chat.py Same as above for chat tests
tensorrt_llm/commands/serve.py Default backend set to "pytorch", CLI updated
Comments suppressed due to low confidence (1)

tensorrt_llm/commands/serve.py:170

  • The help text still refers to a "cpp path" default, but the default has been changed to "pytorch". Please update the help string to reflect the new default backend.
              help="Set to 'pytorch' for pytorch path. Default is cpp path.")

@kaiyux kaiyux force-pushed the user/pengyunl/pyt_default_serve branch from 190c79a to a7a51b5 Compare July 9, 2025 15:20
@kaiyux
Copy link
Member

kaiyux commented Jul 9, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #11456 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #11456 [ run ] completed with state FAILURE
/LLM/main/L0_MergeRequest_PR pipeline #8475 completed with status: 'FAILURE'

@kaiyux
Copy link
Member

kaiyux commented Jul 10, 2025

@LinPoly Please take care of this PR and make sure it gets merged on time, thanks!

@LinPoly
Copy link
Collaborator Author

LinPoly commented Jul 10, 2025

Will run again after some code format fix, the CI failure seems irrelevant since it is not about trtllm-serve

@LinPoly LinPoly force-pushed the user/pengyunl/pyt_default_serve branch from a7a51b5 to 59f4d41 Compare July 10, 2025 07:11
@LinPoly
Copy link
Collaborator Author

LinPoly commented Jul 10, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #11521 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #11521 [ run ] completed with state FAILURE
/LLM/main/L0_MergeRequest_PR pipeline #8525 completed with status: 'FAILURE'

@LinPoly
Copy link
Collaborator Author

LinPoly commented Jul 10, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #11550 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

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

@LinPoly LinPoly force-pushed the user/pengyunl/pyt_default_serve branch 2 times, most recently from 7698199 to a09e526 Compare July 14, 2025 07:14
@LinPoly
Copy link
Collaborator Author

LinPoly commented Jul 14, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #11778 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

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

LinPoly added 4 commits July 21, 2025 07:00
Signed-off-by: Pengyun Lin <[email protected]>
Signed-off-by: Pengyun Lin <[email protected]>
Signed-off-by: Pengyun Lin <[email protected]>
@LinPoly LinPoly force-pushed the user/pengyunl/pyt_default_serve branch from a09e526 to e5b5ed4 Compare July 21, 2025 07:03
@LinPoly
Copy link
Collaborator Author

LinPoly commented Jul 21, 2025

/bot run

Copy link
Contributor

coderabbitai bot commented Jul 21, 2025

Walkthrough

The changes update backend handling across CLI, configuration, and test code. The default backend is now explicitly set to "pytorch" instead of None, and support for the "trt" backend is added throughout. Configuration files and test fixtures are updated for consistency, and redundant installation steps are removed from some tests.

Changes

File(s) Change Summary
tensorrt_llm/commands/serve.py Default backend changed to "pytorch"; CLI now accepts "pytorch" or "trt" as backend choices.
tests/integration/defs/disaggregated/test_configs/*.yaml Added backend: "trt" to test configs for explicit backend specification.
tests/integration/defs/stress_test/stress_test.py Always passes backend to ModelConfig and server command, removing conditional logic.
tests/integration/defs/test_e2e.py Removed redundant example requirements installation from several test functions.
tests/unittest/llmapi/apps/_test_openai_chat.py
_test_openai_multi_gpu.py
_test_openai_reasoning.py
Refactored backend fixture to use ["trt", "pytorch"], updated argument construction for server fixture, and streamlined related logic.
tests/unittest/llmapi/apps/_test_openai_completions.py
_test_openai_misc.py
Updated backend parameter handling and argument construction for consistency and clarity.
tests/unittest/llmapi/apps/_test_openai_metrics.py Removed explicit backend argument from PyTorchLLM instantiation.
tests/unittest/llmapi/apps/_test_openai_multi_nodes.py Simplified always including backend argument in server fixture.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant Config
    participant Server

    User->>CLI: Run serve command (with or without --backend)
    CLI->>Config: Parse backend (default "pytorch" if not specified)
    Config->>Server: Start server with backend ("pytorch" or "trt")
    Server-->>User: Serve model using selected backend
Loading

Estimated code review effort

3 (90–240 minutes)

Suggested reviewers

  • nv-guomingz
  • omera-nv
  • Fridah-nv

Poem

In the meadow of code where the backends hop,
"pytorch" and "trt" now both take the top!
Configs are crisp, tests prance with delight,
No more redundant installs in the moonlight.
🐇 With a wiggle of ears, I cheer this new way—
Backend bunnies, you’ve made my day!


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 88076ee and e5b5ed4.

📒 Files selected for processing (13)
  • tensorrt_llm/commands/serve.py (2 hunks)
  • tests/integration/defs/disaggregated/test_configs/disagg_config_ctxtp2_gentp1_trt_backend.yaml (1 hunks)
  • tests/integration/defs/disaggregated/test_configs/disagg_config_gen_only_trt_backend.yaml (1 hunks)
  • tests/integration/defs/disaggregated/test_configs/disagg_config_trt_backend.yaml (1 hunks)
  • tests/integration/defs/stress_test/stress_test.py (2 hunks)
  • tests/integration/defs/test_e2e.py (0 hunks)
  • tests/unittest/llmapi/apps/_test_openai_chat.py (2 hunks)
  • tests/unittest/llmapi/apps/_test_openai_completions.py (2 hunks)
  • tests/unittest/llmapi/apps/_test_openai_metrics.py (0 hunks)
  • tests/unittest/llmapi/apps/_test_openai_misc.py (2 hunks)
  • tests/unittest/llmapi/apps/_test_openai_multi_gpu.py (3 hunks)
  • tests/unittest/llmapi/apps/_test_openai_multi_nodes.py (1 hunks)
  • tests/unittest/llmapi/apps/_test_openai_reasoning.py (4 hunks)
💤 Files with no reviewable changes (2)
  • tests/unittest/llmapi/apps/_test_openai_metrics.py
  • tests/integration/defs/test_e2e.py
🧰 Additional context used
🧬 Code Graph Analysis (6)
tests/unittest/llmapi/apps/_test_openai_multi_nodes.py (5)
tests/unittest/llmapi/apps/_test_openai_chat.py (1)
  • backend (24-25)
tests/unittest/llmapi/apps/_test_openai_completions.py (1)
  • backend (18-19)
tests/unittest/llmapi/apps/_test_openai_misc.py (1)
  • backend (19-20)
tests/unittest/llmapi/apps/_test_openai_multi_gpu.py (1)
  • backend (19-20)
tests/unittest/llmapi/apps/_test_openai_reasoning.py (1)
  • backend (18-19)
tests/unittest/llmapi/apps/_test_openai_completions.py (5)
tests/unittest/llmapi/apps/_test_openai_chat.py (1)
  • backend (24-25)
tests/unittest/llmapi/apps/_test_openai_misc.py (1)
  • backend (19-20)
tests/unittest/llmapi/apps/_test_openai_multi_gpu.py (1)
  • backend (19-20)
tests/unittest/llmapi/apps/_test_openai_multi_nodes.py (1)
  • backend (33-34)
tests/unittest/llmapi/apps/_test_openai_reasoning.py (1)
  • backend (18-19)
tests/unittest/llmapi/apps/_test_openai_misc.py (5)
tests/unittest/llmapi/apps/_test_openai_chat.py (1)
  • backend (24-25)
tests/unittest/llmapi/apps/_test_openai_completions.py (1)
  • backend (18-19)
tests/unittest/llmapi/apps/_test_openai_multi_gpu.py (1)
  • backend (19-20)
tests/unittest/llmapi/apps/_test_openai_multi_nodes.py (1)
  • backend (33-34)
tests/unittest/llmapi/apps/_test_openai_reasoning.py (1)
  • backend (18-19)
tests/unittest/llmapi/apps/_test_openai_chat.py (5)
tests/unittest/llmapi/apps/_test_openai_completions.py (1)
  • backend (18-19)
tests/unittest/llmapi/apps/_test_openai_misc.py (1)
  • backend (19-20)
tests/unittest/llmapi/apps/_test_openai_multi_gpu.py (1)
  • backend (19-20)
tests/unittest/llmapi/apps/_test_openai_multi_nodes.py (1)
  • backend (33-34)
tests/unittest/llmapi/apps/_test_openai_reasoning.py (1)
  • backend (18-19)
tests/unittest/llmapi/apps/_test_openai_multi_gpu.py (1)
tests/unittest/llmapi/apps/_test_openai_chat.py (3)
  • backend (24-25)
  • extra_llm_api_options (38-39)
  • temp_extra_llm_api_options_file (43-61)
tests/unittest/llmapi/apps/_test_openai_reasoning.py (5)
tests/unittest/llmapi/apps/_test_openai_chat.py (4)
  • backend (24-25)
  • server (65-76)
  • model_name (19-20)
  • async_client (85-86)
tests/unittest/llmapi/apps/_test_openai_completions.py (4)
  • backend (18-19)
  • server (30-37)
  • model_name (13-14)
  • async_client (46-47)
tests/unittest/llmapi/apps/_test_openai_multi_gpu.py (4)
  • backend (19-20)
  • server (53-61)
  • model_name (14-15)
  • async_client (70-71)
tests/unittest/llmapi/apps/_test_openai_multi_nodes.py (4)
  • backend (33-34)
  • server (45-66)
  • model_name (28-29)
  • async_client (75-76)
tests/integration/defs/stress_test/stress_test.py (2)
  • model_name (97-99)
  • get_model_path (287-289)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Pre-commit Check
🔇 Additional comments (19)
tests/integration/defs/disaggregated/test_configs/disagg_config_trt_backend.yaml (1)

5-5: LGTM: Explicit backend specification aligns with PR objectives.

The addition of backend: "trt" provides clear, explicit backend specification for this test configuration, which aligns with the PR's goal of standardizing backend handling.

tests/integration/defs/disaggregated/test_configs/disagg_config_gen_only_trt_backend.yaml (1)

4-4: LGTM: Consistent backend specification.

The explicit backend: "trt" specification is consistent with other configuration files in this PR and properly standardizes the backend setting.

tests/integration/defs/disaggregated/test_configs/disagg_config_ctxtp2_gentp1_trt_backend.yaml (1)

5-5: LGTM: Maintains consistency across configuration files.

The backend specification follows the same pattern as other configuration files in this PR, ensuring consistent backend handling across different test scenarios.

tests/unittest/llmapi/apps/_test_openai_multi_nodes.py (1)

50-61: LGTM: Simplified argument construction with improved readability.

The refactoring to always include the --backend argument simplifies the logic and removes conditional complexity. The multi-line formatting of the args list significantly improves readability.

tests/unittest/llmapi/apps/_test_openai_completions.py (1)

32-35: LGTM: Clean argument construction with appropriate backend-specific handling.

The refactored argument construction is cleaner and more explicit. The conditional addition of --max_beam_width for the TRT backend is appropriate, as beam search capabilities may be backend-specific.

tests/integration/defs/stress_test/stress_test.py (2)

371-371: LGTM! Backend parameter handling is now more explicit.

The change removes the conditional conversion of "trt" backend to None, making the backend parameter handling more straightforward and consistent with the updated backend support.


544-546: Improved consistency in server command construction.

The backend argument is now always included in the server command, eliminating conditional logic and making the command construction more predictable and easier to debug.

tensorrt_llm/commands/serve.py (2)

74-74: Breaking change: Default backend switched to PyTorch.

This change explicitly sets the default backend to "pytorch" instead of None, which aligns with the PR objectives. This is a breaking change that users should be aware of.


168-170: CLI backend option expanded to support explicit backend choices.

The backend option now explicitly supports "pytorch" and "trt" choices with "pytorch" as the default. This improves clarity and makes the backend selection more explicit for users.

tests/unittest/llmapi/apps/_test_openai_chat.py (2)

23-23: Backend fixture updated to use explicit backend strings.

The change from None to "trt" aligns with the new explicit backend handling throughout the codebase, improving clarity and consistency.


68-70: Simplified and more explicit server argument construction.

The server fixture now always includes the --backend argument explicitly, with conditional logic for TRT-specific options like --max_beam_width. This improves consistency and makes the test setup more predictable.

tests/unittest/llmapi/apps/_test_openai_misc.py (2)

18-18: Backend fixture standardized with explicit string parameters.

Consistent with other test files, the backend fixture now uses explicit "trt" and "pytorch" strings with uniform double quotes, improving consistency across the test suite.


37-43: Server fixture argument construction simplified and streamlined.

The argument list construction is now more concise and explicit, with the --backend argument always included upfront and subsequent arguments added using extend() calls. This improves readability and maintainability.

tests/unittest/llmapi/apps/_test_openai_multi_gpu.py (3)

18-18: Backend fixture updated for explicit backend specification.

Consistent with other test files in the suite, the backend fixture now uses explicit "trt" and "pytorch" strings, removing the previous use of None and improving test clarity.


56-59: Server fixture argument construction improved for consistency.

The argument list now always includes the --backend parameter explicitly, and the construction using extend() for additional options is more readable and maintainable.


93-93: String literal consistency improved.

The assertion now uses double quotes consistently with the rest of the codebase, improving stylistic uniformity.

tests/unittest/llmapi/apps/_test_openai_reasoning.py (3)

23-25: LGTM! Clean simplification of backend argument handling.

The unconditional inclusion of the --backend argument simplifies the fixture logic and aligns with the consistent pattern adopted across other test files.


67-68: LGTM! Improved naming and correct type annotation.

The rename from oning_client to async_client fixes what appears to be a typo and provides a clearer, more descriptive name. The type annotation change to openai.AsyncOpenAI is also correct for an async client.


89-90: LGTM! Consistent async client usage and simplified function signature.

The function signature is now cleaner with the properly named async_client parameter, and the removal of the backend parameter suggests that streaming functionality works consistently across both backend types, which simplifies the test logic.

Also applies to: 92-92, 105-105

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@tensorrt-cicd
Copy link
Collaborator

PR_Github #12423 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #12423 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #9239 completed with status: 'SUCCESS'

@LinPoly LinPoly merged commit 9832bef into NVIDIA:main Jul 21, 2025
3 checks passed
timlee0212 pushed a commit to timlee0212/TensorRT-LLM that referenced this pull request Jul 21, 2025
NVShreyas pushed a commit to NVShreyas/TensorRT-LLM that referenced this pull request Jul 28, 2025
Ransiki pushed a commit to Ransiki/TensorRT-LLM that referenced this pull request Jul 29, 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.

5 participants