Skip to content

[FSDP2] Restore reduce-scatter numerical test coverage - #197459

Closed
weifengpy wants to merge 2 commits into
gh/weifengpy/184/basefrom
gh/weifengpy/184/head
Closed

weifengpy wants to merge 2 commits into
gh/weifengpy/184/basefrom
gh/weifengpy/184/head

Conversation

@weifengpy

@weifengpy weifengpy commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

AI-assisted draft prepared with Codex.

foreach_reduce clears unsharded_grads, so cloning reference gradients afterward left the numerical comparison loops empty. Save the reference gradients before the call. Use rank % 8 inputs to keep fp16 sums exactly representable in the threaded process group.

Test Plan:

CUDA_VISIBLE_DEVICES=1,2 python test/distributed/_composable/fsdp/test_fully_shard_comm.py TestFullyShardCollectiveOps -v
spin quicklint -a

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 1 Cancelled Job, 2 Unrelated Failures

As of commit c665e3c with merge base 3fda599 (image):

CANCELLED JOB - The following job was cancelled. Please retry:

CRCR (non-blocking) - The following CRCR downstream CI jobs failed but are non-blocking:

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 Sep 17, 2026
@weifengpy
weifengpy requested a review from anshul-si September 17, 2026 19:53
@weifengpy
weifengpy marked this pull request as ready for review September 17, 2026 19:53
weifengpy added a commit that referenced this pull request Sep 17, 2026
> AI-assisted draft prepared with Codex.
>
> `foreach_reduce` clears `unsharded_grads`, so cloning reference gradients afterward left the numerical comparison loops empty. Save the reference gradients before the call. Use `rank % 8` inputs to keep fp16 sums exactly representable in the threaded process group.
>
> Test Plan:
> ```bash
> CUDA_VISIBLE_DEVICES=1,2 python test/distributed/_composable/fsdp/test_fully_shard_comm.py TestFullyShardCollectiveOps -v
> spin quicklint -a
> ```


ghstack-source-id: 64abdb9
Pull-Request: #197459
weifengpy added a commit that referenced this pull request Sep 17, 2026
> AI-assisted draft prepared with Codex.
>
> `foreach_reduce` clears `unsharded_grads`, so cloning reference gradients afterward left the numerical comparison loops empty. Save the reference gradients before the call. Use `rank % 8` inputs to keep fp16 sums exactly representable in the threaded process group.
>
> Test Plan:
> ```bash
> CUDA_VISIBLE_DEVICES=1,2 python test/distributed/_composable/fsdp/test_fully_shard_comm.py TestFullyShardCollectiveOps -v
> spin quicklint -a
> ```


ghstack-source-id: 64abdb9
Pull-Request: #197459

@anshul-si anshul-si 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.

lgtm

@weifengpy

Copy link
Copy Markdown
Contributor Author

@pytorchmergebot merge

@pytorch-bot

pytorch-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown

This PR needs to be approved by an authorized maintainer before merge.

@anshul-si

Copy link
Copy Markdown
Contributor

@pytorchmergebot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Sep 17, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: Approvers from one of the following sets are needed:

  • Distributed (wconstab, mrshenli, pritamdamania87, zhaojuanmao, rohan-varma, ...)
  • Testing (Temporarily used for test refactoring) (fffrog)
  • Metamates (aditvenk, AmesingFlank, amirafzali, angelayi, aorenste, ...)
  • Greenlight Review Bot (pytorchgreenlight)
  • Core Reviewers (mruberry, lezcano, Skylion007, ngimel, peterbell10, ...)
  • Core Maintainers (soumith, gchanan, ezyang, malfet, albanD, ...)
Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

[ghstack-poisoned]
weifengpy added a commit that referenced this pull request Sep 17, 2026
> AI-assisted draft prepared with Codex.
>
> `foreach_reduce` clears `unsharded_grads`, so cloning reference gradients afterward left the numerical comparison loops empty. Save the reference gradients before the call. Use `rank % 8` inputs to keep fp16 sums exactly representable in the threaded process group.
>
> Test Plan:
> ```bash
> CUDA_VISIBLE_DEVICES=1,2 python test/distributed/_composable/fsdp/test_fully_shard_comm.py TestFullyShardCollectiveOps -v
> spin quicklint -a
> ```


ghstack-source-id: 7b665e5
Pull-Request: #197459
weifengpy added a commit that referenced this pull request Sep 17, 2026
> AI-assisted draft prepared with Codex.
>
> `foreach_reduce` clears `unsharded_grads`, so cloning reference gradients afterward left the numerical comparison loops empty. Save the reference gradients before the call. Use `rank % 8` inputs to keep fp16 sums exactly representable in the threaded process group.
>
> Test Plan:
> ```bash
> CUDA_VISIBLE_DEVICES=1,2 python test/distributed/_composable/fsdp/test_fully_shard_comm.py TestFullyShardCollectiveOps -v
> spin quicklint -a
> ```


ghstack-source-id: 7b665e5
Pull-Request: #197459
weifengpy added a commit that referenced this pull request Sep 17, 2026
> AI-assisted draft prepared with Codex.
>
> `foreach_reduce` clears `unsharded_grads`, so cloning reference gradients afterward left the numerical comparison loops empty. Save the reference gradients before the call. Use `rank % 8` inputs to keep fp16 sums exactly representable in the threaded process group.
>
> Test Plan:
> ```bash
> CUDA_VISIBLE_DEVICES=1,2 python test/distributed/_composable/fsdp/test_fully_shard_comm.py TestFullyShardCollectiveOps -v
> spin quicklint -a
> ```


ghstack-source-id: 7b665e5
Pull-Request: #197459
weifengpy added a commit that referenced this pull request Sep 17, 2026
> AI-assisted draft prepared with Codex.
>
> `foreach_reduce` clears `unsharded_grads`, so cloning reference gradients afterward left the numerical comparison loops empty. Save the reference gradients before the call. Use `rank % 8` inputs to keep fp16 sums exactly representable in the threaded process group.
>
> Test Plan:
> ```bash
> CUDA_VISIBLE_DEVICES=1,2 python test/distributed/_composable/fsdp/test_fully_shard_comm.py TestFullyShardCollectiveOps -v
> spin quicklint -a
> ```


ghstack-source-id: 7b665e5
Pull-Request: #197459
@Skylion007

Copy link
Copy Markdown
Collaborator

@pytorchbot merge

@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

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: trunk / macos-py3-arm64 / build

Details for Dev Infra team Raised by workflow job

@weifengpy

Copy link
Copy Markdown
Contributor Author

@pytorchmergebot merge

@weifengpy

Copy link
Copy Markdown
Contributor Author

@pytorchmergebot merge -i

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged while ignoring the following 1 checks: trunk / macos-py3-arm64 / build

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

pytorchmergebot pushed a commit that referenced this pull request Sep 19, 2026
pure code refactoring - no perf inidication, no new feature
the goal is to let user register custom Ag/RS copy fn in next PR for better Shard(1) perf
Pull Request resolved: #197372
Approved by: https://github.com/anijain2305, https://github.com/anshul-si
ghstack dependencies: #197459
@github-actions
github-actions Bot deleted the gh/weifengpy/184/head branch November 21, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants