Skip to content

[TEMPORARY] Use 8-GPU MI350 runner as default ROCm runner in workflow configuration - #2

Merged
akashveramd merged 1 commit into
akashveramd:av_fix_features_loss_comparefrom
jithunnair-amd:patch-1
Apr 7, 2026
Merged

akashveramd merged 1 commit into
akashveramd:av_fix_features_loss_comparefrom
jithunnair-amd:patch-1

Conversation

@jithunnair-amd

Copy link
Copy Markdown
Collaborator

No description provided.

@akashveramd
akashveramd merged commit 324d4cc into akashveramd:av_fix_features_loss_compare Apr 7, 2026
akashveramd pushed a commit that referenced this pull request Apr 8, 2026
akashveramd pushed a commit that referenced this pull request Apr 20, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants