Repository navigation
[Testcase Refactoring] Refactor test_stage with instantiate_device_type_tests and hw-classification - #192044
[Testcase Refactoring] Refactor test_stage with instantiate_device_type_tests and hw-classification#192044PlatformLC wants to merge 9 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/192044
Note: Links to docs will display an error until the docs builds have been completed.
|
|
@pytorchbot label "module: tests/distributed" |
…e_type_tests and add hw-classification in test_dtensor_pp_unit_tests Enable TestDTensorPPUnitTests on out-of-tree PrivateUse1 accelerators by switching it to instantiate_device_type_tests(only_for=["cuda","xpu","privateuse1"], allow_xpu=True); the framework auto-discovers the registered PrivateUse1 backend and generates a per-device variant. Classify TestDTensorPPUnitTests as ACCELERATOR (device-exercising, multi-process). Drop @requires_accelerator_dist_backend from the _requires_multi_gpu helper. The backend availability check is centralized in MultiProcContinuousTest._ensure_processes_spawned via c10d.is_backend_available (provided by pytorch#192044), making the decorator's gate redundant. Add a DTensorPPTestBase intermediate base holding backend_str. It is defined on the base (not on TestDTensorPPUnitTests) so instantiate_device_type_tests inherits rather than ports it -- a ported classmethod is bound to the generic class and cannot see the generated variant's device_type. backend_str delegates to a _resolved_device_type helper that resolves the generic "privateuse1" token to the registered backend name, since MultiProcContinuousTest subprocesses run tests without calling setUpClass (where PrivateUse1TestBase would otherwise resolve it). Switch init_pg to torch.accelerator.set_device_index and resolve the device type per-variant in _make_mesh. Test Plan: ``` python test/distributed/pipelining/test_dtensor_pp_unit_tests.py -v --hw-classification ACCELERATOR ``` --hw-classification ACCELERATOR selects the device-exercising tests; --hw-classification GENERIC/CPU filter the ACCELERATOR class out (Ran 0).
207f023 to
874579e
Compare
|
The common_distributed.py and test_stage.py changes look good — c10d.is_backend_available() correctly covers third-party backends, and _resolved_device_type() properly handles the privateuse1 token in subprocesses. One ask: please split the common_distributed.py change into a separate PR landing first, so test_stage.py rebases on top — per the convention of keeping base-class/tooling changes separate. |
…e_type_tests and add hw-classification in test_dtensor_pp_integration Enable TestDTensorPPModes on out-of-tree PrivateUse1 accelerators by switching it to instantiate_device_type_tests(only_for=["cuda","xpu","privateuse1"], allow_xpu=True); the framework auto-discovers the registered PrivateUse1 backend and generates a per-device variant. Classify TestDTensorPPModes as ACCELERATOR (device-exercising, multi-process). Drop @requires_accelerator_dist_backend from the _requires_multi_gpu helper. The backend availability check is centralized in MultiProcContinuousTest._ensure_processes_spawned via c10d.is_backend_available (provided by pytorch#192044), making the decorator's gate redundant. Add a _resolved_device_type() helper to the existing DTensorPPIntegrationBase intermediate base (which already holds backend_str), resolving the generic "privateuse1" token to the registered backend name since MultiProcContinuousTest subprocesses run tests without calling setUpClass. backend_str, the device property, init_pg, and _make_mesh all resolve the device type per-variant. Switch init_pg to torch.accelerator.set_device_index (Pattern D). Test Plan: ``` python test/distributed/pipelining/test_dtensor_pp_integration.py -v --hw-classification ACCELERATOR ``` --hw-classification ACCELERATOR selects the device-exercising tests; --hw-classification GENERIC/CPU filter them out (Ran 0).
…e_device_type_tests and hw-classification Switch ComposabilityTest to instantiate_device_type_tests(only_for=["cuda","xpu","privateuse1"], allow_xpu=True) and classify it ACCELERATOR. Add a ComposabilityTestBase intermediate base with backend_str + a _resolved_device_type() helper that resolves the generic "privateuse1" token (MultiProcContinuousTest subprocesses skip setUpClass, so cls.device_type stays the token). Remove the old backend_str()/device_type() classmethods and @requires_accelerator_dist_backend() (the backend check is centralized via is_backend_available in pytorch#192044). Keep @skip_if_lt_x_gpu(8) and @skip_but_pass_in_sandcastle_if(not at_least_x_gpu(8), ...), made device-agnostic by pytorch#187650 and the previous commit. Test Plan: ``` python test/distributed/_composable/test_composability/test_pp_composability.py -v --hw-classification ACCELERATOR ``` --hw-classification ACCELERATOR selects the tests; GENERIC/CPU filter them out (Ran 0).
splited the common change, PTAL #192186 |
874579e to
829006f
Compare
|
The base-class split is submitted as a standalone PR as discussed(#192186 ), looks as expected. |
829006f to
83bb28e
Compare
…e_type_tests and add hw-classification in test_dtensor_pp_unit_tests Enable TestDTensorPPUnitTests on out-of-tree PrivateUse1 accelerators by switching it to instantiate_device_type_tests(only_for=["cuda","xpu","privateuse1"], allow_xpu=True); the framework auto-discovers the registered PrivateUse1 backend and generates a per-device variant. Classify TestDTensorPPUnitTests as ACCELERATOR (device-exercising, multi-process). Drop @requires_accelerator_dist_backend from the _requires_multi_gpu helper. The backend availability check is centralized in MultiProcContinuousTest._ensure_processes_spawned via c10d.is_backend_available (provided by pytorch#192044), making the decorator's gate redundant. Add a DTensorPPTestBase intermediate base holding backend_str. It is defined on the base (not on TestDTensorPPUnitTests) so instantiate_device_type_tests inherits rather than ports it -- a ported classmethod is bound to the generic class and cannot see the generated variant's device_type. backend_str delegates to a _resolved_device_type helper that resolves the generic "privateuse1" token to the registered backend name, since MultiProcContinuousTest subprocesses run tests without calling setUpClass (where PrivateUse1TestBase would otherwise resolve it). Switch init_pg to torch.accelerator.set_device_index and resolve the device type per-variant in _make_mesh. Test Plan: ``` python test/distributed/pipelining/test_dtensor_pp_unit_tests.py -v --hw-classification ACCELERATOR ``` --hw-classification ACCELERATOR selects the device-exercising tests; --hw-classification GENERIC/CPU filter the ACCELERATOR class out (Ran 0).
…e_type_tests and add hw-classification in test_dtensor_pp_integration Enable TestDTensorPPModes on out-of-tree PrivateUse1 accelerators by switching it to instantiate_device_type_tests(only_for=["cuda","xpu","privateuse1"], allow_xpu=True); the framework auto-discovers the registered PrivateUse1 backend and generates a per-device variant. Classify TestDTensorPPModes as ACCELERATOR (device-exercising, multi-process). Drop @requires_accelerator_dist_backend from the _requires_multi_gpu helper. The backend availability check is centralized in MultiProcContinuousTest._ensure_processes_spawned via c10d.is_backend_available (provided by pytorch#192044), making the decorator's gate redundant. Add a _resolved_device_type() helper to the existing DTensorPPIntegrationBase intermediate base (which already holds backend_str), resolving the generic "privateuse1" token to the registered backend name since MultiProcContinuousTest subprocesses run tests without calling setUpClass. backend_str, the device property, init_pg, and _make_mesh all resolve the device type per-variant. Switch init_pg to torch.accelerator.set_device_index (Pattern D). Test Plan: ``` python test/distributed/pipelining/test_dtensor_pp_integration.py -v --hw-classification ACCELERATOR ``` --hw-classification ACCELERATOR selects the device-exercising tests; --hw-classification GENERIC/CPU filter them out (Ran 0).
…e_device_type_tests and hw-classification Switch ComposabilityTest to instantiate_device_type_tests(only_for=["cuda","xpu","privateuse1"], allow_xpu=True) and classify it ACCELERATOR. Add a ComposabilityTestBase intermediate base with backend_str + a _resolved_device_type() helper that resolves the generic "privateuse1" token (MultiProcContinuousTest subprocesses skip setUpClass, so cls.device_type stays the token). Remove the old backend_str()/device_type() classmethods and @requires_accelerator_dist_backend() (the backend check is centralized via is_backend_available in pytorch#192044). Keep @skip_if_lt_x_gpu(8) and @skip_but_pass_in_sandcastle_if(not at_least_x_gpu(8), ...), made device-agnostic by pytorch#187650 and the previous commit. Test Plan: ``` python test/distributed/_composable/test_composability/test_pp_composability.py -v --hw-classification ACCELERATOR ``` --hw-classification ACCELERATOR selects the tests; GENERIC/CPU filter them out (Ran 0).
fffrog
left a comment
There was a problem hiding this comment.
I think we need to discuss this, because it's a very common scenario in distributed test cases.
There was a problem hiding this comment.
Removing this one, and using device parameter instreadly.
There was a problem hiding this comment.
updated. PTAL, thx~
jishuangfeng
left a comment
There was a problem hiding this comment.
Code looks good. Good to merge after #192186 lands.
LGTM.
…usTest backend check (#192186) ## Summary Replace `MultiProcContinuousTest`'s hardcoded backend-availability dict in `_ensure_processes_spawned` with `c10d.is_backend_available(backend)`. The generic API covers any backend registered via `Backend.register_backend`, including out-of-tree PrivateUse1 accelerators' backends, so the spawn-time check no longer silently passes through unlisted backends. ## Changes - `torch/testing/_internal/common_distributed.py`: Replaced the hardcoded `{nccl, gloo, mpi, xccl}` backend-availability dict in `MultiProcContinuousTest._ensure_processes_spawned` with `c10d.is_backend_available(backend)`. This is the prerequisite for test-file PRs (e.g. test_stage, #192044) to drop their `@requires_accelerator_dist_backend` gate: with the backend availability check centralized here, the decorator becomes redundant. ## Motivation Part of the test-case refactoring initiative (#185590) to decouple tests from hardcoded CUDA/NCCL assumptions so out-of-tree PrivateUse1 accelerators can run the suite. Split out from #192044 per review so the base-class/tooling change lands first and the test-file changes rebase on top. ## Notes This is part of the test case refactoring initiative tracked in #185590. Pull Request resolved: #192186 Approved by: https://github.com/jishuangfeng, https://github.com/fffrog, https://github.com/albanD
…usTest backend check (pytorch#192186) ## Summary Replace `MultiProcContinuousTest`'s hardcoded backend-availability dict in `_ensure_processes_spawned` with `c10d.is_backend_available(backend)`. The generic API covers any backend registered via `Backend.register_backend`, including out-of-tree PrivateUse1 accelerators' backends, so the spawn-time check no longer silently passes through unlisted backends. ## Changes - `torch/testing/_internal/common_distributed.py`: Replaced the hardcoded `{nccl, gloo, mpi, xccl}` backend-availability dict in `MultiProcContinuousTest._ensure_processes_spawned` with `c10d.is_backend_available(backend)`. This is the prerequisite for test-file PRs (e.g. test_stage, pytorch#192044) to drop their `@requires_accelerator_dist_backend` gate: with the backend availability check centralized here, the decorator becomes redundant. ## Motivation Part of the test-case refactoring initiative (pytorch#185590) to decouple tests from hardcoded CUDA/NCCL assumptions so out-of-tree PrivateUse1 accelerators can run the suite. Split out from pytorch#192044 per review so the base-class/tooling change lands first and the test-file changes rebase on top. ## Notes This is part of the test case refactoring initiative tracked in pytorch#185590. Pull Request resolved: pytorch#192186 Approved by: https://github.com/jishuangfeng, https://github.com/fffrog, https://github.com/albanD
…usTest backend check (pytorch#192186) ## Summary Replace `MultiProcContinuousTest`'s hardcoded backend-availability dict in `_ensure_processes_spawned` with `c10d.is_backend_available(backend)`. The generic API covers any backend registered via `Backend.register_backend`, including out-of-tree PrivateUse1 accelerators' backends, so the spawn-time check no longer silently passes through unlisted backends. ## Changes - `torch/testing/_internal/common_distributed.py`: Replaced the hardcoded `{nccl, gloo, mpi, xccl}` backend-availability dict in `MultiProcContinuousTest._ensure_processes_spawned` with `c10d.is_backend_available(backend)`. This is the prerequisite for test-file PRs (e.g. test_stage, pytorch#192044) to drop their `@requires_accelerator_dist_backend` gate: with the backend availability check centralized here, the decorator becomes redundant. ## Motivation Part of the test-case refactoring initiative (pytorch#185590) to decouple tests from hardcoded CUDA/NCCL assumptions so out-of-tree PrivateUse1 accelerators can run the suite. Split out from pytorch#192044 per review so the base-class/tooling change lands first and the test-file changes rebase on top. ## Notes This is part of the test case refactoring initiative tracked in pytorch#185590. Pull Request resolved: pytorch#192186 Approved by: https://github.com/jishuangfeng, https://github.com/fffrog, https://github.com/albanD
|
@claude review this pr with pr review skill |
|
Claude finished @can-gaa-hou's task in 18m 51s —— View job PR Review: #192044Reviewed with the Full review detailsSummarySwitches Infrastructure1.
@classmethod
def backend_str(cls) -> str:
return dist.get_default_backend_for_device(cls.device_type)
Commit def _resolved_device_type(cls) -> str:
dt = cls.device_type
if dt == "privateuse1":
dt = torch._C._get_privateuse1_backend_name()
return dtToday the token happens to get resolved because Please restore 2.
3.
@classmethod
def distributed_backend(cls) -> str:
import torch.distributed as dist
return dist.get_default_backend_for_device(cls.device_type)That is character-for-character what the new Testing4. The All seven methods keep It is also frozen at import: Code Quality5. The comment in
6. Please confirm the dependency actually provides the check the description cites. The description justifies deleting all seven backend_checks = {"nccl": ..., "gloo": ..., "mpi": ..., "xccl": ...}
check_fn = backend_checks.get(backend)
if check_fn is not None and not check_fn():
raise unittest.SkipTest(...)
RecommendationRequest Changes — findings 1 and 2 are correctness issues on the PrivateUse1/HPU paths this PR is specifically about, and finding 4 makes the skip predicate wrong for any non-current-accelerator variant. Findings 3, 5, and 6 are cleanups and a verification step. |
|
@pytorchbot label "no-stale" |
…e_type_tests and add hw-classification in test_dtensor_pp_unit_tests Enable TestDTensorPPUnitTests on out-of-tree PrivateUse1 accelerators by switching it to instantiate_device_type_tests(only_for=["cuda","xpu","privateuse1"], allow_xpu=True); the framework auto-discovers the registered PrivateUse1 backend and generates a per-device variant. Classify TestDTensorPPUnitTests as ACCELERATOR (device-exercising, multi-process). Drop @requires_accelerator_dist_backend from the _requires_multi_gpu helper. The backend availability check is centralized in MultiProcContinuousTest._ensure_processes_spawned via c10d.is_backend_available (provided by pytorch#192044), making the decorator's gate redundant. Add a DTensorPPTestBase intermediate base holding backend_str. It is defined on the base (not on TestDTensorPPUnitTests) so instantiate_device_type_tests inherits rather than ports it -- a ported classmethod is bound to the generic class and cannot see the generated variant's device_type. backend_str delegates to a _resolved_device_type helper that resolves the generic "privateuse1" token to the registered backend name, since MultiProcContinuousTest subprocesses run tests without calling setUpClass (where PrivateUse1TestBase would otherwise resolve it). Switch init_pg to torch.accelerator.set_device_index and resolve the device type per-variant in _make_mesh. Test Plan: ``` python test/distributed/pipelining/test_dtensor_pp_unit_tests.py -v --hw-classification ACCELERATOR ``` --hw-classification ACCELERATOR selects the device-exercising tests; --hw-classification GENERIC/CPU filter the ACCELERATOR class out (Ran 0).
…e_type_tests and add hw-classification in test_dtensor_pp_integration Enable TestDTensorPPModes on out-of-tree PrivateUse1 accelerators by switching it to instantiate_device_type_tests(only_for=["cuda","xpu","privateuse1"], allow_xpu=True); the framework auto-discovers the registered PrivateUse1 backend and generates a per-device variant. Classify TestDTensorPPModes as ACCELERATOR (device-exercising, multi-process). Drop @requires_accelerator_dist_backend from the _requires_multi_gpu helper. The backend availability check is centralized in MultiProcContinuousTest._ensure_processes_spawned via c10d.is_backend_available (provided by pytorch#192044), making the decorator's gate redundant. Add a _resolved_device_type() helper to the existing DTensorPPIntegrationBase intermediate base (which already holds backend_str), resolving the generic "privateuse1" token to the registered backend name since MultiProcContinuousTest subprocesses run tests without calling setUpClass. backend_str, the device property, init_pg, and _make_mesh all resolve the device type per-variant. Switch init_pg to torch.accelerator.set_device_index (Pattern D). Test Plan: ``` python test/distributed/pipelining/test_dtensor_pp_integration.py -v --hw-classification ACCELERATOR ``` --hw-classification ACCELERATOR selects the device-exercising tests; --hw-classification GENERIC/CPU filter them out (Ran 0).
…e_device_type_tests and hw-classification Switch ComposabilityTest to instantiate_device_type_tests(only_for=["cuda","xpu","privateuse1"], allow_xpu=True) and classify it ACCELERATOR. Add a ComposabilityTestBase intermediate base with backend_str + a _resolved_device_type() helper that resolves the generic "privateuse1" token (MultiProcContinuousTest subprocesses skip setUpClass, so cls.device_type stays the token). Remove the old backend_str()/device_type() classmethods and @requires_accelerator_dist_backend() (the backend check is centralized via is_backend_available in pytorch#192044). Keep @skip_if_lt_x_gpu(8) and @skip_but_pass_in_sandcastle_if(not at_least_x_gpu(8), ...), made device-agnostic by pytorch#187650 and the previous commit. Test Plan: ``` python test/distributed/_composable/test_composability/test_pp_composability.py -v --hw-classification ACCELERATOR ``` --hw-classification ACCELERATOR selects the tests; GENERIC/CPU filter them out (Ran 0).
…e_type_tests and add hw-classification in test_stage Enable StageTest/StageNegativeTest on out-of-tree PrivateUse1 accelerators by switching them to instantiate_device_type_tests(only_for=["cuda","xpu","privateuse1"], allow_xpu=True); the framework auto-discovers the registered PrivateUse1 backend (via get_desired_device_type_test_bases / _is_privateuse1_backend_available) and generates a per-device variant. Classify StageTest/StageNegativeTest as ACCELERATOR (device-exercising, multi-process) and PipelineStageMetadataInferenceTest as GENERIC (pure metadata-inference logic, no device). Drop @requires_accelerator_dist_backend from every test method: the backend availability check now lives in MultiProcContinuousTest._ensure_processes_spawned via is_backend_available (framework commit), so the decorator's gate is redundant. Add a PipelineStageTestBase intermediate base holding backend_str. It is defined on the base (not on StageTest) so instantiate_device_type_tests inherits rather than ports it -- a ported classmethod is bound to the generic class and cannot see the generated variant's device_type. backend_str delegates to a _resolved_device_type helper that resolves the generic "privateuse1" token to the registered backend name, since MultiProcContinuousTest subprocesses run tests without calling setUpClass (where PrivateUse1TestBase would otherwise resolve it). Test Plan: ``` python test/distributed/pipelining/test_stage.py -v --hw-classification ACCELERATOR ``` 8 ACCELERATOR-classified tests pass on a PrivateUse1 host (8 devices); --hw-classification GENERIC selects the 1 GENERIC metadata-inference test; --hw-classification CPU filters the ACCELERATOR class out (Ran 0).
…t methods TEST_LINTER (pytorch#190173) requires every method in an instantiated ACCELERATOR class to take a `device` parameter; the 7 methods in StageTest/StageNegativeTest lacked it. Add `device` to each plus a `_rank_device(device)` helper on PipelineStageTestBase that resolves the framework-injected primary device ("{type}:0", rank-0) to this worker's per-rank device (torch.device(type, self.rank)), preserving the value of the removed `device` @Property. As the per-rank device now derives from the injected `device` rather than `cls.device_type`, `backend_str` simplifies to `return backend` (module-level, matching test_dtensor_pp_unit_tests/integration) and the obsolete `_resolved_device_type` classmethod is removed. Test Plan: ```python python test/distributed/pipelining/test_stage.py -v # --hw-classification ACCELERATOR selects the multi-proc stage tests, # GENERIC the single-process metadata-inference test, CPU none ```
…in test_stage The module-level `device_type`/`backend` globals were computed once at import from `torch.accelerator.current_accelerator()`. Replace with per-variant resolution: `backend_str` now returns `dist.get_default_backend_for_device(cls.device_type)` (resolved at runtime via the device-type test base's setUpClass), and the multi-accelerator skip messages drop the backend-name prefix for a plain device-agnostic "Test requires 2+ accelerators" string (the skip condition is unchanged). `_rank_device` is kept. Test Plan: ``` python test/distributed/pipelining/test_stage.py -v ``` Runs the multi-process pipeline stage tests on the available accelerator variant; the per-variant backend resolves via cls.device_type.
MultiProcContinuousTest.backend_str now receives the device argument from the framework; accept it in the override and derive the device type from it (torch.device(device).type), matching _rank_device, instead of reading cls.device_type. Test Plan: python3 tools/linter/adapters/test_linter.py test/distributed/pipelining/test_stage.py
…ut_before_backward to the device param Upstream added this test after the original refactoring, with the old pattern: @requires_accelerator_dist_backend(["nccl", "xccl"]) and the module-global backend in its skip message. Apply the same conversion as the other StageTest methods: drop the decorator (the spawn-time c10d.is_backend_available check covers availability and the hardcoded list excludes PrivateUse1's backend), take the framework-injected device, resolve the per-rank device with _rank_device, and use the class's uniform skip message. Test Plan: python3 tools/linter/adapters/test_linter.py test/distributed/pipelining/test_stage.py
The file is classified in this branch (GENERIC single-rank classes and ACCELERATOR classes with instantiate_device_type_tests and device-parametrized test methods), so it no longer needs the allowlist exemption. Test Plan: python3 tools/linter/adapters/test_linter.py test/distributed/pipelining/test_stage.py
…stage as GENERIC The hw_classification rule requires every test class in a classified file to carry a label. PipelineStageMetadataInferenceTest already has GENERIC; apply the same label to the other single-rank TestCase classes (PipelineStageBackendWarningTest, PipelineStageForwardContextTest, OutputSlotReleaseTest), which run with a single-rank gloo group or pure mocks and have no device dependency. The label is metadata and only filters tests when --hw-classification is passed. Test Plan: python3 tools/linter/adapters/test_linter.py test/distributed/pipelining/test_stage.py lintrunner test/distributed/pipelining/test_stage.py
…ort in test_stage The replay dropped the import together with the old instantiate_parametrized_tests(StageTest) call, but upstream's new single-rank classes (PipelineStageBackendWarningTest, PipelineStageForwardContextTest) still expand their @parametrize combinations through it. Keep it alongside instantiate_device_type_tests, which the ACCELERATOR classes use. Test Plan: lintrunner test/distributed/pipelining/test_stage.py python3 tools/linter/adapters/test_linter.py test/distributed/pipelining/test_stage.py
…mon_utils in test_stage It lives in common_utils (as in the rest of the tree), not common_device_type; the previous commit put it in the wrong block and broke the import. Test Plan: lintrunner test/distributed/pipelining/test_stage.py python3 tools/linter/adapters/test_linter.py test/distributed/pipelining/test_stage.py
8cee2da to
db05c1c
Compare
Summary
Refactor
test_stage.pywithinstantiate_device_type_testsand hardware-classification labels, so the multi-processStageTest/StageNegativeTestrun as per-device variants (including out-of-tree PrivateUse1 accelerators) instead of relying on module-level device/backend globals.Changes
test/distributed/pipelining/test_stage.py:StageTestandStageNegativeTestnow instantiate viainstantiate_device_type_tests(..., except_for=["cpu"], allow_xpu=True)and are classifiedHardwareClassification.ACCELERATOR; this replaces main'sinstantiate_parametrized_tests(StageTest)(the device-type instantiation also expands the@parametrizecombinations, so coverage is unchanged: 8 + 2 tests per device variant). The single-rankTestCaseclasses keepinstantiate_parametrized_testsand are classifiedHardwareClassification.GENERIC—PipelineStageMetadataInferenceTestin the original change;PipelineStageBackendWarningTest,PipelineStageForwardContextTest, andOutputSlotReleaseTest, added upstream since, get the same label so the file is uniformly classified. The labels only filter tests when--hw-classificationis passed.PipelineStageTestBase(MultiProcContinuousTest)holdingbackend_strand_rank_device.backend_strderives the per-device default backend from the device the framework passes (torch.device(device).type), and_rank_device(device)resolves the per-rank device from the framework-injected primary device. The module-leveldevice_type/backendglobals and thedevice_type/deviceproperties that read them are removed.deviceparameter and usesrank_device = self._rank_device(device)for model placement, input creation, andPipelineStageconstruction. This includestest_schedule_releases_output_before_backward, added upstream after the original change, which is converted the same way.@requires_accelerator_dist_backend(["nccl", "xccl"])decorators on the test methods — the backend availability check lives inMultiProcContinuousTest._ensure_processes_spawnedviac10d.is_backend_available, which covers out-of-tree backends, so the decorator is redundant, and its hardcoded list excludes PrivateUse1's backend. TheTEST_MULTIACCELERATORskip gates are kept with the uniform "Test requires 2+ accelerators" message.tools/linter/adapters/test_linter_allowlist.json: dropped this file's entry; it is classified and passes the test linter rules.Motivation
Part of the test-case refactoring initiative tracked in #185590, decoupling tests from hardcoded device assumptions so out-of-tree accelerators can run the suite. This file switches to
instantiate_device_type_tests(per-device variants) and is classified so the suite can filter it by hardware category.Notes
c10d.is_backend_available) has already landed on main.