Skip to content

[inductor] Loosen tolerance in test_interpolate_mutated_input_backward - #199663

Closed
aorenste wants to merge 1 commit into
gh/aorenste/421/basefrom
gh/aorenste/421/head
Closed

aorenste wants to merge 1 commit into
gh/aorenste/421/basefrom
gh/aorenste/421/head

Conversation

@aorenste

@aorenste aorenste commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

  • (to be filled)

The three test_interpolate_mutated_input_backward tests added in #185876 fail
consistently in the periodic nogpu_NO_AVX2 config:

AssertionError: Tensor-likes are not close!
Mismatched elements: 1 / 3 (33.3%)
Greatest absolute difference: 0.0005950927734375 at index (0, 0, 0) (up to 1e-05 allowed)
Greatest relative difference: 3.6538310723699396e-06 at index (0, 0, 0) (up to 1.3e-06 allowed)

This is float32 summation error, not a correctness bug. The mismatching tensor
is mean.grad, where each element is a sum of 256 float32 values (about 313 in
magnitude). Eager computes it with ATen's cascade_sum and is accurate to about
2e-8 relative. nogpu_NO_AVX2 sets ATEN_CPU_CAPABILITY=default, which Inductor
also uses to pick its vector ISA, so the compiled kernel is scalar. Inductor's
scalar reductions are a single running sum (its CascadeSumHelper is only used by
vectorized kernels, in 4096-element chunks), which is about 2e-6 relative off
here, just over assertEqual's default float32 rtol of 1.3e-6. Vectorized builds
keep one accumulator per lane and pass.

The fix compares with atol=1e-4 and rtol=1e-4, as the neighboring gradient tests
in this file do. The alternative, giving Inductor's scalar CPU reductions
cascade summation, would be a codegen change with performance cost and is out of
scope for a test failure.

Test Plan:

ATEN_CPU_CAPABILITY=default python -m pytest test/inductor/test_cpu_repro.py -k test_interpolate_mutated_input_backward
python -m pytest test/inductor/test_cpu_repro.py -k test_interpolate_mutated_input_backward

All three pass in both configurations; before the change they failed with
ATEN_CPU_CAPABILITY=default with the same numbers as CI. With #185876's
torch/ changes reverted, all three still fail with "one of the variables needed
for gradient computation has been modified by an inplace operation", so the
looser tolerance doesn't hide the bug the tests guard against.

This PR was authored with the help of an AI assistant.

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

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/199663

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (6 Unrelated Failures)

As of commit 5fe72c8 with merge base dd5cbc4 (image):

🟡 GREEN LIGHT - PR requires human review:

  • Never trivial: tolerances
    • _check_interpolate_mutated_input_backward in test/inductor/test_cpu_repro.py loosens assertEqual to atol=1e-4, rtol=1e-4 from float32 defaults
    • Numerics tolerance changes are on the never-trivial list, so a human should confirm the new bound
  • Test weakened with no source change
    • The diff touches only the test file; no torch/ change is behind the looser comparison
    • The tolerance applies to every output and every config, not just the scalar ATEN_CPU_CAPABILITY=default path the comment cites
  • No trivial class fits
    • Explained test changes covers skips, expected failures, and expected messages, not tolerance changes

reason: not_trivial
Reviewed commit: 5fe72c8

Inference job

🐛 Report a wrong verdict

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@aorenste
aorenste requested a review from jansel October 3, 2026 21:45
@aorenste aorenste added ciflow/periodic Trigger jobs ran periodically on master (periodic.yml) on the PR ciflow/trunk Trigger trunk jobs on your pull request labels Oct 3, 2026
@aorenste aorenste closed this Oct 4, 2026
@aorenste aorenste reopened this Oct 4, 2026
@aorenste

aorenste commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

cyyever pushed a commit to BakeLab/pytorch that referenced this pull request Oct 11, 2026
pytorch#199663)

The three test_interpolate_mutated_input_backward tests added in pytorch#185876 fail
consistently in the periodic nogpu_NO_AVX2 config:

```
AssertionError: Tensor-likes are not close!
Mismatched elements: 1 / 3 (33.3%)
Greatest absolute difference: 0.0005950927734375 at index (0, 0, 0) (up to 1e-05 allowed)
Greatest relative difference: 3.6538310723699396e-06 at index (0, 0, 0) (up to 1.3e-06 allowed)
```

This is float32 summation error, not a correctness bug. The mismatching tensor
is mean.grad, where each element is a sum of 256 float32 values (about 313 in
magnitude). Eager computes it with ATen's cascade_sum and is accurate to about
2e-8 relative. nogpu_NO_AVX2 sets ATEN_CPU_CAPABILITY=default, which Inductor
also uses to pick its vector ISA, so the compiled kernel is scalar. Inductor's
scalar reductions are a single running sum (its CascadeSumHelper is only used by
vectorized kernels, in 4096-element chunks), which is about 2e-6 relative off
here, just over assertEqual's default float32 rtol of 1.3e-6. Vectorized builds
keep one accumulator per lane and pass.

The fix compares with atol=1e-4 and rtol=1e-4, as the neighboring gradient tests
in this file do. The alternative, giving Inductor's scalar CPU reductions
cascade summation, would be a codegen change with performance cost and is out of
scope for a test failure.

Test Plan:

```
ATEN_CPU_CAPABILITY=default python -m pytest test/inductor/test_cpu_repro.py -k test_interpolate_mutated_input_backward
python -m pytest test/inductor/test_cpu_repro.py -k test_interpolate_mutated_input_backward
```

All three pass in both configurations; before the change they failed with
ATEN_CPU_CAPABILITY=default with the same numbers as CI. With pytorch#185876's
torch/ changes reverted, all three still fail with "one of the variables needed
for gradient computation has been modified by an inplace operation", so the
looser tolerance doesn't hide the bug the tests guard against.

This PR was authored with the help of an AI assistant.

Pull Request resolved: pytorch#199663
Approved by: https://github.com/jansel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/periodic Trigger jobs ran periodically on master (periodic.yml) on the PR ciflow/trunk Trigger trunk jobs on your pull request Merged module: inductor topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants