Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/185699
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 4f0e718 with merge base 3d10a8a ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
There was a problem hiding this comment.
Pull request overview
Refactors the binary ufunc test suite by separating CPU-only tests from device-template tests and updating OpInfo decorators to target the renamed device-template test class.
Changes:
- Split a set of CPU-only tests into a standalone parametrized
TestBinaryUfuncsclass. - Rename/retarget the device-template suite to
TestBinaryUfuncsDeviceand adjust instantiation accordingly. - Update
DecorateInfo(..., cls_name=...)entries in OpInfos to match the new device-template class name.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| test/test_binary_ufuncs.py | Splits CPU-only tests into a parametrized class, renames/adjusts device-template tests and instantiation settings. |
| torch/testing/_internal/common_methods_invocations.py | Updates OpInfo DecorateInfo class-name filters from TestBinaryUfuncs to TestBinaryUfuncsDevice. |
Comments suppressed due to low confidence (3)
test/test_binary_ufuncs.py:1842
- This test is still CUDA-specific (name/body variables like
cuda_out) and usestorch.complex128, which is not supported on all non-CPU backends (notably MPS). SinceTestBinaryUfuncsDeviceis now instantiated for additional device types, this test needs to be restricted again (or split) to avoid running on backends that can’t create complex128 tensors.
@dtypes(torch.complex64, torch.complex128)
def test_pow_cuda_complex_extremal_passing(self, device, dtype):
t = torch.tensor(complex(-1.0, float("inf")), dtype=dtype, device=device)
cuda_out = t.pow(2)
test/test_binary_ufuncs.py:1842
- This test is still CUDA-specific (name/body variables like
cuda_out) and usestorch.complex128, which is not supported on all non-CPU backends (notably MPS). SinceTestBinaryUfuncsDeviceis now instantiated for additional device types, this test needs to be restricted again (or split) to avoid running on backends that can’t create complex128 tensors.
@dtypes(torch.complex64, torch.complex128)
def test_pow_cuda_complex_extremal_passing(self, device, dtype):
t = torch.tensor(complex(-1.0, float("inf")), dtype=dtype, device=device)
cuda_out = t.pow(2)
test/test_binary_ufuncs.py:1842
- This test is still CUDA-specific (name/body variables like
cuda_out) and usestorch.complex128, which is not supported on all non-CPU backends (notably MPS). SinceTestBinaryUfuncsDeviceis now instantiated for additional device types, this test needs to be restricted again (or split) to avoid running on backends that can’t create complex128 tensors.
@dtypes(torch.complex64, torch.complex128)
def test_pow_cuda_complex_extremal_passing(self, device, dtype):
t = torch.tensor(complex(-1.0, float("inf")), dtype=dtype, device=device)
cuda_out = t.pow(2)
| instantiate_device_type_tests( | ||
| TestBinaryUfuncsDevice, globals(), allow_mps=True, allow_xpu=True, except_for="cpu" | ||
| ) |
There was a problem hiding this comment.
Actually good point here on the MPS backend.
There was a problem hiding this comment.
Sure. But if MPS doesn't support those dtypes indeed, why the CI didn't go red? 🤨 Just curious. Will remove it for now.
|
@pytorchbot merge |
Merge startedYour 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 |
In PR [1], the upstream file `test_binary_ufuncs.py` was refactored and the `TestBinaryUfuncs` class was renamed to `TestBinaryUfuncsDevice`. The previous name is still used for CPU only tests, but it is directly wrapped in `instantiate_parametrized_tests`, so when imported on XPU side, it was already overwritten to `None`. This commit updates the imported class name on XPU side. [1] pytorch/pytorch#185699
In PR [1], the upstream file `test_binary_ufuncs.py` was refactored and the `TestBinaryUfuncs` class was renamed to `TestBinaryUfuncsDevice`. The previous name is still used for CPU only tests, but it is directly wrapped in `instantiate_parametrized_tests`, so when imported on XPU side, it was already overwritten to `None`. This commit updates the imported class name on XPU side. [1] pytorch/pytorch#185699
In PR [1], the upstream file `test_binary_ufuncs.py` was refactored and the `TestBinaryUfuncs` class was renamed to `TestBinaryUfuncsDevice`. The previous name is still used for CPU only tests, but it is directly wrapped in `instantiate_parametrized_tests`, so when imported on XPU side, it was already overwritten to `None`. This commit updates the imported class name on XPU side. [1] pytorch/pytorch#185699
In PR [1], the upstream file `test_binary_ufuncs.py` was refactored and the `TestBinaryUfuncs` class was renamed to `TestBinaryUfuncsDevice`. The previous name is still used for CPU only tests, but it is directly wrapped in `instantiate_parametrized_tests`, so when imported on XPU side, it was already overwritten to `None`. This commit updates the imported class name on XPU side. [1] pytorch/pytorch#185699
Review feedback on pytorch#193412: device-generic test templates instantiated via instantiate_device_type_tests carry a Device suffix, as done for TestBinaryUfuncs -> TestBinaryUfuncsDevice in pytorch#185699. Renaming the class means renaming every OpInfo DecorateInfo cls_name that targets it, since DecorateInfo.is_active compares cls_name to the generic class name by exact string and a mismatch silently deactivates the decoration. test/test_maskedtensor.py also defines a class named TestOperators, so the three 'TestOperators' entries whose test_name is test_reduction_all belong to that class and are deliberately left untouched; every other entry keys off a functorch test name. The rename is not behaviour-preserving. common_utils seeds the RNG for each OpInfo sample with sha256(test_fn.__qualname__), and the qualname contains the class name, so renaming reshuffles the random inputs of all ~10k tests in the class. That is the root cause of the four CPU tests that flipped: cumprod and masked.prod test_jvpvjp drew samples that land just outside their tolerances (relative error 6.7e-05 vs 1.3e-06 allowed, and 3.4e-05 vs 1.3e-05 allowed), so both tolerances are widened, cumprod's for all devices rather than CUDA only. native_batch_norm and _native_batch_norm_legit test_jvp on CPU stopped failing and turned into unexpected successes; since whether they fail depends on which samples are drawn, the xfails become skips rather than being deleted. Authored with the assistance of Claude Code.
Review feedback on pytorch#193412: device-generic test templates instantiated via instantiate_device_type_tests carry a Device suffix, as done for TestBinaryUfuncs -> TestBinaryUfuncsDevice in pytorch#185699. Renaming the class means renaming every OpInfo DecorateInfo cls_name that targets it, since DecorateInfo.is_active compares cls_name to the generic class name by exact string and a mismatch silently deactivates the decoration. test/test_maskedtensor.py also defines a class named TestOperators, so the three 'TestOperators' entries whose test_name is test_reduction_all belong to that class and are deliberately left untouched; every other entry keys off a functorch test name. The rename is not behaviour-preserving. common_utils seeds the RNG for each OpInfo sample with sha256(test_fn.__qualname__), and the qualname contains the class name, so renaming reshuffles the random inputs of all ~10k tests in the class. That is the root cause of the four CPU tests that flipped: cumprod and masked.prod test_jvpvjp drew samples that land just outside their tolerances (relative error 6.7e-05 vs 1.3e-06 allowed, and 3.4e-05 vs 1.3e-05 allowed), so both tolerances are widened, cumprod's for all devices rather than CUDA only. native_batch_norm and _native_batch_norm_legit test_jvp on CPU stopped failing and turned into unexpected successes; since whether they fail depends on which samples are drawn, the xfails become skips rather than being deleted. Authored with the assistance of Claude Code.
Review feedback on pytorch#193412: device-generic test templates instantiated via instantiate_device_type_tests carry a Device suffix, as done for TestBinaryUfuncs -> TestBinaryUfuncsDevice in pytorch#185699. Renaming the class means renaming every OpInfo DecorateInfo cls_name that targets it, since DecorateInfo.is_active compares cls_name to the generic class name by exact string and a mismatch silently deactivates the decoration. test/test_maskedtensor.py also defines a class named TestOperators, so the three 'TestOperators' entries whose test_name is test_reduction_all belong to that class and are deliberately left untouched; every other entry keys off a functorch test name. The rename is not behaviour-preserving. common_utils seeds the RNG for each OpInfo sample with sha256(test_fn.__qualname__), and the qualname contains the class name, so renaming reshuffles the random inputs of all ~10k tests in the class. That is the root cause of the four CPU tests that flipped: cumprod and masked.prod test_jvpvjp drew samples that land just outside their tolerances (relative error 6.7e-05 vs 1.3e-06 allowed, and 3.4e-05 vs 1.3e-05 allowed), so both tolerances are widened, cumprod's for all devices rather than CUDA only. native_batch_norm and _native_batch_norm_legit test_jvp on CPU stopped failing and turned into unexpected successes; since whether they fail depends on which samples are drawn, the xfails become skips rather than being deleted. Authored with the assistance of Claude Code.
Review feedback on pytorch#193412: device-generic test templates instantiated via instantiate_device_type_tests carry a Device suffix, as done for TestBinaryUfuncs -> TestBinaryUfuncsDevice in pytorch#185699. Renaming the class means renaming every OpInfo DecorateInfo cls_name that targets it, since DecorateInfo.is_active compares cls_name to the generic class name by exact string and a mismatch silently deactivates the decoration. test/test_maskedtensor.py also defines a class named TestOperators, so the three 'TestOperators' entries whose test_name is test_reduction_all belong to that class and are deliberately left untouched; every other entry keys off a functorch test name. The rename is not behaviour-preserving. common_utils seeds the RNG for each OpInfo sample with sha256(test_fn.__qualname__), and the qualname contains the class name, so renaming reshuffles the random inputs of all ~10k tests in the class. That is the root cause of the four CPU tests that flipped: cumprod and masked.prod test_jvpvjp drew samples that land just outside their tolerances (relative error 6.7e-05 vs 1.3e-06 allowed, and 3.4e-05 vs 1.3e-05 allowed), so both tolerances are widened, cumprod's for all devices rather than CUDA only. native_batch_norm and _native_batch_norm_legit test_jvp on CPU stopped failing and turned into unexpected successes; since whether they fail depends on which samples are drawn, the xfails become skips rather than being deleted. Authored with the assistance of Claude Code.
Review feedback on pytorch#193412: device-generic test templates instantiated via instantiate_device_type_tests carry a Device suffix, as done for TestBinaryUfuncs -> TestBinaryUfuncsDevice in pytorch#185699. Renaming the class means renaming every OpInfo DecorateInfo cls_name that targets it, since DecorateInfo.is_active compares cls_name to the generic class name by exact string and a mismatch silently deactivates the decoration. test/test_maskedtensor.py also defines a class named TestOperators, so the three 'TestOperators' entries whose test_name is test_reduction_all belong to that class and are deliberately left untouched; every other entry keys off a functorch test name. The rename is not behaviour-preserving. common_utils seeds the RNG for each OpInfo sample with sha256(test_fn.__qualname__), and the qualname contains the class name, so renaming reshuffles the random inputs of all ~10k tests in the class. That is the root cause of the four CPU tests that flipped: cumprod and masked.prod test_jvpvjp drew samples that land just outside their tolerances (relative error 6.7e-05 vs 1.3e-06 allowed, and 3.4e-05 vs 1.3e-05 allowed), so both tolerances are widened, cumprod's for all devices rather than CUDA only. native_batch_norm and _native_batch_norm_legit test_jvp on CPU stopped failing and turned into unexpected successes; since whether they fail depends on which samples are drawn, the xfails become skips rather than being deleted. Authored with the assistance of Claude Code.
Review feedback on pytorch#193412: templates instantiated via instantiate_device_type_tests carry a Device suffix, as TestBinaryUfuncs did in pytorch#185699. Every OpInfo DecorateInfo cls_name targeting the class has to be renamed with it, since DecorateInfo.is_active compares cls_name by exact string and a mismatch silently deactivates the decoration. The three entries whose test_name is test_reduction_all belong to test_maskedtensor.py's own TestOperators and are left alone. The rename is not behaviour-preserving: common_utils seeds each OpInfo sample from sha256(test_fn.__qualname__), so the inputs of all ~10k tests in the class are reshuffled. Four CPU tests flipped. cumprod and masked.prod test_jvpvjp now land just outside their tolerances (6.7e-05 vs 1.3e-06 allowed, 3.4e-05 vs 1.3e-05), so both are widened. native_batch_norm and _native_batch_norm_legit test_jvp stopped failing, so their xfails are dropped rather than turned into skips; the reshuffled samples sit at abs 3.8e-06 against a 1e-05 atol, down from 2.1e-05. Authored with the assistance of Claude Code.
Review feedback on pytorch#193412: templates instantiated via instantiate_device_type_tests carry a Device suffix, as TestBinaryUfuncs did in pytorch#185699. Every OpInfo DecorateInfo cls_name targeting the class has to be renamed with it, since DecorateInfo.is_active compares cls_name by exact string and a mismatch silently deactivates the decoration. The three entries whose test_name is test_reduction_all belong to test_maskedtensor.py's own TestOperators and are left alone. The rename is not behaviour-preserving: common_utils seeds each OpInfo sample from sha256(test_fn.__qualname__), so the inputs of all ~10k tests in the class are reshuffled. Four CPU tests flipped. cumprod and masked.prod test_jvpvjp now land just outside their tolerances (6.7e-05 vs 1.3e-06 allowed, 3.4e-05 vs 1.3e-05), so both are widened. native_batch_norm and _native_batch_norm_legit test_jvp stopped failing, so their xfails are dropped rather than turned into skips; the reshuffled samples sit at abs 3.8e-06 against a 1e-05 atol, down from 2.1e-05. Authored with the assistance of Claude Code.
Review feedback on pytorch#193412: templates instantiated via instantiate_device_type_tests carry a Device suffix, as TestBinaryUfuncs did in pytorch#185699. Every OpInfo DecorateInfo cls_name targeting the class has to be renamed with it, since DecorateInfo.is_active compares cls_name by exact string and a mismatch silently deactivates the decoration. The three entries whose test_name is test_reduction_all belong to test_maskedtensor.py's own TestOperators and are left alone. The rename is not behaviour-preserving: common_utils seeds each OpInfo sample from sha256(test_fn.__qualname__), so the inputs of all ~10k tests in the class are reshuffled. Four CPU tests flipped. cumprod and masked.prod test_jvpvjp now land just outside their tolerances (6.7e-05 vs 1.3e-06 allowed, 3.4e-05 vs 1.3e-05), so both are widened. native_batch_norm and _native_batch_norm_legit test_jvp stopped failing, so their xfails are dropped rather than turned into skips; the reshuffled samples sit at abs 3.8e-06 against a 1e-05 atol, down from 2.1e-05. Authored with the assistance of Claude Code.
In PR [1], the upstream file `test_binary_ufuncs.py` was refactored and the `TestBinaryUfuncs` class was renamed to `TestBinaryUfuncsDevice`. The previous name is still used for CPU only tests, but it is directly wrapped in `instantiate_parametrized_tests`, so when imported on XPU side, it was already overwritten to `None`. This commit updates the imported class name on XPU side. [1] pytorch/pytorch#185699
Review feedback on pytorch#193412: templates instantiated via instantiate_device_type_tests carry a Device suffix, as TestBinaryUfuncs did in pytorch#185699. Every OpInfo DecorateInfo that targets the class, and the .ci/pytorch/test.sh comment that counts the shared ones, is renamed with it, since DecorateInfo.is_active compares cls_name by exact string and a mismatch silently deactivates the decoration. The three entries whose test_name is test_reduction_all belong to test_maskedtensor.py's own TestOperators and are left alone. The rename is not behaviour-preserving: common_utils seeds each OpInfo sample from sha256(test_fn.__qualname__), so the inputs of all ~10k tests in the class are reshuffled. Four CPU tests flipped. cumprod and masked.prod test_jvpvjp now land just outside their tolerances (6.7e-05 vs 1.3e-06 allowed, 3.4e-05 vs 1.3e-05), so both are widened. native_batch_norm and _native_batch_norm_legit test_jvp stopped failing, so their xfails are dropped rather than turned into skips; the reshuffled samples sit at abs 3.8e-06 against a 1e-05 atol, down from 2.1e-05. Authored with the assistance of Claude Code. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Stack from ghstack (oldest at bottom):
cc @mruberry