Repository navigation
[Testcase Refactoring][FSDP] Decouple optimizer state tests from accelerator selection - #194204
danieldale2026 wants to merge 5 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/194204
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@pytorchbot label "topic: not user facing" |
This commit was authored with AI assistance and reviewed by the contributor. Test Plan: ``` python3 -m py_compile test/test_testing.py torch/testing/_internal/common_distributed.py torch/testing/_internal/common_fsdp.py test/distributed/fsdp/test_fsdp_optim_state.py git diff --cached --check ``` Runtime FSDP execution is not verified in the current WSL/A2 projection.
c750386 to
f9110b3
Compare
|
@pytorchbot label "module: tests/distributed" |
Keep the optimizer-state consumer PR below the requested review-size boundary by using one class-level distributed/FSDP capability preflight. Preserve all test coverage and behavior while leaving explicit device-argument refinement for the stacked child. Test Plan: ```bash PYTHONPYCACHEPREFIX=/tmp/pr194204-parent-pycache python3 -m py_compile test/distributed/fsdp/test_fsdp_optim_state.py git diff --check ``` spin fixlint was attempted but could not start because uvx is unavailable in this environment. This commit was authored with AI assistance and reviewed by the contributor.
|
I reviewed the parent and child diffs and confirmed the split preserves the optimizer-state test behavior. The following status update was prepared with agent assistance:
|
Test Plan:
/home/daniel/workspace/pytorch-dev/pytorch/.venv/bin/python -m py_compile test/distributed/fsdp/test_fsdp_optim_state.py
git diff --check
/home/daniel/workspace/pytorch-dev/pytorch/.venv/bin/spin fixlint
The first two commands passed. The lint command was attempted but could not
start because uvx is unavailable in the shared environment.
Consumer diff against upstream/main is +151/-48 (199 changed lines), with the
remaining API device-argument refinements kept in the stacked child.
This commit was authored with AI assistance and reviewed by the contributor.
Test Plan:\n```bash\npython3 -m py_compile <changed Python files>\ngit diff --check\nspin fixlint # unavailable in this environment: uvx is missing\n```\n\nThis commit was prepared with assistance from an AI assistant and reviewed for correctness before publication.
Replay the pytorch#194204 consumer topic from 31cee02 on the local pytorch#191919 dependency. Retain current main's FSDPTestContinuous base and both subgroup cleanups. Preserve the parent's DEVICE_BEFORE initialization correction, device plumbing, open accelerator admission and all 24 test methods. This local replay does not update pytorch#194204; the four tail API signatures remain a separate child increment. Prepared with an AI assistant (Codex); human publication review is pending. Test Plan ```bash /usr/bin/python3 -B /home/daniel/workspace/pytorch-dev/worktrees/pytorch/pr193067-comment-closure-20260922/agent_space/comment-closure/validate.py parent test/distributed/fsdp/test_fsdp_optim_state.py /usr/bin/python3 -B /home/daniel/workspace/pytorch-dev/worktrees/pytorch/pr193067-comment-closure-20260922/agent_space/comment-closure/semantics.py B git diff --check ``` In-memory compilation, five cached lint checks and static AST preservation passed. Exact parent content plus the three main drift behaviors verified. Two accepted parent assertions require CPU instead of excluding CUDA/XPU. Runtime and collection NOT_RUN; canonical fixed-commit review pending.
Replay only the accepted pytorch#195961 +8/-8 increment on the local pytorch#194204 parent layer. The four remaining tail API tests receive the injected device and derive its type instead of reading self.device_type. Preserve the parent DEVICE_BEFORE correction, accelerator admission, continuous harness and subgroup cleanup behavior without adding child behavior. Prepared with an AI assistant (Codex); human publication review is pending. Test Plan ```bash /usr/bin/python3 -B /home/daniel/workspace/pytorch-dev/worktrees/pytorch/pr193067-comment-closure-20260922/agent_space/comment-closure/validate.py child-applied test/distributed/fsdp/test_fsdp_optim_state.py /usr/bin/python3 -B /home/daniel/workspace/pytorch-dev/worktrees/pytorch/pr193067-comment-closure-20260922/agent_space/comment-closure/semantics.py B git diff --check ``` In-memory compilation, five cached lint checks, 24-method AST preservation, and exact four-API added/removed lines passed. All AST outside the four signatures and device assignments is identical to the local parent. Runtime and collection NOT_RUN; canonical fixed-commit review pending.
danieldale2026
left a comment
There was a problem hiding this comment.
I’m reviewing these hardware-decoupling changes to catch recurring test issues early and avoid repeated review requests. The inline analysis below was prepared with Codex.
|
|
||
|
|
||
| class TestFSDPOptimState(FSDPTest): | ||
| hw_classification = HardwareClassification.ACCELERATOR |
There was a problem hiding this comment.
Codex static review. Several methods in the new
ACCELERATORclass still have nodevice/devicesparameter. For example,test_full_optim_state_dict_keysallocates fromself.device_typeinstead of the injected fixture;test_full_optim_state_dict_nested_invaliddoes the same. Could you thread the fixture through those methods and derive per-rank devices from it where necessary?
I reviewed the code and the quoted PR draft below, verified the reported results, and take responsibility for this submission. The title and quoted body were prepared with agent assistance.