Skip to content

Updates tests for integer division deprecation#38621

Closed
mruberry wants to merge 2 commits intomasterfrom
integer_div_test_callsites
Closed

Updates tests for integer division deprecation#38621
mruberry wants to merge 2 commits intomasterfrom
integer_div_test_callsites

Conversation

@mruberry
Copy link
Copy Markdown
Collaborator

Updates our tests in preparation of integer division using torch.div and torch.addcdiv throwing a runtime error by avoiding integer division using torch.div. This creates a brief period where integer division using torch.div is untested, but that should be OK (since it will soon throw a runtime error).

These callsites were identified using #36897.

@mruberry mruberry added module: numpy Related to numpy support, and also numpy compatibility of our operators and removed module: numpy Related to numpy support, and also numpy compatibility of our operators labels May 17, 2020
@dr-ci
Copy link
Copy Markdown

dr-ci Bot commented May 17, 2020

💊 CI failures summary and remediations

As of commit b7d065c (more details on the Dr. CI page):


  • 4/4 failures possibly* introduced in this PR
    • 1/4 non-CircleCI failure(s)

🕵️ 3 new failures recognized by patterns

The following CI failures do not appear to be due to upstream breakages:

See CircleCI build pytorch_macos_10_13_py3_test (1/3)

Step: "Test" (full log | diagnosis details | 🔁 rerun)

May 19 12:12:05 AssertionError: False is not true : Tensors failed to compare as equal! Found 1 different element(s) (out of 9), with the greatest difference of 32768 (-32768 vs. 0) occuring at index 0.
May 19 12:12:05   File "/Users/distiller/workspace/miniconda3/lib/python3.7/site-packages/torch/testing/_internal/common_device_type.py", line 234, in instantiated_test 
May 19 12:12:05     result = test(self, device_arg, dtype) 
May 19 12:12:05   File "/Users/distiller/workspace/miniconda3/lib/python3.7/site-packages/torch/testing/_internal/common_device_type.py", line 501, in only_fn 
May 19 12:12:05     return fn(self, device, *args, **kwargs) 
May 19 12:12:05   File "test_torch.py", line 16632, in test_float_to_int_conversion_finite 
May 19 12:12:05     self._float_to_int_conversion_helper(vals, device, dtype) 
May 19 12:12:05   File "test_torch.py", line 16608, in _float_to_int_conversion_helper 
May 19 12:12:05     self.assertEqual(torch.from_numpy(a), t.cpu()) 
May 19 12:12:05   File "/Users/distiller/workspace/miniconda3/lib/python3.7/site-packages/torch/testing/_internal/common_utils.py", line 1083, in assertEqual 
May 19 12:12:05     self.assertTrue(result, msg=message) 
May 19 12:12:05 AssertionError: False is not true : Tensors failed to compare as equal! Found 1 different element(s) (out of 9), with the greatest difference of 32768 (-32768 vs. 0) occuring at index 0. 
May 19 12:12:05  
May 19 12:12:05 ---------------------------------------------------------------------- 
May 19 12:12:05 Ran 2305 tests in 118.089s 
May 19 12:12:05  
May 19 12:12:05 FAILED (failures=1, skipped=135) 
May 19 12:12:05  
May 19 12:12:05 Generating XML reports... 
May 19 12:12:05 Generated XML report: test-reports/python-unittest/TEST-TestTensorDeviceOpsCPU-20200519121007.xml 
May 19 12:12:05 Generated XML report: test-reports/python-unittest/TEST-TestTorch-20200519121007.xml 
May 19 12:12:05 Generated XML report: test-reports/python-unittest/TEST-TestTorchDeviceTypeCPU-20200519121007.xml 

See CircleCI build pytorch_linux_xenial_py3_6_gcc5_4_ge_config_simple_test (2/3)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

May 19 19:37:34 ERROR:sccache::server: Compilation failed: Output { status: ExitStatus(ExitStatus(256)), stdout: "", stderr: "/var/lib/jenkins/.cache/torch_extensions/test_compilation_error_formatting/main.cpp: In function \'int main()\':\n/var/lib/jenkins/.cache/torch_extensions/test_compilation_error_formatting/main.cpp:2:23: error: expected \';\' before \'}\' token\n int main() { return 0 }\n ^\n" }
May 19 19:37:34 Traceback (most recent call last): 
May 19 19:37:34   File "test/run_test.py", line 690, in <module> 
May 19 19:37:34     main() 
May 19 19:37:34   File "test/run_test.py", line 683, in main 
May 19 19:37:34     raise RuntimeError(message) 
May 19 19:37:34 RuntimeError: test_type_hints failed! 
May 19 19:37:34 + cleanup 
May 19 19:37:34 + retcode=1 
May 19 19:37:34 + set +x 
May 19 19:37:34 =================== sccache compilation log =================== 
May 19 19:37:34 ERROR:sccache::server: Compilation failed: Output { status: ExitStatus(ExitStatus(256)), stdout: "", stderr: "/var/lib/jenkins/.cache/torch_extensions/test_compilation_error_formatting/main.cpp: In function \'int main()\':\n/var/lib/jenkins/.cache/torch_extensions/test_compilation_error_formatting/main.cpp:2:23: error: expected \';\' before \'}\' token\n int main() { return 0 }\n                       ^\n" } 
May 19 19:37:34  
May 19 19:37:34 =========== If your build fails, please take a look at the log above for possible reasons =========== 
May 19 19:37:34 Compile requests                 64 
May 19 19:37:34 Compile requests executed        35 
May 19 19:37:34 Cache hits                       27 
May 19 19:37:34 Cache misses                      7 
May 19 19:37:34 Cache timeouts                    0 
May 19 19:37:34 Cache read errors                 0 
May 19 19:37:34 Forced recaches                   0 
May 19 19:37:34 Cache write errors                0 

See CircleCI build pytorch_linux_xenial_py3_6_gcc5_4_test (3/3)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

May 19 19:41:13 ERROR:sccache::server: Compilation failed: Output { status: ExitStatus(ExitStatus(256)), stdout: "", stderr: "/var/lib/jenkins/.cache/torch_extensions/test_compilation_error_formatting/main.cpp: In function \'int main()\':\n/var/lib/jenkins/.cache/torch_extensions/test_compilation_error_formatting/main.cpp:2:23: error: expected \';\' before \'}\' token\n int main() { return 0 }\n ^\n" }
May 19 19:41:13 Traceback (most recent call last): 
May 19 19:41:13   File "test/run_test.py", line 690, in <module> 
May 19 19:41:13     main() 
May 19 19:41:13   File "test/run_test.py", line 683, in main 
May 19 19:41:13     raise RuntimeError(message) 
May 19 19:41:13 RuntimeError: test_type_hints failed! 
May 19 19:41:13 + cleanup 
May 19 19:41:13 + retcode=1 
May 19 19:41:13 + set +x 
May 19 19:41:13 =================== sccache compilation log =================== 
May 19 19:41:13 ERROR:sccache::server: Compilation failed: Output { status: ExitStatus(ExitStatus(256)), stdout: "", stderr: "/var/lib/jenkins/.cache/torch_extensions/test_compilation_error_formatting/main.cpp: In function \'int main()\':\n/var/lib/jenkins/.cache/torch_extensions/test_compilation_error_formatting/main.cpp:2:23: error: expected \';\' before \'}\' token\n int main() { return 0 }\n                       ^\n" } 
May 19 19:41:13  
May 19 19:41:13 =========== If your build fails, please take a look at the log above for possible reasons =========== 
May 19 19:41:13 Compile requests                 64 
May 19 19:41:13 Compile requests executed        35 
May 19 19:41:13 Cache hits                       27 
May 19 19:41:13 Cache misses                      7 
May 19 19:41:13 Cache timeouts                    0 
May 19 19:41:13 Cache read errors                 0 
May 19 19:41:13 Forced recaches                   0 
May 19 19:41:13 Cache write errors                0 

1 failure confirmed as flaky and can be ignored:

  • pytorch_xla_linux_bionic_py3_6_clang9_build

ci.pytorch.org: 1 failed


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker.

See how this bot performed.

This comment has been revised 9 times.

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@mruberry mruberry requested a review from gchanan May 18, 2020 18:05
Comment thread test/test_type_promotion.py Outdated
self.assertRaises(RuntimeError, lambda: op(s1, d2.view(d2.numel())[0].item()))

def _run_all_tests_for_sparse_op(self, op_name, device):
def _run_all_tests_for_sparse_op(self, op_name, device, dtypes=None):
Copy link
Copy Markdown
Contributor

@gchanan gchanan May 19, 2020

Choose a reason for hiding this comment

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

nit: no default arguments in tests.

Comment thread test/test_torch.py
self.assertEqual(2 - torch.tensor(3), 2 - torch.tensor(3).to(devices[1])) # __rsub__
self.assertEqual(2 * torch.tensor(3), 2 * torch.tensor(3).to(devices[1])) # __rmul__
self.assertEqual(2 / torch.tensor(3), 2 / torch.tensor(3).to(devices[1])) # __rtruediv__
self.assertEqual(2 / torch.tensor(3.), 2 / torch.tensor(3.).to(devices[1])) # __rtruediv__
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.

for these that you changed from ints to floats, can you just check that there are places here that test floor_div on ints.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yep (see the line just below this one, for example).

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@mruberry merged this pull request in 6458457.

@jeffdaily
Copy link
Copy Markdown
Collaborator

@ezyang @mruberry This PR is breaking some ROCm CI tests. Looks like this PR changed a few tests in test_torch.py to use _float_types2 which added the bfloat16 when testing on ROCm.

@mruberry
Copy link
Copy Markdown
Collaborator Author

I see. That issue was probably concealed by other ROCm build failures. Would you submit a PR updating the types to not include bfloat16 on ROCm?

@jeffdaily
Copy link
Copy Markdown
Collaborator

@rohithkrn is working on a PR.

@mruberry
Copy link
Copy Markdown
Collaborator Author

Thank you, @jeffdaily! Sorry for the inconvenience.

@mruberry mruberry deleted the integer_div_test_callsites branch May 20, 2020 20:22
facebook-github-bot pushed a commit that referenced this pull request May 21, 2020
Summary:
This PR fixes the tolerance values for some of the bfloat16 div tests that were enabled on ROCm with incorrect tolerance values in the PR #38621

Also disabled(to unblock CI) `test_addcdiv*` for which the error is large when absolute values in the tensor are higher. This will have to be investigated further.

ezyang jeffdaily sunway513
Pull Request resolved: #38823

Differential Revision: D21686290

Pulled By: ezyang

fbshipit-source-id: 85472680e1886bdc7c227ed2656e0b4fd5328e46
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
Updates our tests in preparation of integer division using torch.div and torch.addcdiv throwing a runtime error by avoiding integer division using torch.div. This creates a brief period where integer division using torch.div is untested, but that should be OK (since it will soon throw a runtime error).

These callsites were identified using pytorch#36897.
Pull Request resolved: pytorch#38621

Differential Revision: D21612823

Pulled By: mruberry

fbshipit-source-id: 749c03a69feae02590b4395335163d9bf047e162
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
…8823)

Summary:
This PR fixes the tolerance values for some of the bfloat16 div tests that were enabled on ROCm with incorrect tolerance values in the PR pytorch#38621

Also disabled(to unblock CI) `test_addcdiv*` for which the error is large when absolute values in the tensor are higher. This will have to be investigated further.

ezyang jeffdaily sunway513
Pull Request resolved: pytorch#38823

Differential Revision: D21686290

Pulled By: ezyang

fbshipit-source-id: 85472680e1886bdc7c227ed2656e0b4fd5328e46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants