Repository navigation
Conversation
Contributor
|
Just want to note that AMP + DDP could be slow. We may want to add warnings. |
fegin
approved these changes
Jun 16, 2025
| def maybe_enable_amp( | ||
| parallel_dims: ParallelDims, mixed_precision_param: str, device_type: torch.device | ||
| ) -> Generator[None, None, None]: | ||
| fsdp_enabled = parallel_dims.dp_shard_enabled or parallel_dims.cp_enabled |
Contributor
There was a problem hiding this comment.
Can we make this a property of ParallelDims? It seems that this is pretty commonly used.
Contributor
Author
@fegin |
Contributor
|
Oh, I meant slow if it is compared to FSDP's mixed precision. |
H-Huang
pushed a commit
to H-Huang/torchtitan
that referenced
this pull request
Jun 26, 2025
There have been several requests / questions / attempts around this feature. See - pytorch#630 - pytorch#700 - pytorch#1278 - pytorch#1293 Hence this PR, even though AMP does not provide full support when `fully_shard` is not used. My local testing shows: - under TP, with AMP the throughput drops. - under PP, there is not a way to wrap the forward pass only @H-Huang ; if the forward+backward is wrapped, the program hangs. - It works fine under DDP / single-device training. This PR also adds logging on if mixed precision is enabled, and if so under what mechanism, `fully_shard` or AMP.
wwwjn
pushed a commit
that referenced
this pull request
Jul 1, 2025
There have been several requests / questions / attempts around this feature. See - #630 - #700 - #1278 - #1293 Hence this PR, even though AMP does not provide full support when `fully_shard` is not used. My local testing shows: - under TP, with AMP the throughput drops. - under PP, there is not a way to wrap the forward pass only @H-Huang ; if the forward+backward is wrapped, the program hangs. - It works fine under DDP / single-device training. This PR also adds logging on if mixed precision is enabled, and if so under what mechanism, `fully_shard` or AMP.
xrsrke
pushed a commit
to NousResearch/torchtitan
that referenced
this pull request
Feb 13, 2026
There have been several requests / questions / attempts around this feature. See - pytorch#630 - pytorch#700 - pytorch#1278 - pytorch#1293 Hence this PR, even though AMP does not provide full support when `fully_shard` is not used. My local testing shows: - under TP, with AMP the throughput drops. - under PP, there is not a way to wrap the forward pass only @H-Huang ; if the forward+backward is wrapped, the program hangs. - It works fine under DDP / single-device training. This PR also adds logging on if mixed precision is enabled, and if so under what mechanism, `fully_shard` or AMP.
xrsrke
pushed a commit
to NousResearch/torchtitan
that referenced
this pull request
Feb 25, 2026
There have been several requests / questions / attempts around this feature. See - pytorch#630 - pytorch#700 - pytorch#1278 - pytorch#1293 Hence this PR, even though AMP does not provide full support when `fully_shard` is not used. My local testing shows: - under TP, with AMP the throughput drops. - under PP, there is not a way to wrap the forward pass only @H-Huang ; if the forward+backward is wrapped, the program hangs. - It works fine under DDP / single-device training. This PR also adds logging on if mixed precision is enabled, and if so under what mechanism, `fully_shard` or AMP.
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.


There have been several requests / questions / attempts around this feature. See
autocastneeded with FSDP2? #700torch.float32as the default dtype when training? #1278Hence this PR, even though AMP does not provide full support when
fully_shardis not used.My local testing shows:
This PR also adds logging on if mixed precision is enabled, and if so under what mechanism,
fully_shardor AMP.