Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/197204
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 2 PendingAs of commit 4e4d4e2 with merge base 381cc3e ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
> AI-assisted draft prepared with Codex. > > FSDP2 currently uses temporary buffers and separate `cat` reorders for nonzero-dimension shards. For a contiguous `[N, F, D]` parameter with `Shard(1)`, this change passes N contiguous `[F, D]` views to the existing native copy kernels, folding the reorder into all-gather copy-out and reduce-scatter packing without a new device kernel. > > The same decomposition supports `Shard(k)` by flattening dimensions before k. It preserves the original parameter and gradient offsets, mixed-dtype all-gather byte offsets, and version counters. Custom all-gather layouts, post-forward shards, and noncontiguous gradients retain their existing copy paths. > > Test Plan: > ```bash > spin quicklint -a > git diff --check > ``` > Both checks passed. > > - Added two-rank training tests for N=1,2,3,5 with Shard(1), Shard(2), padded Shard(0), and FP32/BF16 inputs with FP32 reduction, plus mixed-dtype inference coverage. > - Build and runtime tests are pending. Large-prefix performance remains to be measured because copy descriptor overhead grows with N. ghstack-source-id: 167a089 Pull-Request: #197204
> AI-assisted draft prepared with Codex. > > FSDP2 currently uses temporary buffers and separate `cat` reorders for nonzero-dimension shards. For a contiguous `[N, F, D]` parameter with `Shard(1)`, this change passes N contiguous `[F, D]` views to the existing native copy kernels, folding the reorder into all-gather copy-out and reduce-scatter packing without a new device kernel. > > The same decomposition supports `Shard(k)` by flattening dimensions before k. It preserves the original parameter and gradient offsets, mixed-dtype all-gather byte offsets, and version counters. Custom all-gather layouts, post-forward shards, and noncontiguous gradients retain their existing copy paths. > > Test Plan: > ```bash > spin quicklint -a > git diff --check > ``` > Both checks passed. > > - Added two-rank training tests for N=1,2,3,5 with Shard(1), Shard(2), padded Shard(0), and FP32/BF16 inputs with FP32 reduction, plus mixed-dtype inference coverage. > - Build and runtime tests are pending. Large-prefix performance remains to be measured because copy descriptor overhead grows with N. ghstack-source-id: 74f4015 Pull-Request: #197204
> AI-assisted draft prepared with Codex. > > FSDP2 currently uses temporary buffers and separate `cat` reorders for nonzero-dimension shards. For a contiguous `[N, F, D]` parameter with `Shard(1)`, this change passes N contiguous `[F, D]` views to the existing native copy kernels, folding the reorder into all-gather copy-out and reduce-scatter packing without a new device kernel. > > The same decomposition supports `Shard(k)` by flattening dimensions before k. It preserves the original parameter and gradient offsets, mixed-dtype all-gather byte offsets, and version counters. Custom all-gather layouts, post-forward shards, and noncontiguous gradients retain their existing copy paths. > > Test Plan: > ```bash > spin quicklint -a > git diff --check > ``` > Both checks passed. > > - Added two-rank training tests for N=1,2,3,5 with Shard(1), Shard(2), padded Shard(0), and FP32/BF16 inputs with FP32 reduction, plus mixed-dtype inference coverage. > - Build and runtime tests are pending. Large-prefix performance remains to be measured because copy descriptor overhead grows with N. ghstack-source-id: 6a04985 Pull-Request: #197204
> AI-assisted draft prepared with Codex. > > FSDP2 currently uses temporary buffers and separate `cat` reorders for nonzero-dimension shards. For a contiguous `[N, F, D]` parameter with `Shard(1)`, this change passes N contiguous `[F, D]` views to the existing native copy kernels, folding the reorder into all-gather copy-out and reduce-scatter packing without a new device kernel. > > The same decomposition supports `Shard(k)` by flattening dimensions before k. It preserves the original parameter and gradient offsets, mixed-dtype all-gather byte offsets, and version counters. Custom all-gather layouts, post-forward shards, and noncontiguous gradients retain their existing copy paths. > > Test Plan: > ```bash > spin quicklint -a > git diff --check > ``` > Both checks passed. > > - Added two-rank training tests for N=1,2,3,5 with Shard(1), Shard(2), padded Shard(0), and FP32/BF16 inputs with FP32 reduction, plus mixed-dtype inference coverage. > - Build and runtime tests are pending. Large-prefix performance remains to be measured because copy descriptor overhead grows with N. ghstack-source-id: ed5fdbe Pull-Request: #197204
> AI-assisted draft prepared with Codex. > > Add optional implementations of the copy-preparation hooks from the parent PR. For a contiguous `[N, F, D]` parameter with `Shard(1)`, they pass N contiguous views to the existing native copy kernels, avoiding separate all-gather and reduce-scatter reorder copies. Flattening the prefix generalizes this to `Shard(k)`. > > The default remains reorder preparation. Users opt in by registering the views hooks independently for all-gather copy-out and reduce-scatter copy-in. Unsupported layouts retain their existing paths. All-gather adjusts split sizes for expanded destinations, including mixed-dtype byte offsets, and skips inference tensors when preserving fallback reorder version counters. > > Test Plan: > ```bash > CUDA_VISIBLE_DEVICES=1,2 python test/distributed/_composable/fsdp/test_fully_shard_comm.py TestFullyShardNonzeroDimCopy -v > spin quicklint -a > git diff --check > ``` > The two test methods cover N=1,2,3,5, Shard(1), Shard(2), padded Shard(0), FP32/BF16 training, and mixed-dtype inference, with default and explicitly registered views callbacks. > Both test methods and lint passed. ghstack-source-id: e4bad30 Pull-Request: #197204
> AI-assisted draft prepared with Codex. > > Add optional implementations of the copy-preparation hooks from the parent PR. For a contiguous `[N, F, D]` parameter with `Shard(1)`, they pass N contiguous views to the existing native copy kernels, avoiding separate all-gather and reduce-scatter reorder copies. Flattening the prefix generalizes this to `Shard(k)`. > > The default remains reorder preparation. Users opt in by registering the views hooks independently for all-gather copy-out and reduce-scatter copy-in. Unsupported layouts retain their existing paths. All-gather adjusts split sizes for expanded destinations, including mixed-dtype byte offsets, and skips inference tensors when preserving fallback reorder version counters. > > Test Plan: > ```bash > CUDA_VISIBLE_DEVICES=1,2 python test/distributed/_composable/fsdp/test_fully_shard_comm.py TestFullyShardNonzeroDimCopy -v > spin quicklint -a > git diff --check > ``` > The two test methods cover N=1,2,3,5, Shard(1), Shard(2), padded Shard(0), FP32/BF16 training, and mixed-dtype inference, with default and explicitly registered views callbacks. > Both test methods and lint passed. ghstack-source-id: 5c74742 Pull-Request: #197204
> AI-assisted draft prepared with Codex. > > Add independent setters for all-gather output preparation and reduce-scatter input preparation, with recursive registration by default. Store the selected callbacks on each FSDP parameter group and pass them to the collective implementations. The default callbacks use the reorder helpers extracted by the parent PR. > > Add optional contiguous-view callbacks. For a contiguous `[N, F, D]` parameter with `Shard(1)`, they pass N contiguous views to the existing native copy kernels, avoiding separate all-gather and reduce-scatter reorder copies. Flattening the prefix generalizes this to `Shard(k)`. > > Users opt in by registering the views callbacks independently. Unsupported layouts retain their existing paths. All-gather adjusts split sizes for expanded destinations, including mixed-dtype byte offsets, and skips inference tensors when preserving fallback reorder version counters. > > The registration test covers recursive and local selection, independent callbacks, execution, and restoring defaults. Numerical tests cover training and inference with default and views callbacks. Update the existing shared-communication-context test wrapper to forward the new callback keyword argument. > > Test Plan: > ```bash > CUDA_VISIBLE_DEVICES=1,2 python test/distributed/_composable/fsdp/test_fully_shard_comm.py TestFullyShardInputOutputFns TestFullyShardNonzeroDimCopy -v > CUDA_VISIBLE_DEVICES=3,4 python test/distributed/_composable/fsdp/test_fully_shard_training.py TestFullyShardShareCommContext.test_share_comm_context -v > spin quicklint -a > git diff --check > ``` > All four targeted test methods and lint passed. Numerical cases cover N=1,2,3,5, Shard(1), Shard(2), padded Shard(0), FP32/BF16 training, and mixed-dtype inference. ghstack-source-id: 5c74742 Pull-Request: #197204
> AI-assisted draft prepared with Codex. > > Add independent setters for all-gather output preparation and reduce-scatter input preparation, with recursive registration by default. Store the selected callbacks on each FSDP parameter group and pass them to the collective implementations. The default callbacks use the reorder helpers extracted by the parent PR. > > Add optional contiguous-view callbacks. For a contiguous `[N, F, D]` parameter with `Shard(1)`, they pass N contiguous views to the existing native copy kernels, avoiding separate all-gather and reduce-scatter reorder copies. Flattening the prefix generalizes this to `Shard(k)`. > > Users opt in by registering the views callbacks independently. Unsupported layouts retain their existing paths. All-gather adjusts split sizes for expanded destinations, including mixed-dtype byte offsets, and skips inference tensors when preserving fallback reorder version counters. > > The registration test covers recursive and local selection, independent callbacks, execution, and restoring defaults. Numerical tests cover training and inference with default and views callbacks. Update the existing shared-communication-context test wrapper to forward the new callback keyword argument. > > Test Plan: > ```bash > CUDA_VISIBLE_DEVICES=1,2 python test/distributed/_composable/fsdp/test_fully_shard_comm.py TestFullyShardInputOutputFns TestFullyShardNonzeroDimCopy -v > CUDA_VISIBLE_DEVICES=3,4 python test/distributed/_composable/fsdp/test_fully_shard_training.py TestFullyShardShareCommContext.test_share_comm_context -v > spin quicklint -a > git diff --check > ``` > All four targeted test methods and lint passed. Numerical cases cover N=1,2,3,5, Shard(1), Shard(2), padded Shard(0), FP32/BF16 training, and mixed-dtype inference. ghstack-source-id: c0c5eb7 Pull-Request: #197204
> AI-assisted draft prepared with Codex. > > Add independent setters for all-gather output preparation and reduce-scatter input preparation, with recursive registration by default. Store the selected callbacks on each FSDP parameter group and pass them to the collective implementations. The default callbacks use the reorder helpers extracted by the parent PR. > > Add optional contiguous-view callbacks. For a contiguous `[N, F, D]` parameter with `Shard(1)`, they pass N contiguous views to the existing native copy kernels, avoiding separate all-gather and reduce-scatter reorder copies. Flattening the prefix generalizes this to `Shard(k)`. > > Users opt in by registering the views callbacks independently. Unsupported layouts retain their existing paths. All-gather adjusts split sizes for expanded destinations, including mixed-dtype byte offsets, and skips inference tensors when preserving fallback reorder version counters. > > The registration test covers recursive and local selection, independent callbacks, execution, and restoring defaults. Numerical tests cover training and inference with default and views callbacks. Update the existing shared-communication-context test wrapper to forward the new callback keyword argument. > > Test Plan: > ```bash > CUDA_VISIBLE_DEVICES=1,2 python test/distributed/_composable/fsdp/test_fully_shard_comm.py TestFullyShardInputOutputFns TestFullyShardNonzeroDimCopy -v > CUDA_VISIBLE_DEVICES=3,4 python test/distributed/_composable/fsdp/test_fully_shard_training.py TestFullyShardShareCommContext.test_share_comm_context -v > spin quicklint -a > git diff --check > ``` > All four targeted test methods and lint passed. Numerical cases cover N=1,2,3,5, Shard(1), Shard(2), padded Shard(0), FP32/BF16 training, and mixed-dtype inference. ghstack-source-id: d5af010 Pull-Request: #197204
> AI-assisted draft prepared with Codex. > > Add independent setters for all-gather output preparation and reduce-scatter input preparation, with recursive registration by default. Store the selected callbacks on each FSDP parameter group and pass them to the collective implementations. The default callbacks use the reorder helpers extracted by the parent PR. > > Add optional contiguous-view callbacks. For a contiguous `[N, F, D]` parameter with `Shard(1)`, they pass N contiguous views to the existing native copy kernels, avoiding separate all-gather and reduce-scatter reorder copies. Flattening the prefix generalizes this to `Shard(k)`. > > Users opt in by registering the views callbacks independently. Unsupported layouts retain their existing paths. All-gather adjusts split sizes for expanded destinations, including mixed-dtype byte offsets, and skips inference tensors when preserving fallback reorder version counters. > > The registration test covers recursive and local selection, independent callbacks, execution, and restoring defaults. Numerical tests cover training and inference with default and views callbacks. Update the existing shared-communication-context test wrapper to forward the new callback keyword argument. > > Test Plan: > ```bash > CUDA_VISIBLE_DEVICES=1,2 python test/distributed/_composable/fsdp/test_fully_shard_comm.py TestFullyShardInputOutputFns TestFullyShardNonzeroDimCopy -v > CUDA_VISIBLE_DEVICES=3,4 python test/distributed/_composable/fsdp/test_fully_shard_training.py TestFullyShardShareCommContext.test_share_comm_context -v > spin quicklint -a > git diff --check > ``` > All four targeted test methods and lint passed. Numerical cases cover N=1,2,3,5, Shard(1), Shard(2), padded Shard(0), FP32/BF16 training, and mixed-dtype inference. ghstack-source-id: a880502 Pull-Request: #197204
> AI-assisted draft prepared with Codex. > > Add independent setters for all-gather output preparation and reduce-scatter input preparation, with recursive registration by default. Store the selected callbacks on each FSDP parameter group and pass them to the collective implementations. The default callbacks use the reorder helpers extracted by the parent PR. > > Add optional contiguous-view callbacks. For a contiguous `[N, F, D]` parameter with `Shard(1)`, they pass N contiguous views to the existing native copy kernels, avoiding separate all-gather and reduce-scatter reorder copies. Flattening the prefix generalizes this to `Shard(k)`. > > Users opt in by registering the views callbacks independently. Unsupported layouts retain their existing paths. All-gather adjusts split sizes for expanded destinations, including mixed-dtype byte offsets, and skips inference tensors when preserving fallback reorder version counters. > > The registration test covers recursive and local selection, independent callbacks, execution, and restoring defaults. Numerical tests cover training and inference with default and views callbacks. Update the existing shared-communication-context test wrapper to forward the new callback keyword argument. > > Test Plan: > ```bash > CUDA_VISIBLE_DEVICES=1,2 python test/distributed/_composable/fsdp/test_fully_shard_comm.py TestFullyShardInputOutputFns TestFullyShardNonzeroDimCopy -v > CUDA_VISIBLE_DEVICES=3,4 python test/distributed/_composable/fsdp/test_fully_shard_training.py TestFullyShardShareCommContext.test_share_comm_context -v > spin quicklint -a > git diff --check > ``` > All four targeted test methods and lint passed. Numerical cases cover N=1,2,3,5, Shard(1), Shard(2), padded Shard(0), FP32/BF16 training, and mixed-dtype inference. ghstack-source-id: a880502 Pull-Request: #197204
Merge startedYour 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 |
Merge failedReason: Command Details for Dev Infra teamRaised by workflow job |
|
@pytorchmergebot merge |
Merge startedYour 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 |
Merge failedReason: New commits were pushed while merging. Please rerun the merge command. Details for Dev Infra teamRaised by workflow job |
|
@pytorchmergebot merge |
Merge startedYour 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 |
Stack from ghstack (oldest at bottom):
This PR was authored with an AI assistant (Claude Code). The description below is AI-generated and is pending author review.