pytorch - ✅(Solved) Fix [inductor] Tolerances in test_remove_no_ops have to be lowered with native matmul [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
pytorch/pytorch#178317Fetched 2026-04-08 01:26:08
View on GitHub
Comments
0
Participants
1
Timeline
43
Reactions
0
Author
Participants
Timeline (top)
mentioned ×19subscribed ×19labeled ×5

PR fix notes

PR #173566: native_matmul: Updates test_remove_no_ops to use with native_matmul.

Description (problem / solution / changelog)

Stack from ghstack (oldest at bottom):

  • #173660
  • -> #173566

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo

Changed files

  • test/inductor/test_torchinductor.py (modified, +4/-2)
RAW_BUFFERClick to expand / collapse

When native_matmul is enabled with torch._inductor.config.native_matmul the tolerances in test_remove_no_ops must be lowered to get it to pass. The operations being performed shouldn't change the resulting tensors (e.g multiplying by identity).

Refer to this PR: https://github.com/pytorch/pytorch/pull/173566

cc @mruberry @chauhang @penguinwu @voznesenskym @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @aakhundov @coconutruben @jataylo

extent analysis

Fix Plan

The fix involves lowering the tolerances in the test_remove_no_ops test to account for the differences introduced by enabling native_matmul with torch._inductor.config.native_matmul.

Step-by-Step Solution

  • Identify the test file containing test_remove_no_ops and locate the assertions that check for tensor equality.
  • Lower the tolerances in these assertions by using the torch.testing.assert_close function with a smaller rtol and atol value.
  • Example code:
import torch

# Before
self.assertEqual(tensor1, tensor2)

# After
torch.testing.assert_close(tensor1, tensor2, rtol=1e-4, atol=1e-5)
  • Update the test to use the new tolerance values and verify that the test passes with native_matmul enabled.

Verification

  • Run the updated test with native_matmul enabled and verify that it passes.
  • Check that the resulting tensors are still correct and unchanged by the operations being performed.

Extra Tips

  • Be cautious when lowering tolerances, as it may mask other issues in the code.
  • Consider adding additional tests to verify the correctness of the operations being performed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

pytorch - ✅(Solved) Fix [inductor] Tolerances in test_remove_no_ops have to be lowered with native matmul [1 pull requests, 1 participants]