Skip to content

Conversation

xinhe-nv
Copy link
Collaborator

@xinhe-nv xinhe-nv commented Oct 21, 2025

Summary by CodeRabbit

  • Chores
    • Added automated whitespace formatting for test files to enforce consistent formatting standards.
    • Implemented a pre-commit hook to automatically check and normalize spacing in test lists.

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.

@xinhe-nv xinhe-nv changed the title [][] add precommit hook to remove redundant tab and white space [None][fix] add precommit hook to remove redundant tab and white space Oct 21, 2025
@xinhe-nv xinhe-nv changed the title [None][fix] add precommit hook to remove redundant tab and white space [None][chore] add precommit hook to remove redundant tab and white space Oct 21, 2025
@xinhe-nv xinhe-nv requested review from EmmaQiaoCh and QiJune October 22, 2025 01:34
@xinhe-nv xinhe-nv force-pushed the fix branch 2 times, most recently from 14b1e42 to 37f7d45 Compare October 22, 2025 06:40
@xinhe-nv xinhe-nv marked this pull request as ready for review October 22, 2025 06:40
@xinhe-nv xinhe-nv enabled auto-merge (squash) October 22, 2025 06:40
@xinhe-nv
Copy link
Collaborator Author

/bot run --skip-test

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 22, 2025

📝 Walkthrough

Walkthrough

Adds a pre-commit hook that runs a whitespace normalization script on test list text files. The script trims leading whitespace, converts tabs to spaces, and collapses consecutive spaces to single spaces across specified files.

Changes

Cohort / File(s) Change Summary
Pre-commit Configuration
.pre-commit-config.yaml
Added new local hook test_lists_format to run whitespace normalization on test_lists text files before DCO check
Whitespace Normalization Script
scripts/format_test_list.py
New Python script with normalize_whitespace() and main() functions; processes files to trim leading whitespace, replace tabs with spaces, collapse multiple spaces, and reports modifications with exit code
Test Lists
tests/integration/test_lists/waives.txt
Whitespace normalized per new formatting rules

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description is significantly incomplete. While the repository template is present with all section headings (Description, Test Coverage, PR Checklist), the critical sections "Description" and "Test Coverage" contain no substantive content—they only show the template comment placeholders. The PR Checklist box is marked as complete, but without a meaningful description explaining the issue, the solution, or what tests safeguard the changes, the PR lacks essential context for reviewers to understand the motivation and validation strategy for these infrastructure changes. Please add a brief explanation in the "Description" section detailing why this pre-commit hook is needed, what problem it solves, and how the format_test_list.py script works. Additionally, provide specific information in the "Test Coverage" section describing how the changes have been tested or validated, such as whether the pre-commit hook successfully runs, whether the whitespace normalization works as expected, and any manual or automated testing performed on the waives.txt file changes.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "[None][chore] add precommit hook to remove redundant tab and white space" follows the proper format specified in the repository template and accurately describes the main objective of the changeset. The title clearly summarizes the primary change: adding a pre-commit hook configuration that normalizes whitespace (removing tabs and multiple spaces) in test_lists text files, which is directly supported by the modifications to .pre-commit-config.yaml, the new scripts/format_test_list.py script, and the whitespace adjustments in the test file. The phrasing is concise and specific enough for a developer scanning history to understand the core purpose.
✨ 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 (2)
scripts/format_test_list.py (2)

8-22: Consider Google-style docstring format.

While the current docstring is functional, the coding guidelines recommend Google-style docstrings for better documentation consistency.

Example improvement:

 def normalize_whitespace(content: str) -> str:
-    """Remove leading whitespace, replace tabs and multiple spaces with single spaces."""
+    """Normalize whitespace in content.
+
+    Removes leading whitespace from each line, replaces tabs with single spaces,
+    and collapses multiple consecutive spaces to a single space.
+
+    Args:
+        content: The text content to normalize.
+
+    Returns:
+        The normalized text content with whitespace cleaned up.
+    """

As per coding guidelines.


25-44: Consider adding error handling for file operations.

While the current implementation works for the pre-commit use case, adding try-except blocks around file operations would make the script more robust and provide clearer error messages if file access fails.

Example:

for filename in args.filenames:
    try:
        with open(filename, 'r', encoding='utf-8') as f:
            original_contents = f.read()
    except (IOError, OSError) as e:
        print(f'Error reading {filename}: {e}', file=sys.stderr)
        retval = 1
        continue
    
    # ... rest of logic
📜 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 b04e512 and 37f7d45.

📒 Files selected for processing (3)
  • .pre-commit-config.yaml (1 hunks)
  • scripts/format_test_list.py (1 hunks)
  • tests/integration/test_lists/waives.txt (2 hunks)
🧰 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:

  • scripts/format_test_list.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:

  • scripts/format_test_list.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:

  • scripts/format_test_list.py
🧠 Learnings (3)
📚 Learning: 2025-09-17T02:48:52.732Z
Learnt from: tongyuantongyu
PR: NVIDIA/TensorRT-LLM#7781
File: tests/integration/test_lists/waives.txt:313-313
Timestamp: 2025-09-17T02:48:52.732Z
Learning: In TensorRT-LLM, `tests/integration/test_lists/waives.txt` is specifically for waiving/skipping tests, while other test list files like those in `test-db/` and `qa/` directories are for different test execution contexts (pre-merge, post-merge, QA tests). The same test appearing in both waives.txt and execution list files is intentional - the test is part of test suites but will be skipped due to the waiver.

Applied to files:

  • tests/integration/test_lists/waives.txt
📚 Learning: 2025-08-26T09:49:04.956Z
Learnt from: pengbowang-nv
PR: NVIDIA/TensorRT-LLM#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*").

Applied to files:

  • tests/integration/test_lists/waives.txt
📚 Learning: 2025-07-28T17:06:08.621Z
Learnt from: moraxu
PR: NVIDIA/TensorRT-LLM#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:

  • tests/integration/test_lists/waives.txt
⏰ 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 (2)
tests/integration/test_lists/waives.txt (1)

58-58: LGTM: Whitespace normalization applied correctly.

The whitespace changes on these lines are the expected result of the new formatting script. No logic or content changes detected.

Also applies to: 73-73

.pre-commit-config.yaml (1)

87-91: Script has executable permissions — no action required.

The verification confirms that ./scripts/format_test_list.py has executable permissions, which is correctly required for the pre-commit hook configuration.

@tensorrt-cicd
Copy link
Collaborator

PR_Github #22143 [ run ] triggered by Bot. Commit: 37f7d45

@xinhe-nv
Copy link
Collaborator Author

/bot run --skip-test

@tensorrt-cicd
Copy link
Collaborator

PR_Github #22149 [ run ] triggered by Bot. Commit: 37f7d45

@tensorrt-cicd
Copy link
Collaborator

PR_Github #22143 [ run ] completed with state ABORTED. Commit: 37f7d45
LLM/main/L0_MergeRequest_PR #16697 (Blue Ocean) completed with status: ABORTED

@xinhe-nv
Copy link
Collaborator Author

/bot run --skip-test

@tensorrt-cicd
Copy link
Collaborator

PR_Github #22153 [ run ] triggered by Bot. Commit: 3dac572

@tensorrt-cicd
Copy link
Collaborator

PR_Github #22149 [ run ] completed with state ABORTED. Commit: 37f7d45
LLM/main/L0_MergeRequest_PR #16702 (Blue Ocean) completed with status: ABORTED

@xinhe-nv xinhe-nv force-pushed the fix branch 2 times, most recently from dde43fd to ecb0b5c Compare October 22, 2025 09:38
@xinhe-nv
Copy link
Collaborator Author

/bot run --skip-test

@tensorrt-cicd
Copy link
Collaborator

PR_Github #22169 [ run ] triggered by Bot. Commit: ecb0b5c

@tensorrt-cicd
Copy link
Collaborator

PR_Github #22153 [ run ] completed with state ABORTED. Commit: 3dac572
LLM/main/L0_MergeRequest_PR #16705 (Blue Ocean) completed with status: ABORTED

@tensorrt-cicd
Copy link
Collaborator

PR_Github #22169 [ run ] completed with state SUCCESS. Commit: ecb0b5c
/LLM/main/L0_MergeRequest_PR pipeline #16717 (Partly Tested) completed with status: 'SUCCESS'

@xinhe-nv
Copy link
Collaborator Author

/bot reuse-pipeline

@tensorrt-cicd
Copy link
Collaborator

PR_Github #22182 [ reuse-pipeline ] triggered by Bot. Commit: ea1c13e

@tensorrt-cicd
Copy link
Collaborator

PR_Github #22182 [ reuse-pipeline ] completed with state SUCCESS. Commit: ea1c13e
Reusing PR_Github #22169 (Partly Tested) for commit ea1c13e

@xinhe-nv xinhe-nv merged commit b8b2c9e into NVIDIA:main Oct 22, 2025
5 checks passed
@xinhe-nv xinhe-nv deleted the fix branch October 22, 2025 13:23
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