Skip to content

[None][infra] "[TRTLLM-6960][fix] enable scaled_mm tests (#6936)" - #7059

Merged
Tabrizian merged 1 commit into
NVIDIA:mainfrom
Tabrizian:user/imant/unwaivetest5
Aug 20, 2025
Merged

[None][infra] "[TRTLLM-6960][fix] enable scaled_mm tests (#6936)"#7059
Tabrizian merged 1 commit into
NVIDIA:mainfrom
Tabrizian:user/imant/unwaivetest5

Conversation

@Tabrizian

@Tabrizian Tabrizian commented Aug 19, 2025

Copy link
Copy Markdown
Member

This reverts commit 2bb90ba.

Summary by CodeRabbit

  • Tests

    • Improved test stability on SM90 GPUs by conditionally skipping a known flaky case with an explanatory message and bug link.
    • Relaxed numerical tolerances in a matrix-multiplication test (increased absolute tolerance, relative tolerance unchanged) to reduce false failures.
  • Chores

    • No changes to public APIs or runtime behavior; updates are limited to test robustness.

Description

Test Coverage

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.

Details

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.

@Tabrizian
Tabrizian requested a review from dc3671 August 19, 2025 19:10
@coderabbitai

coderabbitai Bot commented Aug 19, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Add a conditional early skip for SM90 in a unit test and relax absolute tolerances in two assert_allclose checks; no public API or test-signature changes.

Changes

Cohort / File(s) Summary
Test skip and tolerance update
tests/unittest/_torch/thop/test_scaled_mm.py
Add early skip when getSMVersion() == 90 with message and bug URL; increase atol from 0.01 to 1 in the final assertion and in the SM90-specific Cutlass comparison; rtol unchanged; no signature changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • hlu1

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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 or @coderabbitai title anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@Tabrizian
Tabrizian requested review from Funatiq and hlu1 August 19, 2025 19:10
@Tabrizian Tabrizian changed the title Revert "[TRTLLM-6960][fix] enable scaled_mm tests (#6936)" [None][infra] "[TRTLLM-6960][fix] enable scaled_mm tests (#6936)" Aug 19, 2025
This reverts commit 2bb90ba.

Signed-off-by: Iman Tabrizian <itabrizian@nvidia.com>
@Tabrizian
Tabrizian force-pushed the user/imant/unwaivetest5 branch from 428d310 to b03be4d Compare August 19, 2025 19:12

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
tests/unittest/_torch/thop/test_scaled_mm.py (2)

41-45: Skip-on-SM90 contradicts the SM90-only decorator; effectively disables the test and leaves SM90-only checks unreachable

  • The module-level skipif gates this test to run only on SM90 (90 ≤ SM < 120). The new in-test skip then skips exactly on SM90, so the test never runs in the only architecture where it’s allowed. If full disable is intended as part of the revert, prefer making that explicit (single decorator) and removing now-unreachable SM90-only blocks below.
  • Minimal change to make the intent explicit without touching the decorator: skip for the same range the decorator allows. This makes the “always skip” intent clear and self-consistent.

Apply this minimal diff:

-    if getSMVersion() == 90:
+    if 90 <= getSMVersion() < 120:
         pytest.skip(
             "Skip test for sm90 because it's too flaky. https://nvbugspro.nvidia.com/bug/5441734"
         )

Optional cleanups (recommended):

  • Collapse to a single decorator: replace the current skipif with @pytest.mark.skip(reason="Temporarily disabled due to flakiness (nvbugs 5441734); revert of enabling tests") and delete the in-test skip above.
  • The SM90-only “cutlass” validation block at Lines 82-99 becomes dead code with this skip; consider removing it until the test is re-enabled.

I can send a follow-up patch that consolidates skips, removes dead code, and updates the reason text. Do you want me to proceed?


77-80: Loosening atol to 1 risks masking real regressions; prefer dtype-calibrated tolerances

An absolute tolerance of 1 is very permissive for these kernels and may hide accuracy issues. Consider setting tolerances by output dtype (and keeping rtol meaningful), for example:

-    np.testing.assert_allclose(ref.float().cpu(),
-                               output.float().cpu(),
-                               atol=1,
-                               rtol=0.01)
+    np.testing.assert_allclose(
+        ref.float().cpu(),
+        output.float().cpu(),
+        atol=(0.1 if output_dtype in (torch.float16, torch.bfloat16) else 0.01),
+        rtol=0.01,
+    )

Alternatively, switch to torch.testing.assert_close and pass dtype-specific tolerances via atol/rtol maps for cleaner intent.

Please confirm that the looser tolerance is justified by observed numeric drift rather than functional differences.

If you share a few failing deltas by dtype/shape, I can help tune per-dtype tolerances or switch to torch.testing for consistency.

📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0e30fe4 and 428d310.

📒 Files selected for processing (1)
  • tests/unittest/_torch/thop/test_scaled_mm.py (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

**/*.py: Python code must target Python 3.8+
Python indentation: 4 spaces, no tabs
Maintain module namespace in imports (from package.subpackage import foo; then use foo.SomeClass())
Python file names use snake_case
Python class names use PascalCase
Python functions/methods and local variables use snake_case; variables starting with a number get k_ prefix (e.g., k_99th_percentile)
Global variables use G_ prefixed UPPER_SNAKE_CASE (e.g., G_MY_GLOBAL)
Constants use UPPER_SNAKE_CASE in Python
Avoid shadowing variables from outer scopes in Python
Initialize all externally visible members of a Python class in init
Prefer docstrings for interfaces used outside a file; comments for local code
Use Google-style docstrings for classes and functions (Sphinx-parsable)
Document attributes/variables inline with short docstrings
Avoid reflection when simple alternatives exist (e.g., prefer explicit parameters over dict(**locals()))
In try/except, catch the narrowest exceptions possible
For duck-typing with try/except, keep try body minimal and put logic in else

Files:

  • tests/unittest/_torch/thop/test_scaled_mm.py
**/*.{cpp,cxx,cc,cu,h,hpp,hxx,hh,cuh,py}

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

Prepend NVIDIA copyright header (current year) to all source files

Files:

  • tests/unittest/_torch/thop/test_scaled_mm.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
tests/unittest/_torch/thop/test_scaled_mm.py (2)

79-80: atol=1 is very coarse; consider dtype-aware tolerances and explicit numpy conversion

An absolute tolerance of 1 risks masking regressions. Prefer tolerances by dtype and magnitude. Also, pass NumPy arrays explicitly to avoid relying on implicit torch->numpy conversion semantics.

Apply this localized change to make conversions explicit:

-    np.testing.assert_allclose(ref.float().cpu(),
-                               output.float().cpu(),
+    np.testing.assert_allclose(ref.float().cpu().numpy(),
+                               output.float().cpu().numpy(),
                                atol=1,
                                rtol=0.01)

Optionally, introduce dtype-aware tolerances (outside this hunk) and then use them here:

# Define near the top of the test, after output_dtype is known
atol_by_dtype = {torch.float16: 5e-2, torch.bfloat16: 5e-2, torch.float32: 1e-3}
rtol_by_dtype = {torch.float16: 1e-2, torch.bfloat16: 1e-2, torch.float32: 1e-4}
atol = atol_by_dtype.get(output_dtype, 5e-2)
rtol = rtol_by_dtype.get(output_dtype, 1e-2)

Then:

-    np.testing.assert_allclose(ref.float().cpu().numpy(),
-                               output.float().cpu().numpy(),
-                               atol=1,
-                               rtol=0.01)
+    np.testing.assert_allclose(ref.float().cpu().numpy(),
+                               output.float().cpu().numpy(),
+                               atol=atol,
+                               rtol=rtol)

95-96: Align cutlass comparison tolerances and conversions with the reference assertion

Mirror the same explicit conversions and dtype-aware tolerances here to avoid inconsistency and overly loose thresholds.

Apply this localized change:

-            np.testing.assert_allclose(ref.float().cpu(),
-                                       cutlass_output.float().cpu(),
-                                       atol=1,
-                                       rtol=0.01)
+            np.testing.assert_allclose(ref.float().cpu().numpy(),
+                                       cutlass_output.float().cpu().numpy(),
+                                       atol=atol,
+                                       rtol=rtol)

If specific shapes are known-bad (as noted in the TODO), consider marking those cases xfail instead of warning, to make test intent explicit:

pytest.xfail("Known CUTLASS accumulation issue on this shape; see internal bug 5441734")
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 428d310 and b03be4d.

📒 Files selected for processing (1)
  • tests/unittest/_torch/thop/test_scaled_mm.py (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

**/*.py: Python code must target Python 3.8+
Python indentation: 4 spaces, no tabs
Maintain module namespace in imports (from package.subpackage import foo; then use foo.SomeClass())
Python file names use snake_case
Python class names use PascalCase
Python functions/methods and local variables use snake_case; variables starting with a number get k_ prefix (e.g., k_99th_percentile)
Global variables use G_ prefixed UPPER_SNAKE_CASE (e.g., G_MY_GLOBAL)
Constants use UPPER_SNAKE_CASE in Python
Avoid shadowing variables from outer scopes in Python
Initialize all externally visible members of a Python class in init
Prefer docstrings for interfaces used outside a file; comments for local code
Use Google-style docstrings for classes and functions (Sphinx-parsable)
Document attributes/variables inline with short docstrings
Avoid reflection when simple alternatives exist (e.g., prefer explicit parameters over dict(**locals()))
In try/except, catch the narrowest exceptions possible
For duck-typing with try/except, keep try body minimal and put logic in else

Files:

  • tests/unittest/_torch/thop/test_scaled_mm.py
**/*.{cpp,cxx,cc,cu,h,hpp,hxx,hh,cuh,py}

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

Prepend NVIDIA copyright header (current year) to all source files

Files:

  • tests/unittest/_torch/thop/test_scaled_mm.py
⏰ 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 (1)
tests/unittest/_torch/thop/test_scaled_mm.py (1)

41-45: Skip logic is not permanently disabling this test

The combination of the decorator and the inner skip actually runs the test on SM91–SM119:

• Outer @skipif(getSMVersion() < 90 or getSMVersion() >= 120…) permits SM90–SM119
• Inner if getSMVersion() == 90: skip excludes SM90 only

Result: the test executes on SM versions 91 through 119. The original comment’s claim—that it never runs on any SM—is incorrect. If your goal is to skip only SM90 and run on future SMs, the current code already does that. Otherwise, adjust the decorator’s condition to match the intended supported SM range.

Likely an incorrect or invalid review comment.

@Tabrizian

Copy link
Copy Markdown
Member Author

/bot run --disable-fail-fast

@Tabrizian
Tabrizian enabled auto-merge (squash) August 19, 2025 20:03
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #15820 [ run ] triggered by Bot

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

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

@Tabrizian
Tabrizian merged commit e270884 into NVIDIA:main Aug 20, 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.

3 participants