Skip to content

[Testcase Refactoring] Make test_rng device-agnostic via instantiate_device_type_tests - #198356

Closed
gavinwang269 wants to merge 2 commits into
pytorch:mainfrom
gavinwang269:cb2/m3-rng
Closed

gavinwang269 wants to merge 2 commits into
pytorch:mainfrom
gavinwang269:cb2/m3-rng

Conversation

@gavinwang269

@gavinwang269 gavinwang269 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Move test_rng out of the guard-skipped TestCompilerBisector class into its own instantiated device class, so it runs on real accelerator devices instead of being skipped by the old @unittest.skipIf(not HAS_GPU) class guard.

Split from #191435 (refactoring this file for out-of-tree accelerator support). This piece is a pure method move: the instantiate_device_type_tests scaffold already landed via #198361.

Changes

test/dynamo/test_compiler_bisector.py (+38 -20):

  1. Add TestCompilerBisectorRNG(TestCase) (hw_classification = HardwareClassification.ACCELERATOR) containing the moved test_rng; the hardcoded device=GPU_TYPE becomes the device argument injected by instantiation, and the Triton gate sits on the class (same pattern as [Testcase Refactoring] Make test_emulate_precision_casts device-agnostic via instantiate_device_type_tests #198357).
  2. Instantiate with except_for="cpu" (per @lizhihai137's review: keeps the ACCELERATOR contract instead of narrowing the device matrix via only_for). test_rng relies on torch._dynamo.utils.preserve_rng_state, which today saves/restores only CPU, CUDA and XPU RNG state; on backends without generator save/restore the eager-vs-compiled comparison silently diverges and the bisector blames the wrong subsystem (verified on an Ascend NPU: do_bisect reports eager instead of inductor). Such devices now skip explicitly via @skipPRIVATEUSE1 rather than being silently excluded from instantiation.

Notes

  • Generalizing preserve_rng_state via torch.get_device_module(device) would widen this test's device coverage; that is a source-side change beyond this series, left as a follow-up candidate.
  • Test IDs change from TestCompilerBisector.test_rng to per-device variants (test_rng_cuda, test_rng_xpu, test_rng_npu [skipped], ...). I checked the test/dynamo_skips/ and test/dynamo_expected_failures/ entries and the slow-test lists in main: nothing is keyed on the old TestCompilerBisector.test_rng name.

Motivation

The @unittest.skipIf(not HAS_GPU) class guard uses HAS_GPU = HAS_CUDA_AND_TRITON or HAS_XPU_AND_TRITON or HAS_MTIA_AND_TRITON. Out-of-tree accelerators registered via PrivateUse1 are not in this list, so the test was skipped even where it can run. instantiate_device_type_tests gives each supported device its own variant, and hw_classification provides metadata for --hw-classification filtering.

Test Plan

Environment Result
CPU (env-pytorch-2.16-20261029-cpu) pytest --collect-only -q -> 11 tests collected (the moved test no longer appears un-instantiated)
NPU (env-pytorch-2.16-20261029-npu, Ascend 910B4 / CANN 9.2.0 GA / torch_npu 737bb43 / triton-ascend 3.6.0) test_rng_npu is instantiated and skips cleanly (0.009s) via @skipPRIVATEUSE1 instead of being silently absent
CUDA / XPU execution covered by the ciflow trunk jobs
lint lintrunner (includes in-tree TEST_LINTER): no issues

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @kadeng @chauhang @amjames @jataylo @azahed98 @fffrog

@pytorch-bot

pytorch-bot Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

PR Status: Approved 🚀

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

✅ AUTOMATED REVIEW - OUTDATED (earlier commit) - Ready for human review:

Test-only change: test_rng moves out of TestCompilerBisector into a new
device-generic class, TestCompilerBisectorRNG, which only runs on cuda and xpu
because preserve_rng_state only restores CPU/CUDA/XPU RNG state. The new class
follows the existing TestCompilerBisectorDevice pattern. The old test's gates
are preserved (MTIA is the one exception, and the RNG comparison was unreliable
there anyway), and no skip or expected-failure list refers to the old test ID.
The maintainer's comments only asked for automated reviews, and the author has
replied to the issues those reviews raised.

Reviewed commit: c73f19a (NOT the current head 70d9b4f)

Review run

🔗 Helpful Links

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

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

✅ No Failures

As of commit 70d9b4f with merge base 17782e7 (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 commented Sep 23, 2026 •

Copy link
Copy Markdown

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

@gavinwang269

Copy link
Copy Markdown
Contributor Author

@pytorchbot label "module: tests/graph"

@pytorch-bot pytorch-bot Bot added the module: tests/graph This label covers all test cases within the Graph sheet. label Sep 23, 2026
@fffrog fffrog moved this to Backlog in PyTorch Test Refactoring Sep 23, 2026
@janeyx99 janeyx99 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Sep 25, 2026
@gavinwang269
gavinwang269 force-pushed the cb2/m3-rng branch 2 times, most recently from 42151a8 to 0952229 Compare September 28, 2026 08:53
@gavinwang269

Copy link
Copy Markdown
Contributor Author

Hi @guilhermeleobas — just a gentle ping for review on this device-agnostic refactor piece.

Context: the series was rebased onto the latest main after #198361 landed the shared scaffold, so this PR is now a pure method move (method body unchanged verbatim; only ownership moves into the instantiated device class). Diff is small and mechanical.

Series reference: #198354 ~ #198362 (one test method per PR, each kept small for review).

@jansel

jansel commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

@claude review these changes

@claude

claude Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Claude finished @jansel's task in 54s —— View job


This mechanical move has two blockers: it fails lint, and on out-of-tree backends (the PR's motivation) test_rng can't pass on stock PyTorch, because preserve_rng_state only saves and restores CPU, CUDA and XPU RNG state.

PR Review: #198356

Summary

The PR moves test_rng from TestCompilerBisector (gated by HAS_GPU) into the instantiated TestCompilerBisectorDevice, and swaps the hardcoded GPU_TYPE for the injected device. The body is otherwise unchanged. Two problems block it: the lint job fails, and the new generic device variants depend on RNG save/restore that exists only for CPU, CUDA and XPU.

Infrastructure

  • test/dynamo/test_compiler_bisector.py:414-417: preserve_rng_state is not device-generic. torch._dynamo.utils.preserve_rng_state (torch/_dynamo/utils.py:2821-2839) saves and restores only CPU, torch.cuda and torch.xpu RNG state.
    • test_fn assumes eager and compiled torch.rand(..., device=device) start from the same RNG state. That assumption is what makes inductor_fallback_random the subsystem the bisector blames.
    • A PrivateUse1 device (e.g. NPU) or any other non-CUDA/XPU accelerator has nothing restoring its generator. Eager and compiled then diverge even under the eager backend, so do_bisect should report backend="eager" instead of inductor.
    • The PR's motivation is exactly these out-of-tree devices. The NPU "11 passed" result was for the whole refactor and may depend on torch_npu patching this helper.
    • Fix options:
      • Make preserve_rng_state device-generic, e.g. via torch.get_device_module(device) / torch.accelerator. This is the better fix, but it goes beyond a test-only PR.
      • Or restore state in the test with a device-generic helper.
    • Otherwise the move only relocates the test without widening coverage. Low confidence on the NPU outcome: I have not checked whether torch_npu monkeypatches this helper. Please confirm on NPU without torch_npu patching preserve_rng_state.

Code Quality

  • test/dynamo/test_compiler_bisector.py:405-427: this is why the lint job fails. The new method has no blank line before it (E301, directly after test_bisect_run_debuginfo) and an extra blank line after it (the PYFMT diff). Run lintrunner -a.
  • The PR description is stale. It says the PR "includes the new-class scaffold (imports, TestCompilerBisectorDevice, the instantiate_device_type_tests call)". The commit message and the rebased diff show the scaffold already landed via [Testcase Refactoring] Make test_bisect_run_debuginfo device-agnostic via instantiate_device_type_tests #198361, and this PR is only the method move. Please update the body so reviewers aren't looking for scaffold changes.

Testing

  • The test ID changes from TestCompilerBisector.test_rng to TestCompilerBisectorDeviceCUDA.test_rng_cuda / ...XPU.test_rng_xpu. Any existing disabled-test or slow-test entries keyed on the old name will stop matching. Please check the disabled-tests list before landing.

Recommendation

Request Changes: fix the lint failure. Then either make RNG preservation device-generic or confirm that test_rng really passes on a PrivateUse1 backend with stock preserve_rng_state. Without one of those, the stated goal of out-of-tree coverage isn't met for this test.

gavinwang269 added a commit to gavinwang269/pytorch that referenced this pull request Sep 30, 2026
…device migrations

Rebased onto latest main (scaffold + migrated debuginfo from pytorch#198361 are kept).
Drops the seven methods whose device versions arrive in the parallel move
pieces pytorch#198354 (test_bad_decomp), pytorch#198355 (test_joint_graph), pytorch#198356
(test_rng), pytorch#198357 (test_emulate_precision_casts), pytorch#198358
(test_bad_lowering), pytorch#198359 (test_bisect_pre_grad_graph) and pytorch#198360
(test_cudagraph_bisect_max); keeps test_pre_grad, test_crossref and
test_eager_backend. Marks the remaining class GENERIC, renames test_ns to
bisector_ns (a class attribute named test_* would otherwise be collected by
instantiate_device_type_tests), slims tearDown and removes get_lib.

Must merge LAST in the series, only after every sibling move above has
landed; otherwise the deleted GPU tests lose their replacements.

Also fixes the lint failures on the previous revision: removes imports that
are unused at this point in the series (contextmanager, import_module,
_prims_common, preserve_rng_state, module-level config) and normalizes the
blank-line runs left by the method removals. These imports are intentionally
not kept for the siblings; each move piece brings back exactly what it uses.

Signed-off-by: gavinwang269 <[email protected]>
@gavinwang269

Copy link
Copy Markdown
Contributor Author

@claude's review is correct on both counts — thanks @jansel for the look.

  1. preserve_rng_state is not device-generic. Confirmed empirically: on an Ascend NPU, with the stock torch._dynamo.utils.preserve_rng_state (CPU/CUDA/XPU-only save/restore), the moved test fails exactly as predicted — do_bisect reports eager instead of inductor. Fix: test_rng now lives in its own class instantiated with only_for=("cuda", "xpu"), i.e. exactly the devices whose generator state preserve_rng_state actually restores. Out-of-tree backends are excluded at instantiation time rather than silently diverging. Generalizing the helper itself via torch.get_device_module(device) is a source-side change I intentionally left out of this test-only PR; happy to take it as a follow-up if there is interest.

  2. Lint. The E301/PYFMT issues (missing blank line before the moved method, trailing blank run) are fixed; pycodestyle/ruff come back clean locally.

  3. Stale description. Rewritten: it no longer claims to carry the class scaffold (that landed via [Testcase Refactoring] Make test_bisect_run_debuginfo device-agnostic via instantiate_device_type_tests #198361), documents the only_for narrowing, and records the test-ID change (TestCompilerBisector.test_rng -> TestCompilerBisectorRNG{CUDA,XPU}.test_rng_{cuda,xpu}). I checked test/dynamo_skips/, test/dynamo_expected_failures/ and the slow-test lists in main — nothing is keyed on the old name.

PTAL.

@jansel

jansel commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

@claude review again

@claude

claude Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Claude finished @jansel's task in 1m 3s —— View job


The earlier lint and RNG-scope problems are fixed. One thing is left: use @onlyOn(["cuda", "xpu"]) inside the existing TestCompilerBisectorDevice instead of adding a second class and instantiation.

PR Review: #198356

Summary

The PR moves test_rng out of the HAS_GPU-gated TestCompilerBisector into a new device-instantiated class TestCompilerBisectorRNG, limited with only_for=("cuda", "xpu"). The lint failure, the RNG-scope problem and the stale description from the last review are fixed. The remaining problem is the extra class.

Code Quality

  • test/dynamo/test_compiler_bisector.py:413-443: the new class and second instantiate_device_type_tests call are not needed. The file already has a device-generic accelerator class, TestCompilerBisectorDevice, with the same hw_classification and the same has_triton() skip. The only difference is the device set. The per-method decorator onlyOn (torch/testing/_internal/common_device_type.py:1989) already handles that, and test/test_spectral_ops.py:347 uses it the same way (@onlyOn(["cuda", "xpu"])).

Recommendation

Request Changes: fold test_rng into TestCompilerBisectorDevice with @onlyOn(["cuda", "xpu"]) rather than adding a separate class. Otherwise the move is correct: the body is unchanged apart from GPU_TYPE becoming device, and the CUDA/XPU scope matches what preserve_rng_state (torch/_dynamo/utils.py:2821-2839) actually restores.


instantiate_device_type_tests(
TestCompilerBisectorRNG, globals(), only_for=("cuda", "xpu"), allow_xpu=True
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is it confirmed that all test cases in the TestCompilerBisectorRNG class do not support privateuse1 or other out-of-tree devices, and the only_for extension is not powerful enough? It is recommended that the except_for blacklist be used.

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.

Agreed, reworked in 70d9b4f: instantiate now uses except_for="cpu" (consistent with the ACCELERATOR tag), and the device limit is made explicit instead: preserve_rng_state only saves/restores CPU, CUDA and XPU RNG state, so other accelerators are skipped by name rather than excluded from instantiation. Verified on Ascend 910B4: the NPU variant is now instantiated and skips cleanly (0.009s) instead of being silently absent.

# accelerator devices; other out-of-tree backends are instantiated out via
# `only_for` rather than silently diverging.
@unittest.skipIf(not has_triton(), "requires Triton")
def test_rng(self, device):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If the class TestCompilerBisectorRNG uses the blacklist except_for, a decorator similar to skipPRIVATEUSE1(fn) can be used.

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.

Adopted in 70d9b4f: @skipPRIVATEUSE1 on the test, exactly along the lines you suggested.

@unittest.skipIf(not has_triton(), "requires Triton")
def test_rng(self, device):
def foo():
return torch.rand([10], device=device) + 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Before modification, the feature in Triton belonged to the class level, but now it is refined to the test case level. If all test cases require it, it can remain consistent with the previous approach and be placed at the class level.

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 in 70d9b4f: the Triton gate is now on the class itself (single-test class), same pattern as #198357.

@jansel jansel added the in progress PR is being worked on by the author, until the automated review accepts it label Oct 9, 2026
@jansel
jansel self-requested a review October 9, 2026 18:36

@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 c73f19a: nothing blocking; ready for human review.

Test-only change: test_rng moves out of TestCompilerBisector into a new device-generic class, TestCompilerBisectorRNG, which only runs on cuda and xpu because preserve_rng_state only restores CPU/CUDA/XPU RNG state. The new class follows the existing TestCompilerBisectorDevice pattern. The old test's gates are preserved (MTIA is the one exception, and the RNG comparison was unreliable there anyway), and no skip or expected-failure list refers to the old test ID. The maintainer's comments only asked for automated reviews, and the author has replied to the issues those reviews raised.

This review is AI-generated and advisory. Each new automated review replaces the previous one.

@pytorch-bot pytorch-bot Bot added the ready for review Automated review passed, ready for a final review by a maintainer. label Oct 9, 2026
@pytorch-bot pytorch-bot Bot removed the in progress PR is being worked on by the author, until the automated review accepts it label Oct 9, 2026
…device_type_tests

Rebased onto latest main: the Device-class scaffold already exists (merged
via pytorch#198361). `test_rng` is moved out of the CPU-excluded base class into a
dedicated device-instantiated class.

`torch._dynamo.utils.preserve_rng_state` only saves and restores CPU, CUDA
and XPU RNG state, so the eager-vs-compiled RNG comparison `test_rng` relies
on is only meaningful on CUDA and XPU. The new class is instantiated with
`only_for=("cuda", "xpu")` so out-of-tree backends that lack RNG save/restore
are excluded at instantiation time instead of silently diverging. A follow-up
could generalize `preserve_rng_state` via `torch.get_device_module(device)`
to widen this coverage.

Also fixes the E301/E303 lint issues flagged on the previous revision.

Signed-off-by: gavinwang269 <[email protected]>
…kipPRIVATEUSE1 per review

Keep the ACCELERATOR contract consistent (instantiate without only_for)
and make the RNG-state coverage limit explicit instead of narrowing the
device matrix via only_for: preserve_rng_state saves/restores CPU, CUDA
and XPU RNG state only, so PrivateUse1 variants now skip explicitly.
Hoist the Triton gate to the class level (single-test class).
@gavinwang269

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 2, 2026
@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

@github-project-automation github-project-automation Bot moved this from Backlog to Done in PyTorch Test Refactoring Nov 2, 2026
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 5, 2026
…device_type_tests (pytorch#198356)

## Summary

Move `test_rng` out of the guard-skipped `TestCompilerBisector` class into its own instantiated device class, so it runs on real accelerator devices instead of being skipped by the old `@unittest.skipIf(not HAS_GPU)` class guard.

Split from pytorch#191435 (refactoring this file for out-of-tree accelerator support). This piece is a pure method move: the `instantiate_device_type_tests` scaffold already landed via pytorch#198361.

## Changes

`test/dynamo/test_compiler_bisector.py` (+38 -20):
1. Add `TestCompilerBisectorRNG(TestCase)` (`hw_classification = HardwareClassification.ACCELERATOR`) containing the moved `test_rng`; the hardcoded `device=GPU_TYPE` becomes the `device` argument injected by instantiation, and the Triton gate sits on the class (same pattern as pytorch#198357).
2. Instantiate with `except_for="cpu"` (per @lizhihai137's review: keeps the ACCELERATOR contract instead of narrowing the device matrix via `only_for`). `test_rng` relies on `torch._dynamo.utils.preserve_rng_state`, which today saves/restores only CPU, CUDA and XPU RNG state; on backends without generator save/restore the eager-vs-compiled comparison silently diverges and the bisector blames the wrong subsystem (verified on an Ascend NPU: `do_bisect` reports `eager` instead of `inductor`). Such devices now skip explicitly via `@skipPRIVATEUSE1` rather than being silently excluded from instantiation.

## Notes

- Generalizing `preserve_rng_state` via `torch.get_device_module(device)` would widen this test's device coverage; that is a source-side change beyond this series, left as a follow-up candidate.
- Test IDs change from `TestCompilerBisector.test_rng` to per-device variants (`test_rng_cuda`, `test_rng_xpu`, `test_rng_npu` [skipped], ...). I checked the `test/dynamo_skips/` and `test/dynamo_expected_failures/` entries and the slow-test lists in `main`: nothing is keyed on the old `TestCompilerBisector.test_rng` name.

## Motivation

The `@unittest.skipIf(not HAS_GPU)` class guard uses `HAS_GPU = HAS_CUDA_AND_TRITON or HAS_XPU_AND_TRITON or HAS_MTIA_AND_TRITON`. Out-of-tree accelerators registered via `PrivateUse1` are not in this list, so the test was skipped even where it can run. `instantiate_device_type_tests` gives each supported device its own variant, and `hw_classification` provides metadata for `--hw-classification` filtering.

## Test Plan

| Environment | Result |
|---|---|
| CPU (`env-pytorch-2.16-20261029-cpu`) | `pytest --collect-only -q` -> **11 tests collected** (the moved test no longer appears un-instantiated) |
| NPU (`env-pytorch-2.16-20261029-npu`, Ascend 910B4 / CANN 9.2.0 GA / torch_npu 737bb43 / triton-ascend 3.6.0) | `test_rng_npu` is instantiated and **skips cleanly (0.009s)** via `@skipPRIVATEUSE1` instead of being silently absent |
| CUDA / XPU execution | covered by the ciflow trunk jobs |
| lint | `lintrunner` (includes in-tree TEST_LINTER): no issues |

Pull Request resolved: pytorch#198356
Approved by: https://github.com/lizhihai137, https://github.com/jansel
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 9, 2026
…device_type_tests (pytorch#198356)

## Summary

Move `test_rng` out of the guard-skipped `TestCompilerBisector` class into its own instantiated device class, so it runs on real accelerator devices instead of being skipped by the old `@unittest.skipIf(not HAS_GPU)` class guard.

Split from pytorch#191435 (refactoring this file for out-of-tree accelerator support). This piece is a pure method move: the `instantiate_device_type_tests` scaffold already landed via pytorch#198361.

## Changes

`test/dynamo/test_compiler_bisector.py` (+38 -20):
1. Add `TestCompilerBisectorRNG(TestCase)` (`hw_classification = HardwareClassification.ACCELERATOR`) containing the moved `test_rng`; the hardcoded `device=GPU_TYPE` becomes the `device` argument injected by instantiation, and the Triton gate sits on the class (same pattern as pytorch#198357).
2. Instantiate with `except_for="cpu"` (per @lizhihai137's review: keeps the ACCELERATOR contract instead of narrowing the device matrix via `only_for`). `test_rng` relies on `torch._dynamo.utils.preserve_rng_state`, which today saves/restores only CPU, CUDA and XPU RNG state; on backends without generator save/restore the eager-vs-compiled comparison silently diverges and the bisector blames the wrong subsystem (verified on an Ascend NPU: `do_bisect` reports `eager` instead of `inductor`). Such devices now skip explicitly via `@skipPRIVATEUSE1` rather than being silently excluded from instantiation.

## Notes

- Generalizing `preserve_rng_state` via `torch.get_device_module(device)` would widen this test's device coverage; that is a source-side change beyond this series, left as a follow-up candidate.
- Test IDs change from `TestCompilerBisector.test_rng` to per-device variants (`test_rng_cuda`, `test_rng_xpu`, `test_rng_npu` [skipped], ...). I checked the `test/dynamo_skips/` and `test/dynamo_expected_failures/` entries and the slow-test lists in `main`: nothing is keyed on the old `TestCompilerBisector.test_rng` name.

## Motivation

The `@unittest.skipIf(not HAS_GPU)` class guard uses `HAS_GPU = HAS_CUDA_AND_TRITON or HAS_XPU_AND_TRITON or HAS_MTIA_AND_TRITON`. Out-of-tree accelerators registered via `PrivateUse1` are not in this list, so the test was skipped even where it can run. `instantiate_device_type_tests` gives each supported device its own variant, and `hw_classification` provides metadata for `--hw-classification` filtering.

## Test Plan

| Environment | Result |
|---|---|
| CPU (`env-pytorch-2.16-20261029-cpu`) | `pytest --collect-only -q` -> **11 tests collected** (the moved test no longer appears un-instantiated) |
| NPU (`env-pytorch-2.16-20261029-npu`, Ascend 910B4 / CANN 9.2.0 GA / torch_npu 737bb43 / triton-ascend 3.6.0) | `test_rng_npu` is instantiated and **skips cleanly (0.009s)** via `@skipPRIVATEUSE1` instead of being silently absent |
| CUDA / XPU execution | covered by the ciflow trunk jobs |
| lint | `lintrunner` (includes in-tree TEST_LINTER): no issues |

Pull Request resolved: pytorch#198356
Approved by: https://github.com/lizhihai137, https://github.com/jansel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request Merged module: dynamo module: tests/graph This label covers all test cases within the Graph sheet. open source ready for review Automated review passed, ready for a final review by a maintainer. topic: not user facing topic category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants