Skip to content

[Test] Add HardwareClassification to test_cutedsl_smoketest.py and move device-generalized tests to test_dlpack.py - #195575

Closed
BBBela wants to merge 3 commits into
pytorch:mainfrom
BBBela:bbela/port-cutedsl-smoketest
Closed

BBBela wants to merge 3 commits into
pytorch:mainfrom
BBBela:bbela/port-cutedsl-smoketest

Conversation

@BBBela

@BBBela BBBela commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

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.

@pytorch-bot

pytorch-bot Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

PR Status: Approved 🚀

Please fix all CI failures and trigger merge by commenting "@pytorchbot merge".

✅ AUTOMATED REVIEW - 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.

Findings (1):

[minor] test/test_dlpack.py:999
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.

Reviewed commit: 340dfaf

Review run

🔗 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 (image):

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:

  • xpu / linux-noble-xpu-n-py3.11 / test (default, 11, 12, linux.idc.xpu) (gh)
    test/inductor/test_torchinductor_dynamic_shapes.py::DynamicShapesGPUTests::test_mutate_realized_buffer_in_make_fx_graph_case_foreach_reads_sibling_target_dynamic_shapes_xpu

    AI verdict: AI verdict: not related

    The PR only touches test/python_native/test_cutedsl_smoketest.py and test/test_dlpack.py, and neither has anything to do with the failing inductor test. The same inductor test case (foreach_reads_sibling_target) was already failing consistently on trunk at 3f83700, before this PR's merge base.

    Full reasoning on HUD →

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.

@pytorch-bot

pytorch-bot Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Workflows were awaiting approval. CI has now been triggered for the ciflow labels on this PR.

@pbielak
pbielak requested a review from etaf September 1, 2026 13:07
@pbielak pbielak added ciflow/trunk Trigger trunk jobs on your pull request ci-no-td Do not run TD on this PR labels Sep 1, 2026
@BBBela BBBela changed the title [Test] Add HardwareClassification to test_cutedsl_smoketest.py and extract device-generic test case to test_dlpack.py [Test] Add HardwareClassification to test_cutedsl_smoketest.py and copy device-generalized tests to test_dlpack.py Sep 1, 2026
Comment thread test/test_dlpack.py Outdated
@skipIfTorchDynamo(
"ReadOnlyTensorWrapper is eager-only; __dlpack__ unsupported in dynamo"
)
def test_read_only_wrapper_export_preserves_cow(self, device):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does this move from some where? doesn't see the corresponding removement.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggest to remove the original test case, so reviewers can aware the change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@BBBela
BBBela requested a review from etaf September 4, 2026 09:13
@BBBela
BBBela force-pushed the bbela/port-cutedsl-smoketest branch 2 times, most recently from 0be565a to e413b5e Compare September 4, 2026 14:28
Comment on lines -887 to -898
# 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved to test_dlpack.py and made generic.

@BBBela BBBela changed the title [Test] Add HardwareClassification to test_cutedsl_smoketest.py and copy device-generalized tests to test_dlpack.py [Test] Add HardwareClassification to test_cutedsl_smoketest.py and move device-generalized tests to test_dlpack.py Sep 4, 2026
@chuanqi129 chuanqi129 added the ciflow/xpu Run XPU CI tasks label Sep 4, 2026
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should be test_readonly_wrapper_bare_capsule_is_valid.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Of course! Thanks for catching that! I aligned the function name, but forgot to change the comment. Fix is commited.

@BBBela
BBBela force-pushed the bbela/port-cutedsl-smoketest branch from e413b5e to 51c8aa7 Compare September 7, 2026 08:01
@pbielak
pbielak requested a review from jansel September 7, 2026 14:08
@BBBela
BBBela marked this pull request as ready for review September 14, 2026 16:06
@BBBela

BBBela commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchbot rebase

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Successfully rebased bbela/port-cutedsl-smoketest onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout bbela/port-cutedsl-smoketest && git pull --rebase)

@pytorchmergebot
pytorchmergebot force-pushed the bbela/port-cutedsl-smoketest branch from 51c8aa7 to 3679e84 Compare October 1, 2026 08:05
@BBBela

BBBela commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchbot rebase

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Successfully rebased bbela/port-cutedsl-smoketest onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout bbela/port-cutedsl-smoketest && git pull --rebase)

@pytorchmergebot
pytorchmergebot force-pushed the bbela/port-cutedsl-smoketest branch from 907dd32 to 340dfaf Compare October 5, 2026 08:43
@jansel jansel added the in progress PR is being worked on by the author, until the automated review accepts it label Oct 7, 2026
@github-actions github-actions Bot added ready for review Automated review passed, ready for a final review by a maintainer. and removed in progress PR is being worked on by the author, until the automated review accepts it labels Oct 7, 2026

@github-actions github-actions Bot left a comment

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.

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

@onlyOn(["xpu", "cuda"])

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.

@ZhaoqiongZ ZhaoqiongZ moved this to Aged Pending Review in PyTorch Intel Oct 8, 2026
@BBBela

BBBela commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks!
@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

tszulist-hbn added a commit to tszulist-hbn/pytorch that referenced this pull request Oct 8, 2026
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]>
tszulist-hbn added a commit to tszulist-hbn/pytorch that referenced this pull request Oct 8, 2026
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]>
cyyever pushed a commit to BakeLab/pytorch that referenced this pull request Oct 11, 2026
…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
pytorchmergebot pushed a commit to tszulist-hbn/pytorch that referenced this pull request Oct 15, 2026
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]>
pytorchmergebot pushed a commit to tszulist-hbn/pytorch that referenced this pull request Oct 15, 2026
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]>
pytorchmergebot pushed a commit to tszulist-hbn/pytorch that referenced this pull request Oct 16, 2026
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]>
pytorchmergebot pushed a commit to tszulist-hbn/pytorch that referenced this pull request Oct 16, 2026
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]>
tszulist-hbn added a commit to tszulist-hbn/pytorch that referenced this pull request Oct 26, 2026
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]>
pytorchmergebot pushed a commit to tszulist-hbn/pytorch that referenced this pull request Oct 26, 2026
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]>
pytorchmergebot pushed a commit to tszulist-hbn/pytorch that referenced this pull request Oct 26, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-no-td Do not run TD on this PR ciflow/b200 ciflow/trunk Trigger trunk jobs on your pull request ciflow/xpu Run XPU CI tasks Merged open source ready for review Automated review passed, ready for a final review by a maintainer. topic: not user facing topic category

Projects

Status: Aged Pending Review

Development

Successfully merging this pull request may close these issues.

7 participants