Repository navigation
Conversation
PR Status: Approved 🚀Please fix all CI failures and trigger merge by commenting "@pytorchbot merge". ✅ AUTOMATED REVIEW - Ready for human review:
Findings (1): Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/195575
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (2 Unrelated Failures)As of commit 340dfaf with merge base fc695b3 ( NEW FAILURES SUPPRESSED BY AI (non-blocking) - The following job failed, but the AI CI Advisor judged the failure not to be evidence against this change:
BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
|
HardwareClassification to test_cutedsl_smoketest.py and extract device-generic test case to test_dlpack.pyHardwareClassification to test_cutedsl_smoketest.py and copy device-generalized tests to test_dlpack.py
| @skipIfTorchDynamo( | ||
| "ReadOnlyTensorWrapper is eager-only; __dlpack__ unsupported in dynamo" | ||
| ) | ||
| def test_read_only_wrapper_export_preserves_cow(self, device): |
There was a problem hiding this comment.
Does this move from some where? doesn't see the corresponding removement.
There was a problem hiding this comment.
The cuda-specific test file test_cutedsl_smoketest.py has only one test that doesn't depend on cuda-specific CuteDSL and can be made generic. It is test_readonly_wrapper_bare_capsule_is_valid test function. To mark the whole test class as HardwareClassification.CUDA I created generalized copy of this test and added to the test_dlpack.py not to loose the features test coverage for non-cuda devices. The original test case is left unchanged in the cuda-specific test/python_native/test_cutedsl_smoketest.py.
So this test_read_only_wrapper_export_preserves_cow test function is basically test_readonly_wrapper_bare_capsule_is_valid from test_cutedsl_smoketest.py, but generalized and copied to generic test file with releveant scope to launch it on other devices, including XPU.
I was considering just marking this test_cutedsl_smoketest.py test file as not applicable for refactor as all cuda-specific, but this one test function is what I found potential test coverage gap for other devices if left untouched.
What do you suggest and recommend to do?
There was a problem hiding this comment.
Suggest to remove the original test case, so reviewers can aware the change.
There was a problem hiding this comment.
Done! I removed test case test_readonly_wrapper_bare_capsule_is_valid from test_cutedsl_smoketest.py into test_dlpack.py and generalized. I had also to adjust comments and descriptions.
0be565a to
e413b5e
Compare
| # NOTE: The non-tvm-ffi (bare PyCapsule) path is intentionally NOT exercised | ||
| # against cuteDSL here. cuteDSL's DLTensorWrapper mis-parses the *versioned* | ||
| # DLPack struct (DLManagedTensorVersioned) and crashes | ||
| # ("LLVM ERROR: SmallVector unable to grow" / segfault) on a garbage size, | ||
| # which would take down the whole test process. This is independent of the | ||
| # read-only flag: a versioned-but-writable capsule (read_only=False) crashes | ||
| # identically, while an unversioned capsule is consumed fine. read_only | ||
| # requires the versioned protocol, so the bare path is unusable for cuteDSL | ||
| # until cuteDSL fixes its versioned-struct parsing. The capsule itself is | ||
| # valid (numpy and torch consume the versioned read-only capsule correctly; | ||
| # see test_dlpack.py). The tvm-ffi path avoids this entirely by going | ||
| # through the C exchange API rather than parsing a capsule. |
There was a problem hiding this comment.
This comment is rather class-wise, not specific for the below test case. Moved it up to the whole test class description.
| # through the C exchange API rather than parsing a capsule. | ||
| @unittest.skipIf(not SM80OrLater, "SM80+ required") | ||
| def test_readonly_wrapper_bare_capsule_is_valid(self): | ||
| # Verify the wrapper's bare (non-tvm-ffi) capsule is a well-formed, |
There was a problem hiding this comment.
Moved to test_dlpack.py and made generic.
HardwareClassification to test_cutedsl_smoketest.py and copy device-generalized tests to test_dlpack.pyHardwareClassification to test_cutedsl_smoketest.py and move device-generalized tests to test_dlpack.py
| is consumed fine. read_only requires the versioned protocol, so the bare | ||
| path is unusable for cuteDSL until cuteDSL fixes its versioned-struct | ||
| parsing. The capsule itself is valid; see, in test_dlpack.py, | ||
| TestTorchDlPack.test_read_only_wrapper_export_preserves_cow (torch consumes |
There was a problem hiding this comment.
Should be test_readonly_wrapper_bare_capsule_is_valid.
There was a problem hiding this comment.
Of course! Thanks for catching that! I aligned the function name, but forgot to change the comment. Fix is commited.
e413b5e to
51c8aa7
Compare
|
@pytorchbot rebase |
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
|
Successfully rebased |
51c8aa7 to
3679e84
Compare
|
@pytorchbot rebase |
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Signed-off-by: Benedykt Bela <[email protected]>
Signed-off-by: Benedykt Bela <[email protected]>
Signed-off-by: Benedykt Bela <[email protected]>
|
Successfully rebased |
907dd32 to
340dfaf
Compare
There was a problem hiding this comment.
Automated review of 340dfaf: nothing blocking; ready for human review.
Test-only PR: it moves the bare-capsule ReadOnlyTensorWrapper COW test from the cuteDSL smoketest into test_dlpack.py as a device-generic test, and gives the cuteDSL classes the CUDA hw_classification. All imports, references and the HardwareClassification usage check out. The only issue is that the moved test kept device gates it no longer needs.
⚪ 1 non-blocking finding
Line 999 in 340dfaf
The onlyOn(["xpu","cuda"]) and skipCUDAIf(not SM80OrLater) gates came over from the cuteDSL kernel tests, but this test launches no kernel. The _lazy_clone -> from_dlpack(ReadOnlyTensorWrapper) path is device-independent (TestReadOnlyDLPack runs on CPU for that reason). As written it is skipped on CPU, MPS and pre-SM80 GPUs. Drop both gates and the SM80OrLater import.
This review is AI-generated and advisory. Each new automated review replaces the previous one.
|
Thanks! |
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 |
test/test_dlpack.py has one test class instantiated through instantiate_device_type_tests. The Device suffix marks it as the device-instantiated template, an established convention in the test suite: TestTypePromotionDevice in test/test_type_promotion.py (pytorch#190990), TestScatterGatherDevice, TestHOPDevice and others. Part of pytorch#142029. Renaming a test class changes every lookup key of the form f"{class_name}.{test_name}", so the three name-keyed mechanisms were swept first. No marker file under test/dynamo_expected_failures, test/dynamo_skips, test/compiled_autograd_skips, test/inductor_expected_failures or test/inductor_skips names a TestTorchDlPack class -- the TestDLPack markers there belong to test/torch_np -- the test-infra disabled-tests list has no DLPack entry, and nothing outside this file refers to the generated names. The one reference to the class itself, a docstring that pytorch#195575 added to test/python_native/test_cutedsl_smoketest.py, is updated here. A later commit reuses the bare name TestTorchDlPack for the tests that are not device-dependent, so the rename goes first to keep the two steps separately reviewable. Test Plan: ``` cd test python -m pytest test_dlpack.py -p no:randomly -v --tb=no -rs \ --junitxml=dlpack.xml ``` 331 tests, 240 passed / 89 skipped / 2 failed, unchanged from the parent commit. The per-test outcome map, keyed on the method name, is identical, and so is every skip reason; only the repro hint in the two failure messages names the new class. The run generates TestTorchDlPackDeviceCPU and TestTorchDlPackDeviceXPU. The name sweep above was three checks: a filename grep over the five marker directories, a lookup in the downloaded disabled-tests-condensed.json (230 entries, no DLPack match), and a repo-wide grep for TestTorchDlPack outside this file (one hit, that docstring). Measured on an Intel Data Center GPU Max 1550 box with two XPU devices and no CUDA or MPS device, so the cuda and mps bases are never generated here. The local torch build predates pytorch#178768, which the base contains, so test_copy_xpu and test_no_copy_xpu fail on both sides; CI builds include the fix. Authored with the help of an AI assistant (Claude Code). Co-Authored-By: Claude Opus 5 <[email protected]>
Review feedback on pytorch#195722: the eight tests in TestTorchDlPackDevice that were @OnlyOn(["xpu", "cuda"]) exercise the generic DLPack device contract, so they now use @onlyAccelerator and opt MPS out only where it actually fails, and the onlyOn import goes. One of them, test_readonly_wrapper_bare_capsule_is_valid, came in with pytorch#195575 after that review and follows the same rule. The class is already instantiated with allow_mps=True, and the macos-m1 default shard collects its MPS clones (test_copy_mps, test_no_copy_mps, ...), so this enables them there. Part of pytorch#142029. The two stream tests (test_dlpack_conversion_with_streams and test_dlpack_conversion_with_streams_narrow_precision) get @skipMPS. Their helper calls stream.synchronize(), and MPSGuardImpl does not override synchronizeStream, so the base DeviceGuardImplInterface raises "Backend doesn't support synchronizing streams." The float64/complex128 variants would also fail earlier in make_tensor, since the test has no dtypesIfMPS. test_numpy_cross_device_multi_gpu skips itself on MPS through deviceCountAtLeast(2). The remaining five are expected to pass on MPS from reading the code: test_copy, test_no_copy, test_needs_copy_error and test_numpy_cross_device_transfer through DLConvertor.cpp and torch/utils/dlpack.py, and test_readonly_wrapper_bare_capsule_is_valid because the MPS allocator hands out simple data pointers, so _lazy_clone can wrap the storage as copy-on-write, and the read-only export reads storage().data() without materializing it. That test is the first to run _lazy_clone on MPS. On CUDA and XPU nothing changes: onlyAccelerator only skips cpu and meta, and skipMPS is a no-op off MPS. Out-of-tree backends that instantiate the template, such as PrivateUse1 and HPU, pick these tests up as well. Test Plan: Per-test outcomes before and after, on an Intel Data Center GPU Max 1550 box with two XPU devices and no CUDA or MPS device: ``` cd test python -m pytest test_dlpack.py -p no:randomly -v --tb=no -rs \ --junitxml=dlpack.xml ``` 310 tests, 234 passed / 74 skipped / 2 failed, with an identical outcome map before and after. Only the skip reason of the 24 cpu instances changes, from "Only runs on ['xpu', 'cuda']" to "onlyAccelerator: doesn't run on CPU or meta devices". The two failures on both sides are test_copy_xpu and test_no_copy_xpu: the local torch build predates pytorch#178768, which the base contains; CI builds include the fix. The MPS predictions above were not run locally; the macos-m1 default shard is the first place they execute. Authored with the help of an AI assistant (Claude Code). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d move device-generalized tests to `test_dlpack.py` (pytorch#195575) ### Changes - Add `HardwareClassification` to all test classes in `test/python_native/test_cutedsl_smoketest.py`. - Add `CUDA` suffixes to cuda-specific test classes. - Move generalized version of cuda-specific test case `test_readonly_wrapper_bare_capsule_is_valid` from `test_cutedsl_smoketest.py` into device-generic test class in `test_dlpack.py`. The cuda-specific test file `test_cutedsl_smoketest.py` has only one test that doesn't depend on cuda-specific CuteDSL and can be made generic. It is `test_readonly_wrapper_bare_capsule_is_valid` test function. To mark the whole test class as `HardwareClassification.CUDA` I generalized it and moved it to the `test_dlpack.py` not to loose the features test coverage. Pull Request resolved: pytorch#195575 Approved by: https://github.com/pbielak, https://github.com/etaf, https://github.com/jansel
test/test_dlpack.py has one test class instantiated through instantiate_device_type_tests. The Device suffix marks it as the device-instantiated template, an established convention in the test suite: TestTypePromotionDevice in test/test_type_promotion.py (pytorch#190990), TestScatterGatherDevice, TestHOPDevice and others. Part of pytorch#142029. Renaming a test class changes every lookup key of the form f"{class_name}.{test_name}", so the three name-keyed mechanisms were swept first. No marker file under test/dynamo_expected_failures, test/dynamo_skips, test/compiled_autograd_skips, test/inductor_expected_failures or test/inductor_skips names a TestTorchDlPack class -- the TestDLPack markers there belong to test/torch_np -- the test-infra disabled-tests list has no DLPack entry, and nothing outside this file refers to the generated names. The one reference to the class itself, a docstring that pytorch#195575 added to test/python_native/test_cutedsl_smoketest.py, is updated here. A later commit reuses the bare name TestTorchDlPack for the tests that are not device-dependent, so the rename goes first to keep the two steps separately reviewable. Test Plan: ``` cd test python -m pytest test_dlpack.py -p no:randomly -v --tb=no -rs \ --junitxml=dlpack.xml ``` 331 tests, 240 passed / 89 skipped / 2 failed, unchanged from the parent commit. The per-test outcome map, keyed on the method name, is identical, and so is every skip reason; only the repro hint in the two failure messages names the new class. The run generates TestTorchDlPackDeviceCPU and TestTorchDlPackDeviceXPU. The name sweep above was three checks: a filename grep over the five marker directories, a lookup in the downloaded disabled-tests-condensed.json (230 entries, no DLPack match), and a repo-wide grep for TestTorchDlPack outside this file (one hit, that docstring). Measured on an Intel Data Center GPU Max 1550 box with two XPU devices and no CUDA or MPS device, so the cuda and mps bases are never generated here. The local torch build predates pytorch#178768, which the base contains, so test_copy_xpu and test_no_copy_xpu fail on both sides; CI builds include the fix. Authored with the help of an AI assistant (Claude Code). Co-Authored-By: Claude Opus 5 <[email protected]>
Review feedback on pytorch#195722: the eight tests in TestTorchDlPackDevice that were @OnlyOn(["xpu", "cuda"]) exercise the generic DLPack device contract, so they now use @onlyAccelerator and opt MPS out only where it actually fails, and the onlyOn import goes. One of them, test_readonly_wrapper_bare_capsule_is_valid, came in with pytorch#195575 after that review and follows the same rule. The class is already instantiated with allow_mps=True, and the macos-m1 default shard collects its MPS clones (test_copy_mps, test_no_copy_mps, ...), so this enables them there. Part of pytorch#142029. The two stream tests (test_dlpack_conversion_with_streams and test_dlpack_conversion_with_streams_narrow_precision) get @skipMPS. Their helper calls stream.synchronize(), and MPSGuardImpl does not override synchronizeStream, so the base DeviceGuardImplInterface raises "Backend doesn't support synchronizing streams." The float64/complex128 variants would also fail earlier in make_tensor, since the test has no dtypesIfMPS. test_numpy_cross_device_multi_gpu skips itself on MPS through deviceCountAtLeast(2). The remaining five are expected to pass on MPS from reading the code: test_copy, test_no_copy, test_needs_copy_error and test_numpy_cross_device_transfer through DLConvertor.cpp and torch/utils/dlpack.py, and test_readonly_wrapper_bare_capsule_is_valid because the MPS allocator hands out simple data pointers, so _lazy_clone can wrap the storage as copy-on-write, and the read-only export reads storage().data() without materializing it. That test is the first to run _lazy_clone on MPS. On CUDA and XPU nothing changes: onlyAccelerator only skips cpu and meta, and skipMPS is a no-op off MPS. Out-of-tree backends that instantiate the template, such as PrivateUse1 and HPU, pick these tests up as well. Test Plan: Per-test outcomes before and after, on an Intel Data Center GPU Max 1550 box with two XPU devices and no CUDA or MPS device: ``` cd test python -m pytest test_dlpack.py -p no:randomly -v --tb=no -rs \ --junitxml=dlpack.xml ``` 310 tests, 234 passed / 74 skipped / 2 failed, with an identical outcome map before and after. Only the skip reason of the 24 cpu instances changes, from "Only runs on ['xpu', 'cuda']" to "onlyAccelerator: doesn't run on CPU or meta devices". The two failures on both sides are test_copy_xpu and test_no_copy_xpu: the local torch build predates pytorch#178768, which the base contains; CI builds include the fix. The MPS predictions above were not run locally; the macos-m1 default shard is the first place they execute. Authored with the help of an AI assistant (Claude Code). Co-Authored-By: Claude Opus 5.5 <[email protected]>
test/test_dlpack.py has one test class instantiated through instantiate_device_type_tests. The Device suffix marks it as the device-instantiated template, an established convention in the test suite: TestTypePromotionDevice in test/test_type_promotion.py (pytorch#190990), TestScatterGatherDevice, TestHOPDevice and others. Part of pytorch#142029. Renaming a test class changes every lookup key of the form f"{class_name}.{test_name}", so the three name-keyed mechanisms were swept first. No marker file under test/dynamo_expected_failures, test/dynamo_skips, test/compiled_autograd_skips, test/inductor_expected_failures or test/inductor_skips names a TestTorchDlPack class -- the TestDLPack markers there belong to test/torch_np -- the test-infra disabled-tests list has no DLPack entry, and nothing outside this file refers to the generated names. The one reference to the class itself, a docstring that pytorch#195575 added to test/python_native/test_cutedsl_smoketest.py, is updated here. A later commit reuses the bare name TestTorchDlPack for the tests that are not device-dependent, so the rename goes first to keep the two steps separately reviewable. Test Plan: ``` cd test python -m pytest test_dlpack.py -p no:randomly -v --tb=no -rs \ --junitxml=dlpack.xml ``` 331 tests, 240 passed / 89 skipped / 2 failed, unchanged from the parent commit. The per-test outcome map, keyed on the method name, is identical, and so is every skip reason; only the repro hint in the two failure messages names the new class. The run generates TestTorchDlPackDeviceCPU and TestTorchDlPackDeviceXPU. The name sweep above was three checks: a filename grep over the five marker directories, a lookup in the downloaded disabled-tests-condensed.json (230 entries, no DLPack match), and a repo-wide grep for TestTorchDlPack outside this file (one hit, that docstring). Measured on an Intel Data Center GPU Max 1550 box with two XPU devices and no CUDA or MPS device, so the cuda and mps bases are never generated here. The local torch build predates pytorch#178768, which the base contains, so test_copy_xpu and test_no_copy_xpu fail on both sides; CI builds include the fix. Authored with the help of an AI assistant (Claude Code). Co-Authored-By: Claude Opus 5 <[email protected]>
Review feedback on pytorch#195722: the eight tests in TestTorchDlPackDevice that were @OnlyOn(["xpu", "cuda"]) exercise the generic DLPack device contract, so they now use @onlyAccelerator and opt MPS out only where it actually fails, and the onlyOn import goes. One of them, test_readonly_wrapper_bare_capsule_is_valid, came in with pytorch#195575 after that review and follows the same rule. The class is already instantiated with allow_mps=True, and the macos-m1 default shard collects its MPS clones (test_copy_mps, test_no_copy_mps, ...), so this enables them there. Part of pytorch#142029. The two stream tests (test_dlpack_conversion_with_streams and test_dlpack_conversion_with_streams_narrow_precision) get @skipMPS. Their helper calls stream.synchronize(), and MPSGuardImpl does not override synchronizeStream, so the base DeviceGuardImplInterface raises "Backend doesn't support synchronizing streams." The float64/complex128 variants would also fail earlier in make_tensor, since the test has no dtypesIfMPS. test_numpy_cross_device_multi_gpu skips itself on MPS through deviceCountAtLeast(2). The remaining five are expected to pass on MPS from reading the code: test_copy, test_no_copy, test_needs_copy_error and test_numpy_cross_device_transfer through DLConvertor.cpp and torch/utils/dlpack.py, and test_readonly_wrapper_bare_capsule_is_valid because the MPS allocator hands out simple data pointers, so _lazy_clone can wrap the storage as copy-on-write, and the read-only export reads storage().data() without materializing it. That test is the first to run _lazy_clone on MPS. On CUDA and XPU nothing changes: onlyAccelerator only skips cpu and meta, and skipMPS is a no-op off MPS. Out-of-tree backends that instantiate the template, such as PrivateUse1 and HPU, pick these tests up as well. Test Plan: Per-test outcomes before and after, on an Intel Data Center GPU Max 1550 box with two XPU devices and no CUDA or MPS device: ``` cd test python -m pytest test_dlpack.py -p no:randomly -v --tb=no -rs \ --junitxml=dlpack.xml ``` 310 tests, 234 passed / 74 skipped / 2 failed, with an identical outcome map before and after. Only the skip reason of the 24 cpu instances changes, from "Only runs on ['xpu', 'cuda']" to "onlyAccelerator: doesn't run on CPU or meta devices". The two failures on both sides are test_copy_xpu and test_no_copy_xpu: the local torch build predates pytorch#178768, which the base contains; CI builds include the fix. The MPS predictions above were not run locally; the macos-m1 default shard is the first place they execute. Authored with the help of an AI assistant (Claude Code). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review feedback on pytorch#195722: the eight tests in TestTorchDlPackDevice that were @OnlyOn(["xpu", "cuda"]) exercise the generic DLPack device contract, so they now use @onlyAccelerator and opt MPS out only where it actually fails, and the onlyOn import goes. One of them, test_readonly_wrapper_bare_capsule_is_valid, came in with pytorch#195575 after that review and follows the same rule. The class is already instantiated with allow_mps=True, and the macos-m1 default shard collects its MPS clones (test_copy_mps, test_no_copy_mps, ...), so this enables them there. Part of pytorch#142029. The same eight tests drop @skipMeta, which onlyAccelerator makes dead code because it already skips cpu and meta. The docstrings and comments of test_numpy_cross_device_transfer and test_numpy_cross_device_multi_gpu now say accelerator instead of CUDA/XPU and cuda:0/cuda:1. The two stream tests (test_dlpack_conversion_with_streams and test_dlpack_conversion_with_streams_narrow_precision) get @skipMPS. Their helper calls stream.synchronize(), and MPSGuardImpl does not override synchronizeStream, so the base DeviceGuardImplInterface raises "Backend doesn't support synchronizing streams." The float64/complex128 variants would also fail earlier in make_tensor, since the test has no dtypesIfMPS. test_numpy_cross_device_multi_gpu skips itself on MPS through deviceCountAtLeast(2). The remaining five are expected to pass on MPS from reading the code: test_copy, test_no_copy, test_needs_copy_error and test_numpy_cross_device_transfer through DLConvertor.cpp and torch/utils/dlpack.py, and test_readonly_wrapper_bare_capsule_is_valid because the MPS allocator hands out simple data pointers, so _lazy_clone can wrap the storage as copy-on-write, and the read-only export reads storage().data() without materializing it. That test is the first to run _lazy_clone on MPS. On CUDA and XPU nothing changes: onlyAccelerator only skips cpu and meta, and skipMPS is a no-op off MPS. Out-of-tree backends that instantiate the template, such as PrivateUse1 and HPU, pick these tests up as well. Test Plan: Per-test outcomes before and after, on an Intel Data Center GPU Max 1550 box with two XPU devices and no CUDA or MPS device: ``` cd test python -m pytest test_dlpack.py -p no:randomly -v --tb=no -rs \ --junitxml=dlpack.xml ``` 310 tests, 234 passed / 74 skipped / 2 failed, with an identical outcome map before and after. Only the skip reason of the 24 cpu instances changes, from "Only runs on ['xpu', 'cuda']" to "onlyAccelerator: doesn't run on CPU or meta devices". No meta instances are generated, so dropping @skipMeta changes no outcome. The two failures on both sides are test_copy_xpu and test_no_copy_xpu: the local torch build predates pytorch#178768, which the base contains; CI builds include the fix. The MPS predictions above were not run locally; the macos-m1 default shard is the first place they execute. Authored with the help of an AI assistant (Claude Code). Co-Authored-By: Claude Opus 5.5 <[email protected]>
test/test_dlpack.py has one test class instantiated through instantiate_device_type_tests. The Device suffix marks it as the device-instantiated template, an established convention in the test suite: TestTypePromotionDevice in test/test_type_promotion.py (pytorch#190990), TestScatterGatherDevice, TestHOPDevice and others. Part of pytorch#142029. Renaming a test class changes every lookup key of the form f"{class_name}.{test_name}", so the three name-keyed mechanisms were swept first. No marker file under test/dynamo_expected_failures, test/dynamo_skips, test/compiled_autograd_skips, test/inductor_expected_failures or test/inductor_skips names a TestTorchDlPack class -- the TestDLPack markers there belong to test/torch_np -- the test-infra disabled-tests list has no DLPack entry, and nothing outside this file refers to the generated names. The one reference to the class itself, a docstring that pytorch#195575 added to test/python_native/test_cutedsl_smoketest.py, is updated here. A later commit reuses the bare name TestTorchDlPack for the tests that are not device-dependent, so the rename goes first to keep the two steps separately reviewable. Test Plan: ``` cd test python -m pytest test_dlpack.py -p no:randomly -v --tb=no -rs \ --junitxml=dlpack.xml ``` 331 tests, 240 passed / 89 skipped / 2 failed, unchanged from the parent commit. The per-test outcome map, keyed on the method name, is identical, and so is every skip reason; only the repro hint in the two failure messages names the new class. The run generates TestTorchDlPackDeviceCPU and TestTorchDlPackDeviceXPU. The name sweep above was three checks: a filename grep over the five marker directories, a lookup in the downloaded disabled-tests-condensed.json (230 entries, no DLPack match), and a repo-wide grep for TestTorchDlPack outside this file (one hit, that docstring). Measured on an Intel Data Center GPU Max 1550 box with two XPU devices and no CUDA or MPS device, so the cuda and mps bases are never generated here. The local torch build predates pytorch#178768, which the base contains, so test_copy_xpu and test_no_copy_xpu fail on both sides; CI builds include the fix. Authored with the help of an AI assistant (Claude Code). Co-Authored-By: Claude Opus 5 <[email protected]>
Review feedback on pytorch#195722: the eight tests in TestTorchDlPackDevice that were @OnlyOn(["xpu", "cuda"]) exercise the generic DLPack device contract, so they now use @onlyAccelerator and opt MPS out only where it actually fails, and the onlyOn import goes. One of them, test_readonly_wrapper_bare_capsule_is_valid, came in with pytorch#195575 after that review and follows the same rule. The class is already instantiated with allow_mps=True, and the macos-m1 default shard collects its MPS clones (test_copy_mps, test_no_copy_mps, ...), so this enables them there. Part of pytorch#142029. The same eight tests drop @skipMeta, which onlyAccelerator makes dead code because it already skips cpu and meta. The docstrings and comments of test_numpy_cross_device_transfer and test_numpy_cross_device_multi_gpu now say accelerator instead of CUDA/XPU and cuda:0/cuda:1. The two stream tests (test_dlpack_conversion_with_streams and test_dlpack_conversion_with_streams_narrow_precision) get @skipMPS. Their helper calls stream.synchronize(), and MPSGuardImpl does not override synchronizeStream, so the base DeviceGuardImplInterface raises "Backend doesn't support synchronizing streams." The float64/complex128 variants would also fail earlier in make_tensor, since the test has no dtypesIfMPS. test_numpy_cross_device_multi_gpu skips itself on MPS through deviceCountAtLeast(2). The remaining five are expected to pass on MPS from reading the code: test_copy, test_no_copy, test_needs_copy_error and test_numpy_cross_device_transfer through DLConvertor.cpp and torch/utils/dlpack.py, and test_readonly_wrapper_bare_capsule_is_valid because the MPS allocator hands out simple data pointers, so _lazy_clone can wrap the storage as copy-on-write, and the read-only export reads storage().data() without materializing it. That test is the first to run _lazy_clone on MPS. On CUDA and XPU nothing changes: onlyAccelerator only skips cpu and meta, and skipMPS is a no-op off MPS. Out-of-tree backends that instantiate the template, such as PrivateUse1 and HPU, pick these tests up as well. Test Plan: Per-test outcomes before and after, on an Intel Data Center GPU Max 1550 box with two XPU devices and no CUDA or MPS device: ``` cd test python -m pytest test_dlpack.py -p no:randomly -v --tb=no -rs \ --junitxml=dlpack.xml ``` 310 tests, 234 passed / 74 skipped / 2 failed, with an identical outcome map before and after. Only the skip reason of the 24 cpu instances changes, from "Only runs on ['xpu', 'cuda']" to "onlyAccelerator: doesn't run on CPU or meta devices". No meta instances are generated, so dropping @skipMeta changes no outcome. The two failures on both sides are test_copy_xpu and test_no_copy_xpu: the local torch build predates pytorch#178768, which the base contains; CI builds include the fix. The MPS predictions above were not run locally; the macos-m1 default shard is the first place they execute. Authored with the help of an AI assistant (Claude Code). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changes
HardwareClassificationto all test classes intest/python_native/test_cutedsl_smoketest.py.CUDAsuffixes to cuda-specific test classes.test_readonly_wrapper_bare_capsule_is_validfromtest_cutedsl_smoketest.pyinto device-generic test class intest_dlpack.py.The cuda-specific test file
test_cutedsl_smoketest.pyhas only one test that doesn't depend on cuda-specific CuteDSL and can be made generic. It istest_readonly_wrapper_bare_capsule_is_validtest function. To mark the whole test class asHardwareClassification.CUDAI generalized it and moved it to thetest_dlpack.pynot to loose the features test coverage.