Repository navigation
[Testcase Refactoring][FSDP] Decouple state and sharding tests from accelerator hardware - #193067
danieldale2026 wants to merge 2 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/193067
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New Failures, 4 Unclassified FailuresAs of commit d73b3a6 with merge base 67d293e ( UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
|
|
@pytorchbot label "topic: not user facing" |
|
@pytorchbot label "module: tests/distributed" |
bc457ba to
2686138
Compare
fa36e73 to
079de11
Compare
dd90db8 to
166bece
Compare
|
Some modification is the same as other pr, such as: #191178. |
e5f9aae to
aa59a7f
Compare
| return torch.rand(8, 8, device=device_type) | ||
|
|
||
|
|
||
| class TestFSDPStateDict(FSDPTest): | ||
| hw_classification = HardwareClassification.ACCELERATOR |
There was a problem hiding this comment.
Testclass tagged accelerator should be instantiated by instantiate_device_type_tests.
There was a problem hiding this comment.
Plz also review class TestFSDPStateDict.
There was a problem hiding this comment.
I have reviewed the code changes and the accompanying explanations. The changes are reasonable, and I have no further comments.
AI-assisted reply on device-type instantiation
Thanks! In this revision, both classes are instantiated by instantiate_device_type_tests:
TestFSDPStateDict: all 20 test methods, with the CPU case excluded and XPU allowed.TestFSDPStateDict4GPUs:test_local_state_dict_reshard, likewise instantiated.
All 21 test methods are retained; every test receives the injected device, and the resource gates are preserved (20 two-device tests plus the one four-device test). The change is contained in this PR's own increment: d73b3a6f, own diff 100dc079...d73b3a6f (test/distributed/fsdp/test_fsdp_state_dict.py, +185/-68).
Verification performed on this head: in-memory compilation, AST comparison of methods/assertions/parameterizations/gates, and scoped lint (FLAKE8/RUFF/PYFMT/TEST_HAS_MAIN/TEST_DEVICE_BIAS) all PASS. Multi-accelerator runtime and collection were not performed in local validation — the state-dict tests generally need 2 devices (reshard needs 4) — so no runtime pass is claimed. No CI result is claimed in this update; see the PR checks for CI status.
Local replay of pytorch#191919 at 925b73c on pinned main 67d293e. Preserve the accepted flat capability contract: missing declarations fail, unsupported capabilities skip, and out-of-tree providers own their declarations. This local dependency freeze does not update pytorch#191919. Prepared with an AI assistant (Codex); human publication review is pending. Test Plan ```bash /usr/bin/python3 -B agent_space/comment-closure/validate.py dependency-r2 torch/testing/_internal/common_device_type.py test/test_testing.py test/cpp_extensions/open_registration_extension/torch_openreg/tests/test_testing.py git diff --check ``` In-memory compilation and 12 applicable cached lint/file checks passed; three manifest exclusions. Exact accepted patch and strict-missing AST checks passed. Runtime and collection NOT_RUN; scoped static checks only.
Replay the accepted pytorch#193067 consumer on the separate pytorch#191919 dependency layer. Both classes now use device-type instantiation with explicit device plumbing and capability gates; all 21 tests, assertions, parameterizations, and resource gates are retained. Consumer scope is one state-dict file. Prepared with an AI assistant (Codex); human publication review is pending. Test Plan ```bash /usr/bin/python3 -B agent_space/comment-closure/validate.py consumer-applied test/distributed/fsdp/test_fsdp_state_dict.py /usr/bin/python3 -B agent_space/comment-closure/semantics.py A git diff --check ``` In-memory compilation, five applicable cached lint checks, and AST checks passed. The +185/-68 patch exactly matches the accepted input. Runtime and collection NOT_RUN; canonical fixed-commit review pending.
c532d8a to
d73b3a6
Compare
|
I have reviewed the code changes and the accompanying explanations. The changes are reasonable, and I have no further comments. AI-assisted reply on shared changesThanks for flagging the overlap. To make the split explicit in this revision:
Since the GitHub PR diff is computed against |
|
I have reviewed the code changes and the accompanying explanations. The changes are reasonable, and I have no further comments. AI-assisted re-review request@wjlFlyer Could you please take another look at this revision when you have time? Head: d73b3a6f.
|
I have reviewed the code changes and the accompanying explanations. The changes are reasonable, and I have no further comments.
AI-assisted PR body
Issue
Part of #185590.
Summary
Decouple FSDP v1 state and sharding coverage from fixed accelerator selection. Both
TestFSDPStateDictandTestFSDPStateDict4GPUsare now instantiated throughinstantiate_device_type_tests(CPU case excluded, XPU allowed), while all 21 existing tests, their assertions, parameterizations, and device-count/capability gates are preserved.Stack layout and scope
This branch is stacked on the unmerged capability-gate PR #191919, present in this branch's ancestry as commit 100dc079 (three harness/test files, +351/-88). That dependency is declared here, not re-proposed.
This PR's own increment relative to that dependency is a single file,
test/distributed/fsdp/test_fsdp_state_dict.py(+185/-68):Because #191919 is unmerged, the cumulative GitHub diff against
mainalso shows its three framework/test files (four files, +536/-156 total); those lines belong to the declared #191919 dependency rather than this PR’s own increment. This branch does not modify thecommon_fsdp/common_distributedhelpers as reviewed at the main baseline 67d293e.Changes
TestFSDPStateDict(20 tests) andTestFSDPStateDict4GPUs(test_local_state_dict_reshard) viainstantiate_device_type_tests, with CPU excluded and XPU allowed.devicethrough every test while preserving assertions, skips, subtests, and parameterizations.Motivation
State handling and sharding semantics are not intrinsically tied to one accelerator. Device-type instantiation with capability gates lets capable backends run the same assertions without weakening the tested behavior.
Test Plan
Checks actually run on this revision's head (
d73b3a6f):PYFMTontest/test_testing.py;TEST_HAS_MAIN/TEST_DEVICE_BIASontorch/testing/_internal/common_device_type.py). This is scoped lint, not full-repo lint or CI.git diff --check: PASS.Not run, and not claimed:
test_local_state_dict_reshardrequires 4, so no runtime pass is claimed.BC-breaking?
No. This changes test classification and device plumbing only.