Repository navigation
[TEMPORARY] Use 8-GPU MI350 runner as default ROCm runner in workflow configuration - #2
Merged
akashveramd merged 1 commit intoApr 7, 2026
Conversation
akashveramd
pushed a commit
that referenced
this pull request
Sep 15, 2026
`TorchFTOptimizersContainer` [wraps itself](https://github.com/pytorch/torchtitan/blob/d398a8fb9bc8a33ca404217a846cff65feab92f0/torchtitan/experiments/torchft/optimizer.py#L45) with `torchft.Optimizer`. On accepted steps, the wrapper [calls back into the same container](https://github.com/meta-pytorch/torchft/blob/90d7f68961e7c0bcd4278f7ebba83b5cd876c099/torchft/optim.py#L53-L56), repeatedly triggering PyTorch's [pre/post hooks](https://github.com/pytorch/pytorch/blob/e3f5bf0b18585511e6cd7d7a574ebf82f465e5ae/torch/optim/optimizer.py#L508-L540). When the base method is already wrapped, [super().step()](https://github.com/pytorch/torchtitan/blob/d398a8fb9bc8a33ca404217a846cff65feab92f0/torchtitan/experiments/torchft/optimizer.py#L76) adds a third invocation, causing redundant blocking [MoE load-balancing collectives](https://github.com/pytorch/torchtitan/blob/d398a8fb9bc8a33ca404217a846cff65feab92f0/torchtitan/components/optimizer/optimizer.py#L488-L493). Both diagrams show an accepted step. All hooks shown belong to the same FT container. Before, with the base `step()` already wrapped: ```text Trainer.train_step() `-- TorchFTOptimizersContainer.step() |-- pre_hook #1 |-- OptimizerWrapper.step() | |-- manager.should_commit() -> True | `-- TorchFTOptimizersContainer.step() (same container) | |-- pre_hook #2 | |-- super().step() | | |-- pre_hook #3 | | |-- optimizer update loop (once) | | `-- post_hook #1 | `-- post_hook #2 `-- post_hook #3 ``` <img width="1136" height="896" alt="screenshot_before" src="https://github.com/user-attachments/assets/b843dac7-2e4d-420c-935b-a9d15a0ba930" /> Keep a single public `step()` hook boundary, move optimizer updates into `_step_optimizers()`, and call the FT Manager directly. This also removes the temporary dispatch flag, which could remain disabled after an exception. After: ```text Trainer.train_step() `-- OptimizersContainer.step() (inherited public entry) |-- pre_hook #1 |-- TorchFTOptimizersContainer._step_optimizers() | |-- manager.should_commit() -> True | `-- OptimizersContainer._step_optimizers() | `-- optimizer update loop (once) `-- post_hook #1 ``` Validation: - Two-rank Gloo regression with real MoE hooks and collectives: three load synchronizations per rank before the change, one afterward; Manager decisions are mocked. - CPU validation: **48 passed, 1 failed** [torchtitan-test.log](https://github.com/user-attachments/files/32060730/torchtitan-test.log) > The single failure is a pre-existing LR restoration issue: restored optimizers use `[0.05, 0.1]` instead of `[0.0875, 0.175]`, producing a different next update. The same failure reproduces before and after this change. --------- Co-authored-by: jojoinfra <[email protected]>
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.
No description provided.