Repository navigation
Conversation
…stantiate_device_type_tests Move 8 device-agnostic multiprocessing tests into TestMultiprocessingDeviceType, enabling automatic coverage on CPU, CUDA, XPU, and OpenReg/PrivateUse1 backends. Merge 13 duplicated CPU/CUDA test methods into device-parametrized equivalents. Fix _test_autograd_sharing to derive device from tensor instead of hardcoding CUDA. Move static child-process methods to module level for better pickle safety.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/184737
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit a9895a2 with merge base 6cd007b ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@pytorchbot rebase |
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
|
Rebase failed due to Command Raised by https://github.com/pytorch/pytorch/actions/runs/26795047228 |
|
@pytorchbot fix-lint |
Generated by apply-lint bot, see https://github.com/pytorch/pytorch/actions/runs/26795720228
|
Successfully applied lint patches in https://github.com/pytorch/pytorch/actions/runs/26795720228. Please pull locally before pushing more changes. |
|
@claude review these changes |
|
Claude finished @jansel's task in 3m 55s —— View job Review of PR #184737
SummaryThis PR refactors Issues1. Duplicate tests after merge (Major)The merge with main ( This means these tests now run twice — once in The duplicated methods at lines 1045-1098 should be removed. 2. Unused imports (Minor)The merge also brought in imports that are only used by the duplicate tests:
If the duplicate tests are removed, 3.
|
jansel
left a comment
There was a problem hiding this comment.
address automated feedback from claude
Thanks for review @jansel , addressed them in latest push. PTAL:) |
|
@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 |
…zation` (#186630) Otherwise #184737 seems to expose a preexisting issue that causes `test_simple_sharing_cuda` to fail authored with codex Pull Request resolved: #186630 Approved by: https://github.com/ezyang
…187314) # Motivation When #184737 generalize `test_multiprocess.py`, it helps enable `TestMultiprocessingDeviceType` test on XPU. However, XPU doesn't support this test suite because lack of IPC support currently. So we would like to skip this test case and restore XPU CI to green. Fixes #186585 Code originates from #186793 Co-authored-by: @xuhancn Pull Request resolved: #187314 Approved by: https://github.com/EikanWang, https://github.com/atalman ghstack dependencies: #181233, #187137, #187232, #187306
…187416) Skip TestMultiprocessingDeviceType on XPU due to lack of IPC support (#187314) # Motivation When #184737 generalize `test_multiprocess.py`, it helps enable `TestMultiprocessingDeviceType` test on XPU. However, XPU doesn't support this test suite because lack of IPC support currently. So we would like to skip this test case and restore XPU CI to green. Fixes #186585 Code originates from #186793 Co-authored-by: @xuhancn Pull Request resolved: #187314 Approved by: https://github.com/EikanWang, https://github.com/atalman ghstack dependencies: #181233, #187137, #187232, #187306 (cherry picked from commit 4f26a57) Co-authored-by: Yu, Guangye <guangye.yu@intel.com>
…ackends (pytorch#184737) ## Summary Refactors `test/test_multiprocessing.py` to make device-agnostic tests run automatically on all available backends using `instantiate_device_type_tests`. Previously, device coverage was achieved by manually duplicating tests (e.g. `test_variable_sharing` + `test_cuda_variable_sharing`), which meant out-of-tree backends had no coverage. This PR: - Extracts a `_MultiprocessingTestMixin` with 4 shared helpers used by both test classes - Creates `TestMultiprocessingDeviceType` with 8 device-generic test methods that replace 13 previously duplicated CPU/CUDA methods - Fixes `_test_autograd_sharing` to derive device from `var.device` instead of hardcoding `"cuda" if var.is_cuda else "cpu"` - Moves 3 `@staticmethod` child-process targets to module level for better pickle safety with `mp.Process` All 13 CUDA-IPC-specific tests (events, IPC handles, `_share_cuda_()`, fork-poisoning, multi-GPU) remain unchanged in `TestMultiprocessing` with their original names and guards -- these use CUDA-only APIs with no accelerator-generic equivalent. ### Tests moved to `TestMultiprocessingDeviceType` | New method | Replaces | |---|---| | `test_simple_sharing` | `test_cuda_simple` | | `test_empty_tensor_sharing` | `test_empty_tensor_sharing` + `test_empty_tensor_sharing_cuda` | | `test_variable_sharing` | `test_variable_sharing` + `test_cuda_variable_sharing` | | `test_parameter_sharing` | `test_parameter_sharing` + `test_cuda_parameter_sharing` | | `test_integer_parameter_serialization` | `test_integer_parameter_serialization_cpu` + `_cuda` | | `test_leaf_variable_sharing` | `test_leaf_variable_sharing` (had internal device loop) | | `test_non_leaf_variable_sharing` | `test_non_leaf_variable_sharing` (had internal device loop) | | `test_is_shared_accelerator` | `test_is_shared_cuda` | ## Test plan - CI should generate `TestMultiprocessingDeviceTypeCPU` and `TestMultiprocessingDeviceTypeCUDA` classes (visible with `-v` flag) - All existing `TestMultiprocessing` tests pass unchanged - On machines with XPU or OpenReg, additional device variants run automatically - `python test/test_multiprocessing.py -v` to verify test discovery Pull Request resolved: pytorch#184737 Approved by: https://github.com/jansel Co-authored-by: PyTorch MergeBot <pytorchmergebot@users.noreply.github.com>
…zation` (pytorch#186630) Otherwise pytorch#184737 seems to expose a preexisting issue that causes `test_simple_sharing_cuda` to fail authored with codex Pull Request resolved: pytorch#186630 Approved by: https://github.com/ezyang
…ytorch#187314) # Motivation When pytorch#184737 generalize `test_multiprocess.py`, it helps enable `TestMultiprocessingDeviceType` test on XPU. However, XPU doesn't support this test suite because lack of IPC support currently. So we would like to skip this test case and restore XPU CI to green. Fixes pytorch#186585 Code originates from pytorch#186793 Co-authored-by: @xuhancn Pull Request resolved: pytorch#187314 Approved by: https://github.com/EikanWang, https://github.com/atalman ghstack dependencies: pytorch#181233, pytorch#187137, pytorch#187232, pytorch#187306
…ackends (pytorch#184737) ## Summary Refactors `test/test_multiprocessing.py` to make device-agnostic tests run automatically on all available backends using `instantiate_device_type_tests`. Previously, device coverage was achieved by manually duplicating tests (e.g. `test_variable_sharing` + `test_cuda_variable_sharing`), which meant out-of-tree backends had no coverage. This PR: - Extracts a `_MultiprocessingTestMixin` with 4 shared helpers used by both test classes - Creates `TestMultiprocessingDeviceType` with 8 device-generic test methods that replace 13 previously duplicated CPU/CUDA methods - Fixes `_test_autograd_sharing` to derive device from `var.device` instead of hardcoding `"cuda" if var.is_cuda else "cpu"` - Moves 3 `@staticmethod` child-process targets to module level for better pickle safety with `mp.Process` All 13 CUDA-IPC-specific tests (events, IPC handles, `_share_cuda_()`, fork-poisoning, multi-GPU) remain unchanged in `TestMultiprocessing` with their original names and guards -- these use CUDA-only APIs with no accelerator-generic equivalent. ### Tests moved to `TestMultiprocessingDeviceType` | New method | Replaces | |---|---| | `test_simple_sharing` | `test_cuda_simple` | | `test_empty_tensor_sharing` | `test_empty_tensor_sharing` + `test_empty_tensor_sharing_cuda` | | `test_variable_sharing` | `test_variable_sharing` + `test_cuda_variable_sharing` | | `test_parameter_sharing` | `test_parameter_sharing` + `test_cuda_parameter_sharing` | | `test_integer_parameter_serialization` | `test_integer_parameter_serialization_cpu` + `_cuda` | | `test_leaf_variable_sharing` | `test_leaf_variable_sharing` (had internal device loop) | | `test_non_leaf_variable_sharing` | `test_non_leaf_variable_sharing` (had internal device loop) | | `test_is_shared_accelerator` | `test_is_shared_cuda` | ## Test plan - CI should generate `TestMultiprocessingDeviceTypeCPU` and `TestMultiprocessingDeviceTypeCUDA` classes (visible with `-v` flag) - All existing `TestMultiprocessing` tests pass unchanged - On machines with XPU or OpenReg, additional device variants run automatically - `python test/test_multiprocessing.py -v` to verify test discovery Pull Request resolved: pytorch#184737 Approved by: https://github.com/jansel Co-authored-by: PyTorch MergeBot <pytorchmergebot@users.noreply.github.com>
…zation` (pytorch#186630) Otherwise pytorch#184737 seems to expose a preexisting issue that causes `test_simple_sharing_cuda` to fail authored with codex Pull Request resolved: pytorch#186630 Approved by: https://github.com/ezyang
…ytorch#187314) # Motivation When pytorch#184737 generalize `test_multiprocess.py`, it helps enable `TestMultiprocessingDeviceType` test on XPU. However, XPU doesn't support this test suite because lack of IPC support currently. So we would like to skip this test case and restore XPU CI to green. Fixes pytorch#186585 Code originates from pytorch#186793 Co-authored-by: @xuhancn Pull Request resolved: pytorch#187314 Approved by: https://github.com/EikanWang, https://github.com/atalman ghstack dependencies: pytorch#181233, pytorch#187137, pytorch#187232, pytorch#187306
Summary
Refactors
test/test_multiprocessing.pyto make device-agnostic tests run automatically on all available backends usinginstantiate_device_type_tests.Previously, device coverage was achieved by manually duplicating tests (e.g.
test_variable_sharing+test_cuda_variable_sharing), which meant out-of-tree backends had no coverage. This PR:_MultiprocessingTestMixinwith 4 shared helpers used by both test classesTestMultiprocessingDeviceTypewith 8 device-generic test methods that replace 13 previously duplicated CPU/CUDA methods_test_autograd_sharingto derive device fromvar.deviceinstead of hardcoding"cuda" if var.is_cuda else "cpu"@staticmethodchild-process targets to module level for better pickle safety withmp.ProcessAll 13 CUDA-IPC-specific tests (events, IPC handles,
_share_cuda_(), fork-poisoning, multi-GPU) remain unchanged inTestMultiprocessingwith their original names and guards -- these use CUDA-only APIs with no accelerator-generic equivalent.Tests moved to
TestMultiprocessingDeviceTypetest_simple_sharingtest_cuda_simpletest_empty_tensor_sharingtest_empty_tensor_sharing+test_empty_tensor_sharing_cudatest_variable_sharingtest_variable_sharing+test_cuda_variable_sharingtest_parameter_sharingtest_parameter_sharing+test_cuda_parameter_sharingtest_integer_parameter_serializationtest_integer_parameter_serialization_cpu+_cudatest_leaf_variable_sharingtest_leaf_variable_sharing(had internal device loop)test_non_leaf_variable_sharingtest_non_leaf_variable_sharing(had internal device loop)test_is_shared_acceleratortest_is_shared_cudaTest plan
TestMultiprocessingDeviceTypeCPUandTestMultiprocessingDeviceTypeCUDAclasses (visible with-vflag)TestMultiprocessingtests pass unchangedpython test/test_multiprocessing.py -vto verify test discoverycc: @fffrog @albanD @jbschlosser @mansiag05