Skip to content

[Test] Change names of test class in test_type_promotion.py - #190990

Closed
KarhouTam wants to merge 2 commits into
gh/KarhouTam/17/basefrom
gh/KarhouTam/17/head
Closed

KarhouTam wants to merge 2 commits into
gh/KarhouTam/17/basefrom
gh/KarhouTam/17/head

Conversation

@KarhouTam

@KarhouTam KarhouTam commented Jul 24, 2026 •

Copy link
Copy Markdown
Collaborator

[ghstack-poisoned]
@KarhouTam
KarhouTam requested a review from mruberry as a code owner July 24, 2026 07:37
@pytorch-bot

pytorch-bot Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/190990

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit d0c5dd0 with merge base 2f86d10 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label Jul 24, 2026
@KarhouTam
KarhouTam requested a review from fffrog July 24, 2026 07:40
@KarhouTam KarhouTam added module: tests Issues related to tests (not the torch.testing module) module: tests/core This label covers all test cases within the Core and Tensor sheets. labels Jul 24, 2026

@fffrog fffrog left a comment

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.

SGTM, thank you for updates.

The previous discussion can be found here

@fffrog fffrog moved this to Ready for Review(Definitive) in PyTorch Test Refactoring Jul 24, 2026
@fffrog
fffrog requested review from albanD and jbschlosser July 24, 2026 07:44
[ghstack-poisoned]

@albanD albanD left a comment

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.

Thx

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #190991

2 similar comments
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #190991

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #190991

@github-project-automation github-project-automation Bot moved this from Ready for Review(Definitive) to Done in PyTorch Test Refactoring Jul 25, 2026
tszulist-hbn added a commit to tszulist-hbn/pytorch that referenced this pull request Aug 18, 2026
Review feedback on pytorch#192806, part of pytorch#142029. The 15 classes in
test/functorch/test_eager_transforms.py instantiated via
instantiate_device_type_tests now carry a Device suffix, matching
TestTypePromotionDevice (pytorch#190990). The three classes that are not
device-instantiated keep their names, so the suffix marks exactly the
device-instantiated set.

This also renames 52 markers in test/dynamo_expected_failures, whose
filenames are looked up as f"{class_name}.{test_name}"
(common_utils.py:3838). TestJacCPU becomes TestJacDeviceCPU, so without
the moves those tests stop being wrapped and turn red in the dynamo
shard, which does not run by default.

Test Plan:

    python -m pytest test/functorch/test_eager_transforms.py
    PYTORCH_TEST_WITH_DYNAMO=1 python -m pytest test/functorch/test_eager_transforms.py \
      -k "(TestJacDeviceCPU and test_inplace_cpu) or (TestFunctionalizeDeviceCPU and test_simple_view_cpu)"
    lintrunner test/functorch/test_eager_transforms.py

723 collected, 719 passed / 2 skipped / 2 xfailed, unchanged from before
the rename. The Dynamo run reports both tests skipped, which only happens
when the key resolves to a marker file.

This PR was authored with the assistance of Claude Code.

Co-Authored-By: Claude Opus 5 <[email protected]>
tszulist-hbn added a commit to tszulist-hbn/pytorch that referenced this pull request Aug 19, 2026
Review feedback on pytorch#192806, part of pytorch#142029. The 15 classes in
test/functorch/test_eager_transforms.py instantiated via
instantiate_device_type_tests now carry a Device suffix, matching
TestTypePromotionDevice (pytorch#190990). The three classes that are not
device-instantiated keep their names, so the suffix marks exactly the
device-instantiated set.

Renaming a test class changes every lookup key of the form
f"{class_name}.{test_name}", so three name-keyed mechanisms have to move
with it:

test/dynamo_expected_failures (52 markers, common_utils.py:3838).
TestJacCPU becomes TestJacDeviceCPU; without the moves those tests stop
being wrapped and turn red in the dynamo shard, which does not run by
default.

test/compiled_autograd_skips (2 markers, common_utils.py:3985). Missed in
the first version of this commit, which turned three dynamo_wrapped shards
red on TestExamplesCorrectnessDeviceCPU.test_maml_omniglot_mechanism_-
functional_call_cpu. With the marker orphaned, compiled autograd stayed
enabled for the test and it failed with "TypeError: add(): argument
'other' (position 2) must be Tensor, not NoneType" inside
compiled_autograd.runtime_wrapper.

The test-infra disabled-tests list, which lives outside this repo and so
cannot be renamed here. It disables test_jacfwd_different_levels_cpu under
TestHessianCPU (pytorch#192284, dynamo only), and the orphaned key un-disabled
the test on Python 3.14. Rather than depend on an out-of-repo retitle that
reviewers cannot see, the existing skipIf on that test now covers dynamo
unconditionally and names pytorch#192284. The alternative, retitling the issue,
was rejected because it silently breaks for anyone on an older commit and
leaves the same landmine for the next class rename. This over-skips
slightly on Python 3.14+, where the pre-existing failure is a real dynamo
bug tracked by that issue, not a regression from this change.

Test Plan:

    python -m pytest test/functorch/test_eager_transforms.py
    PYTORCH_TESTING_DEVICE_ONLY_FOR=cpu PYTORCH_TEST_WITH_DYNAMO=1 \
      python -m pytest test/functorch/test_eager_transforms.py -q -p no:xdist
    lintrunner test/functorch/test_eager_transforms.py

723 collected, 719 passed / 2 skipped / 2 xfailed, unchanged from before
the rename. The dynamo run is 334 passed / 43 skipped / 1 xfailed with no
failures; before the compiled_autograd_skips move it failed on
test_maml_omniglot_mechanism_functional_call_cpu.

All five marker directories were swept for the 15 renamed classes against
the base commit: dynamo_expected_failures 52/52 moved,
compiled_autograd_skips 2/2 moved, and dynamo_skips, inductor_expected_-
failures and inductor_skips hold no entries for these classes.

This PR was authored with the assistance of Claude Code.

Co-Authored-By: Claude Opus 5 <[email protected]>
@github-actions
github-actions Bot deleted the gh/KarhouTam/17/head branch August 25, 2026 02:06
pytorchmergebot pushed a commit to tszulist-hbn/pytorch that referenced this pull request Aug 26, 2026
Review feedback on pytorch#192806, part of pytorch#142029. The 15 classes in
test/functorch/test_eager_transforms.py instantiated via
instantiate_device_type_tests now carry a Device suffix, matching
TestTypePromotionDevice (pytorch#190990). The three classes that are not
device-instantiated keep their names, so the suffix marks exactly the
device-instantiated set.

Renaming a test class changes every lookup key of the form
f"{class_name}.{test_name}", so three name-keyed mechanisms have to move
with it:

test/dynamo_expected_failures (52 markers, common_utils.py:3838).
TestJacCPU becomes TestJacDeviceCPU; without the moves those tests stop
being wrapped and turn red in the dynamo shard, which does not run by
default.

test/compiled_autograd_skips (2 markers, common_utils.py:3985). Missed in
the first version of this commit, which turned three dynamo_wrapped shards
red on TestExamplesCorrectnessDeviceCPU.test_maml_omniglot_mechanism_-
functional_call_cpu. With the marker orphaned, compiled autograd stayed
enabled for the test and it failed with "TypeError: add(): argument
'other' (position 2) must be Tensor, not NoneType" inside
compiled_autograd.runtime_wrapper.

The test-infra disabled-tests list, which lives outside this repo and so
cannot be renamed here. It disables test_jacfwd_different_levels_cpu under
TestHessianCPU (pytorch#192284, dynamo only), and the orphaned key un-disabled
the test on Python 3.14. Rather than depend on an out-of-repo retitle that
reviewers cannot see, the existing skipIf on that test now covers dynamo
unconditionally and names pytorch#192284. The alternative, retitling the issue,
was rejected because it silently breaks for anyone on an older commit and
leaves the same landmine for the next class rename. This over-skips
slightly on Python 3.14+, where the pre-existing failure is a real dynamo
bug tracked by that issue, not a regression from this change.

Test Plan:

    python -m pytest test/functorch/test_eager_transforms.py
    PYTORCH_TESTING_DEVICE_ONLY_FOR=cpu PYTORCH_TEST_WITH_DYNAMO=1 \
      python -m pytest test/functorch/test_eager_transforms.py -q -p no:xdist
    lintrunner test/functorch/test_eager_transforms.py

723 collected, 719 passed / 2 skipped / 2 xfailed, unchanged from before
the rename. The dynamo run is 334 passed / 43 skipped / 1 xfailed with no
failures; before the compiled_autograd_skips move it failed on
test_maml_omniglot_mechanism_functional_call_cpu.

All five marker directories were swept for the 15 renamed classes against
the base commit: dynamo_expected_failures 52/52 moved,
compiled_autograd_skips 2/2 moved, and dynamo_skips, inductor_expected_-
failures and inductor_skips hold no entries for these classes.

This PR was authored with the assistance of Claude Code.

Co-Authored-By: Claude Opus 5 <[email protected]>
tszulist-hbn added a commit to tszulist-hbn/pytorch that referenced this pull request Sep 2, 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.

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:

```
python test/test_dlpack.py
python -m pytest test/test_dlpack.py -v --tb=no -p no:randomly
python -m pytest test/test_dlpack.py --collect-only -q -p no:randomly
```

327 tests, 237 passed / 90 skipped / 0 failed, unchanged from the parent
commit. The per-test outcome map, which is keyed on the method name, is
identical apart from two skip-reason strings that pytest truncates one
character earlier now that the class name is longer. Collection confirms the
generated classes are 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 (193
entries, no DLPack match), and a repo-wide grep for TestTorchDlPack outside
this file (no hits).

Measured on a single-Battlemage box with no CUDA and no MPS device, so the
cuda and mps bases are never generated here. pytorch#178768 was
applied locally, since test_copy on XPU depends on it.

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 Sep 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.

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:

```
python test/test_dlpack.py
python -m pytest test/test_dlpack.py -v --tb=no -p no:randomly
python -m pytest test/test_dlpack.py --collect-only -q -p no:randomly
```

327 tests, 237 passed / 90 skipped / 0 failed, unchanged from the parent
commit. The per-test outcome map, which is keyed on the method name, is
identical apart from two skip-reason strings that pytest truncates one
character earlier now that the class name is longer. Collection confirms the
generated classes are 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 (193
entries, no DLPack match), and a repo-wide grep for TestTorchDlPack outside
this file (no hits).

Measured on a single-Battlemage box with no CUDA and no MPS device, so the
cuda and mps bases are never generated here. pytorch#178768 was
applied locally, since test_copy on XPU depends on it.

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 Sep 25, 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.

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:

```
python test/test_dlpack.py
python -m pytest test/test_dlpack.py -v --tb=no -p no:randomly
python -m pytest test/test_dlpack.py --collect-only -q -p no:randomly
```

327 tests, 237 passed / 90 skipped / 0 failed, unchanged from the parent
commit. The per-test outcome map, which is keyed on the method name, is
identical apart from two skip-reason strings that pytest truncates one
character earlier now that the class name is longer. Collection confirms the
generated classes are 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 (193
entries, no DLPack match), and a repo-wide grep for TestTorchDlPack outside
this file (no hits).

Measured on a single-Battlemage box with no CUDA and no MPS device, so the
cuda and mps bases are never generated here. pytorch#178768 was
applied locally, since test_copy on XPU depends on it.

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 2, 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.

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:

```
python test/test_dlpack.py
python -m pytest test/test_dlpack.py -v --tb=no -p no:randomly
python -m pytest test/test_dlpack.py --collect-only -q -p no:randomly
```

327 tests, 237 passed / 90 skipped / 0 failed, unchanged from the parent
commit. The per-test outcome map, which is keyed on the method name, is
identical apart from two skip-reason strings that pytest truncates one
character earlier now that the class name is longer. Collection confirms the
generated classes are 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 (193
entries, no DLPack match), and a repo-wide grep for TestTorchDlPack outside
this file (no hits).

Measured on a single-Battlemage box with no CUDA and no MPS device, so the
cuda and mps bases are never generated here. pytorch#178768 was
applied locally, since test_copy on XPU depends on it.

Authored with the help of an AI assistant (Claude Code).

Co-Authored-By: Claude Opus 5 <[email protected]>
pytorchmergebot pushed a commit that referenced this pull request Oct 8, 2026
… XPU (#192806)

Part of #142029.

Makes `test/functorch/test_eager_transforms.py` run on Intel GPU (XPU) and classifies its test classes.

The file was already almost device-agnostic; two tests were pinned to a device for historical reasons, and one test-local `HigherOrderOperator` registered autograd per-backend rather than on the alias key. With those fixed, nothing in the file needs an XPU skip -- no `@skipIfXpu`, no tracked issues. Hence a stack rather than a one-line change to `only_for`:

- **Device-pinned tests made generic.** `test_unrelated_hessian` built `W` on `device` but `x` on CPU unconditionally, which `@onlyCPU` hid. `test_linearize_errors` hardcoded `torch.device("cuda")`; it now takes the injected device with `@onlyAccelerator`, keeping primals on CPU so the two devices still differ.
- **`mysum` registered on the `Autograd` alias key** instead of duplicating identical bodies on `AutogradCPU`/`AutogradCUDA`. The per-backend form made all 9 `TestHigherOrderOperatorInteraction` tests raise `NotImplementedError ... DispatchKey.AutogradXPU`; the alias key covers every backend, including out-of-tree `PrivateUse1`.
- **XPU enabled** via `"xpu"` in `only_for` plus `allow_xpu=True` on 15 instantiation calls. Both are required: `allow_xpu` gates whether `XPUTestBase` is a candidate, `only_for` then filters.
- **`TestGradTrackingTensorToList` is not device-instantiated** -- none of its four tests take a `device` parameter, so per review it has no `instantiate_device_type_tests` call and is GENERIC.
- **Device-instantiated classes carry a `Device` suffix**, matching `TestTypePromotionDevice` (#190990), so the name states whether a class is device-generic.
- **`hw_classification` on all 18 classes** -- 15 ACCELERATOR, 3 GENERIC (`TestSliceArgnums`, `TestMakeFunctional`, `TestGradTrackingTensorToList`).

## Name-keyed lookups moved with the rename

Renaming a class invalidates every lookup keyed on `f"{class_name}.{test_name}"`. Three mechanisms use that key; the first version of this stack only handled the first, turning three `dynamo_wrapped` shards red:

- `test/dynamo_expected_failures` -- 52 markers moved.
- `test/compiled_autograd_skips` -- 2 markers moved. Orphaning them left compiled autograd enabled for `test_maml_omniglot_mechanism_functional_call_cpu`, which then failed with `TypeError: add(): argument 'other' (position 2) must be Tensor, not NoneType`.
- The test-infra disabled-tests list, which cannot be renamed from this repo. It disables `test_jacfwd_different_levels_cpu (__main__.TestHessianCPU)` for dynamo via #192284; the orphaned key un-disabled it, failing on Python 3.14. That test's existing `skipIf` now covers dynamo unconditionally and names #192284, rather than relying on an out-of-repo retitle that reviewers cannot see.

Swept all five marker directories for the 15 renamed classes: `dynamo_skips`, `inductor_expected_failures` and `inductor_skips` hold no entries for them.

## Coverage delta

Full file on a single-XPU host, before vs. after the stack:

| | before | after |
|---|---|---|
| collected | 378 | 723 |
| passed | 376 | 719 |
| skipped | 1 | 2 |
| xfailed | 1 | 2 |

After: 345 CPU + 345 XPU + 33 non-device-parameterized. The non-XPU subset (378 tests) runs 376 passed, 1 skipped, 1 xfailed -- identical to the whole file before the stack, so CPU coverage is preserved exactly.

The new skip is `test_linearize_errors_cpu`, which `@onlyAccelerator` skips on CPU exactly as `@onlyCUDA` did before; the new xfail is the XPU variant of an existing CPU xfail. The widened `skipIf` on `test_jacfwd_different_levels` does not affect these numbers -- it only fires under `TEST_WITH_TORCHDYNAMO`.

The two selectors partition the file exactly, so every test is tagged once:

```
--hw-classification ACCELERATOR         -> total=723, passed=690, unclassified=0, mismatched=33
--hw-classification GENERIC             -> total=723, passed=33,  unclassified=0, mismatched=690
--hw-classification GENERIC ACCELERATOR -> total=723, passed=723, unclassified=0, mismatched=0
```
Pull Request resolved: #192806
Approved by: https://github.com/pbielak, https://github.com/etaf, https://github.com/jansel

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
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.

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:

```
python test/test_dlpack.py
python -m pytest test/test_dlpack.py -v --tb=no -p no:randomly
python -m pytest test/test_dlpack.py --collect-only -q -p no:randomly
```

327 tests, 237 passed / 90 skipped / 0 failed, unchanged from the parent
commit. The per-test outcome map, which is keyed on the method name, is
identical apart from two skip-reason strings that pytest truncates one
character earlier now that the class name is longer. Collection confirms the
generated classes are 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 (193
entries, no DLPack match), and a repo-wide grep for TestTorchDlPack outside
this file (no hits).

Measured on a single-Battlemage box with no CUDA and no MPS device, so the
cuda and mps bases are never generated here. pytorch#178768 was
applied locally, since test_copy on XPU depends on it.

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
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]>
cyyever pushed a commit to BakeLab/pytorch that referenced this pull request Oct 11, 2026
… XPU (pytorch#192806)

Part of pytorch#142029.

Makes `test/functorch/test_eager_transforms.py` run on Intel GPU (XPU) and classifies its test classes.

The file was already almost device-agnostic; two tests were pinned to a device for historical reasons, and one test-local `HigherOrderOperator` registered autograd per-backend rather than on the alias key. With those fixed, nothing in the file needs an XPU skip -- no `@skipIfXpu`, no tracked issues. Hence a stack rather than a one-line change to `only_for`:

- **Device-pinned tests made generic.** `test_unrelated_hessian` built `W` on `device` but `x` on CPU unconditionally, which `@onlyCPU` hid. `test_linearize_errors` hardcoded `torch.device("cuda")`; it now takes the injected device with `@onlyAccelerator`, keeping primals on CPU so the two devices still differ.
- **`mysum` registered on the `Autograd` alias key** instead of duplicating identical bodies on `AutogradCPU`/`AutogradCUDA`. The per-backend form made all 9 `TestHigherOrderOperatorInteraction` tests raise `NotImplementedError ... DispatchKey.AutogradXPU`; the alias key covers every backend, including out-of-tree `PrivateUse1`.
- **XPU enabled** via `"xpu"` in `only_for` plus `allow_xpu=True` on 15 instantiation calls. Both are required: `allow_xpu` gates whether `XPUTestBase` is a candidate, `only_for` then filters.
- **`TestGradTrackingTensorToList` is not device-instantiated** -- none of its four tests take a `device` parameter, so per review it has no `instantiate_device_type_tests` call and is GENERIC.
- **Device-instantiated classes carry a `Device` suffix**, matching `TestTypePromotionDevice` (pytorch#190990), so the name states whether a class is device-generic.
- **`hw_classification` on all 18 classes** -- 15 ACCELERATOR, 3 GENERIC (`TestSliceArgnums`, `TestMakeFunctional`, `TestGradTrackingTensorToList`).

## Name-keyed lookups moved with the rename

Renaming a class invalidates every lookup keyed on `f"{class_name}.{test_name}"`. Three mechanisms use that key; the first version of this stack only handled the first, turning three `dynamo_wrapped` shards red:

- `test/dynamo_expected_failures` -- 52 markers moved.
- `test/compiled_autograd_skips` -- 2 markers moved. Orphaning them left compiled autograd enabled for `test_maml_omniglot_mechanism_functional_call_cpu`, which then failed with `TypeError: add(): argument 'other' (position 2) must be Tensor, not NoneType`.
- The test-infra disabled-tests list, which cannot be renamed from this repo. It disables `test_jacfwd_different_levels_cpu (__main__.TestHessianCPU)` for dynamo via pytorch#192284; the orphaned key un-disabled it, failing on Python 3.14. That test's existing `skipIf` now covers dynamo unconditionally and names pytorch#192284, rather than relying on an out-of-repo retitle that reviewers cannot see.

Swept all five marker directories for the 15 renamed classes: `dynamo_skips`, `inductor_expected_failures` and `inductor_skips` hold no entries for them.

## Coverage delta

Full file on a single-XPU host, before vs. after the stack:

| | before | after |
|---|---|---|
| collected | 378 | 723 |
| passed | 376 | 719 |
| skipped | 1 | 2 |
| xfailed | 1 | 2 |

After: 345 CPU + 345 XPU + 33 non-device-parameterized. The non-XPU subset (378 tests) runs 376 passed, 1 skipped, 1 xfailed -- identical to the whole file before the stack, so CPU coverage is preserved exactly.

The new skip is `test_linearize_errors_cpu`, which `@onlyAccelerator` skips on CPU exactly as `@onlyCUDA` did before; the new xfail is the XPU variant of an existing CPU xfail. The widened `skipIf` on `test_jacfwd_different_levels` does not affect these numbers -- it only fires under `TEST_WITH_TORCHDYNAMO`.

The two selectors partition the file exactly, so every test is tagged once:

```
--hw-classification ACCELERATOR         -> total=723, passed=690, unclassified=0, mismatched=33
--hw-classification GENERIC             -> total=723, passed=33,  unclassified=0, mismatched=690
--hw-classification GENERIC ACCELERATOR -> total=723, passed=723, unclassified=0, mismatched=0
```
Pull Request resolved: pytorch#192806
Approved by: https://github.com/pbielak, https://github.com/etaf, https://github.com/jansel

Co-authored-by: Claude Opus 5 <[email protected]>
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 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 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged module: tests/core This label covers all test cases within the Core and Tensor sheets. module: tests Issues related to tests (not the torch.testing module) open source topic: not user facing topic category

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants