[None][infra] "[TRTLLM-6960][fix] enable scaled_mm tests (#6936)" - #7059
Conversation
📝 WalkthroughWalkthroughAdd 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
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 unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
This reverts commit 2bb90ba. Signed-off-by: Iman Tabrizian <itabrizian@nvidia.com>
428d310 to
b03be4d
Compare
There was a problem hiding this comment.
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 tolerancesAn 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_closeand pass dtype-specific tolerances viaatol/rtolmaps 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.
📒 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
There was a problem hiding this comment.
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 conversionAn 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 assertionMirror 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.
📒 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 testThe 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
• Innerif getSMVersion() == 90: skipexcludes SM90 onlyResult: 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.
|
/bot run --disable-fail-fast |
|
PR_Github #15820 [ run ] triggered by Bot |
|
PR_Github #15820 [ run ] completed with state |
This reverts commit 2bb90ba.
Summary by CodeRabbit
Tests
Chores
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 thestage-listparameter 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.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip 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-pipelineReuse 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.