Repository navigation
[DeepSeek] all-to-all-v kernel writes out output_splits - #994
Merged
Merged
Conversation
[ghstack-poisoned]
…total received" cc yifuwang ngimel [ghstack-poisoned]
This PR contains three changes:
1. all-to-all-v kernel writes out `output_splits` instead of total received
(so that we can use the split info as `input_splits` in backward)
ghstack-source-id: 8e0dda4
Pull Request resolved: #941
2. Add backward for all_to_all_v
ghstack-source-id: 8e0dda4
Pull Request resolved: #943
3. [DeepSeek] Enable backward
Test
```
$ torchrun --standalone --nproc-per-node 4 run.py
...
logits: torch.Size([2, 128, 102400])
logits: torch.Size([2, 128, 102400])
loss=tensor(510.3908, device='cuda:2', grad_fn=<MeanBackward0>)
loss=tensor(506.3376, device='cuda:3', grad_fn=<MeanBackward0>)
Backward done
Backward done
Backward done
Backward done
```
cc yifuwang ngimel
[ghstack-poisoned]
This PR contains three changes:
1. all-to-all-v kernel writes out `output_splits` instead of total received
(so that we can use the split info as `input_splits` in backward)
ghstack-source-id: 8e0dda4
Pull Request resolved: #941
2. Add backward for all_to_all_v
ghstack-source-id: 8e0dda4
Pull Request resolved: #943
3. [DeepSeek] Enable backward
Test
```
$ torchrun --standalone --nproc-per-node 4 run.py
...
logits: torch.Size([2, 128, 102400])
logits: torch.Size([2, 128, 102400])
loss=tensor(510.3908, device='cuda:2', grad_fn=<MeanBackward0>)
loss=tensor(506.3376, device='cuda:3', grad_fn=<MeanBackward0>)
Backward done
Backward done
Backward done
Backward done
```
cc yifuwang ngimel
[ghstack-poisoned]
This PR contains three changes:
1. all-to-all-v kernel writes out `output_splits` instead of total received
(so that we can use the split info as `input_splits` in backward)
ghstack-source-id: 8e0dda4
Pull Request resolved: #941
2. Add backward for all_to_all_v
ghstack-source-id: 8e0dda4
Pull Request resolved: #943
3. [DeepSeek] Enable backward
Test
```
$ torchrun --standalone --nproc-per-node 4 run.py
...
logits: torch.Size([2, 128, 102400])
logits: torch.Size([2, 128, 102400])
loss=tensor(510.3908, device='cuda:2', grad_fn=<MeanBackward0>)
loss=tensor(506.3376, device='cuda:3', grad_fn=<MeanBackward0>)
Backward done
Backward done
Backward done
Backward done
```
cc yifuwang ngimel
[ghstack-poisoned]
This PR contains three changes:
1. all-to-all-v kernel writes out `output_splits` instead of total received
(so that we can use the split info as `input_splits` in backward)
ghstack-source-id: 8e0dda4
Pull Request resolved: #941
2. Add backward for all_to_all_v
ghstack-source-id: 8e0dda4
Pull Request resolved: #943
3. [DeepSeek] Enable backward
Test
```
$ torchrun --standalone --nproc-per-node 4 run.py
...
logits: torch.Size([2, 128, 102400])
logits: torch.Size([2, 128, 102400])
loss=tensor(510.3908, device='cuda:2', grad_fn=<MeanBackward0>)
loss=tensor(506.3376, device='cuda:3', grad_fn=<MeanBackward0>)
Backward done
Backward done
Backward done
Backward done
```
cc yifuwang ngimel
[ghstack-poisoned]
This PR contains three changes:
1. all-to-all-v kernel writes out `output_splits` instead of total received
(so that we can use the split info as `input_splits` in backward)
ghstack-source-id: 8e0dda4
Pull Request resolved: #941
2. Add backward for all_to_all_v
ghstack-source-id: 8e0dda4
Pull Request resolved: #943
3. [DeepSeek] Enable backward
Test
```
$ torchrun --standalone --nproc-per-node 4 run.py
...
logits: torch.Size([2, 128, 102400])
logits: torch.Size([2, 128, 102400])
loss=tensor(510.3908, device='cuda:2', grad_fn=<MeanBackward0>)
loss=tensor(506.3376, device='cuda:3', grad_fn=<MeanBackward0>)
Backward done
Backward done
Backward done
Backward done
```
cc yifuwang ngimel
[ghstack-poisoned]
MaxiBoether
pushed a commit
to eth-easl/torchtitan-mixtera
that referenced
this pull request
Apr 17, 2025
Reland of pytorch#941 since `ghstack land <PR>` does not work now. Original PR description: This PR contains three changes: 1. all-to-all-v kernel writes out `output_splits` instead of total received (so that we can use the split info as `input_splits` in the second shuffle or backward) 2. Add backward for all_to_all_v (WIP) 3. Move parts of the model out of `no_grad()` Test ``` $ torchrun --standalone --nproc-per-node 4 run.py ... logits: torch.Size([2, 128, 102400]) logits: torch.Size([2, 128, 102400]) loss=tensor(510.3908, device='cuda:2', grad_fn=<MeanBackward0>) loss=tensor(506.3376, device='cuda:3', grad_fn=<MeanBackward0>) Backward done Backward done Backward done Backward done ```
xrsrke
pushed a commit
to NousResearch/torchtitan
that referenced
this pull request
Feb 13, 2026
Reland of pytorch#941 since `ghstack land <PR>` does not work now. Original PR description: This PR contains three changes: 1. all-to-all-v kernel writes out `output_splits` instead of total received (so that we can use the split info as `input_splits` in the second shuffle or backward) 2. Add backward for all_to_all_v (WIP) 3. Move parts of the model out of `no_grad()` Test ``` $ torchrun --standalone --nproc-per-node 4 run.py ... logits: torch.Size([2, 128, 102400]) logits: torch.Size([2, 128, 102400]) loss=tensor(510.3908, device='cuda:2', grad_fn=<MeanBackward0>) loss=tensor(506.3376, device='cuda:3', grad_fn=<MeanBackward0>) Backward done Backward done Backward done Backward done ```
xrsrke
pushed a commit
to NousResearch/torchtitan
that referenced
this pull request
Feb 25, 2026
Reland of pytorch#941 since `ghstack land <PR>` does not work now. Original PR description: This PR contains three changes: 1. all-to-all-v kernel writes out `output_splits` instead of total received (so that we can use the split info as `input_splits` in the second shuffle or backward) 2. Add backward for all_to_all_v (WIP) 3. Move parts of the model out of `no_grad()` Test ``` $ torchrun --standalone --nproc-per-node 4 run.py ... logits: torch.Size([2, 128, 102400]) logits: torch.Size([2, 128, 102400]) loss=tensor(510.3908, device='cuda:2', grad_fn=<MeanBackward0>) loss=tensor(506.3376, device='cuda:3', grad_fn=<MeanBackward0>) Backward done Backward done Backward done Backward done ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reland of #941 since
ghstack land <PR>does not work now.Original PR description:
This PR contains three changes:
all-to-all-v kernel writes out
output_splitsinstead of total received(so that we can use the split info as
input_splitsin the second shuffle or backward)Add backward for all_to_all_v (WIP)
Move parts of the model out of
no_grad()Test