Skip to content

[CP] Fix incorrect indentation - #1880

Merged
fegin merged 1 commit into
mainfrom
chienchin/cp_fix
Oct 15, 2025
Merged

fegin merged 1 commit into
mainfrom
chienchin/cp_fix

Conversation

@fegin

@fegin fegin commented Oct 15, 2025

Copy link
Copy Markdown
Contributor

Introduced by #1776.

Verified with the comment:

CONFIG_FILE="./torchtitan/models/llama3/train_configs/debug_model.toml" ./run_train.sh   --training.steps=10 --parallelism.context_parallel_degree=8

w/o this PR

[rank4]:[titan] 2025-10-14 23:10:44,306 - root - INFO - step:  1  loss:  8.0385  grad_norm:  1.3444  memory:  1.21GiB(1.27%)  tps: 2,904  tflops: 0.21  mfu: 0.02%
[rank4]:[titan] 2025-10-14 23:10:44,306 - root - INFO - Synchronizing and adjusting timeout for all ProcessGroups to 0:01:40
[rank4]:[titan] 2025-10-14 23:10:44,347 - root - INFO - step:  2  loss:  7.6989  grad_norm:  1.4401  memory:  1.34GiB(1.41%)  tps: 49,366  tflops: 3.53  mfu: 0.36%
[rank4]:[titan] 2025-10-14 23:10:44,388 - root - INFO - step:  3  loss:  7.0687  grad_norm:  1.8302  memory:  1.34GiB(1.41%)  tps: 51,400  tflops: 3.68  mfu: 0.37%
[rank4]:[titan] 2025-10-14 23:10:44,425 - root - INFO - step:  4  loss:  6.2672  grad_norm:  2.2684  memory:  1.34GiB(1.41%)  tps: 55,749  tflops: 3.99  mfu: 0.40%
[rank4]:[titan] 2025-10-14 23:10:44,465 - root - INFO - step:  5  loss:  5.3015  grad_norm:  2.5508  memory:  1.34GiB(1.41%)  tps: 50,835  tflops: 3.64  mfu: 0.37%
[rank4]:[titan] 2025-10-14 23:10:44,522 - root - INFO - step:  6  loss:  4.7779  grad_norm:  2.4103  memory:  1.34GiB(1.41%)  tps: 36,188  tflops: 2.59  mfu: 0.26%
[rank4]:[titan] 2025-10-14 23:10:44,573 - root - INFO - step:  7  loss:  4.4823  grad_norm:  2.2675  memory:  1.34GiB(1.41%)  tps: 41,167  tflops: 2.95  mfu: 0.30%
[rank4]:[titan] 2025-10-14 23:10:44,618 - root - INFO - step:  8  loss:  4.3291  grad_norm:  1.9877  memory:  1.34GiB(1.41%)  tps: 45,962  tflops: 3.29  mfu: 0.33%
[rank4]:[titan] 2025-10-14 23:10:44,656 - root - INFO - step:  9  loss:  4.7022  grad_norm:  1.5639  memory:  1.34GiB(1.41%)  tps: 53,689  tflops: 3.84  mfu: 0.39%
[rank4]:[titan] 2025-10-14 23:10:44,695 - root - INFO - step: 10  loss:  4.1905  grad_norm:  1.8200  memory:  1.34GiB(1.41%)  tps: 52,967  tflops: 3.79  mfu: 0.38%

w/ this PR

[rank4]:[titan] 2025-10-14 23:09:32,084 - root - INFO - step:  1  loss:  8.1003  grad_norm:  1.4468  memory:  0.23GiB(0.24%)  tps: 150  tflops: 0.01  mfu: 0.00%
[rank4]:[titan] 2025-10-14 23:09:32,085 - root - INFO - Synchronizing and adjusting timeout for all ProcessGroups to 0:01:40
[rank4]:[titan] 2025-10-14 23:09:32,151 - root - INFO - step:  2  loss:  7.7710  grad_norm:  1.5711  memory:  0.25GiB(0.26%)  tps: 30,879  tflops: 2.21  mfu: 0.22%
[rank4]:[titan] 2025-10-14 23:09:32,218 - root - INFO - step:  3  loss:  7.0456  grad_norm:  1.9929  memory:  0.25GiB(0.26%)  tps: 30,642  tflops: 2.19  mfu: 0.22%
[rank4]:[titan] 2025-10-14 23:09:32,283 - root - INFO - step:  4  loss:  6.1601  grad_norm:  2.3669  memory:  0.25GiB(0.26%)  tps: 31,723  tflops: 2.27  mfu: 0.23%
[rank4]:[titan] 2025-10-14 23:09:32,349 - root - INFO - step:  5  loss:  5.2561  grad_norm:  2.5374  memory:  0.25GiB(0.26%)  tps: 31,047  tflops: 2.22  mfu: 0.22%
[rank4]:[titan] 2025-10-14 23:09:32,420 - root - INFO - step:  6  loss:  4.8109  grad_norm:  2.8868  memory:  0.25GiB(0.26%)  tps: 29,067  tflops: 2.08  mfu: 0.21%
[rank4]:[titan] 2025-10-14 23:09:32,488 - root - INFO - step:  7  loss:  4.4534  grad_norm:  2.4835  memory:  0.25GiB(0.26%)  tps: 30,383  tflops: 2.17  mfu: 0.22%
[rank4]:[titan] 2025-10-14 23:09:32,554 - root - INFO - step:  8  loss:  4.2613  grad_norm:  2.1554  memory:  0.25GiB(0.26%)  tps: 31,078  tflops: 2.22  mfu: 0.22%
[rank4]:[titan] 2025-10-14 23:09:32,619 - root - INFO - step:  9  loss:  4.6215  grad_norm:  1.7431  memory:  0.25GiB(0.26%)  tps: 31,814  tflops: 2.28  mfu: 0.23%
[rank4]:[titan] 2025-10-14 23:09:32,687 - root - INFO - step: 10  loss:  4.0993  grad_norm:  2.0867  memory:  0.25GiB(0.26%)  tps: 30,272  tflops: 2.17  mfu: 0.22%

Introduced by #1776.

Verified with the comment:

```
CONFIG_FILE="./torchtitan/models/llama3/train_configs/debug_model.toml" ./run_train.sh   --training.steps=10 --parallelism.context_parallel_degree=8
```
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 15, 2025
torch._dynamo.utils.maybe_enable_compiled_autograd(True)
)

if cp_context:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you help answer #1807 (comment)
as it is related to the PR which you removed MATH backend treatment for CP

@fegin
fegin merged commit 92ed8b3 into main Oct 15, 2025
@tianyu-l
tianyu-l deleted the chienchin/cp_fix branch October 15, 2025 22:50
xrsrke pushed a commit to NousResearch/torchtitan that referenced this pull request Feb 13, 2026
Introduced by pytorch#1776.

Verified with the comment:

```
CONFIG_FILE="./torchtitan/models/llama3/train_configs/debug_model.toml" ./run_train.sh   --training.steps=10 --parallelism.context_parallel_degree=8
```
w/o this PR
```
[rank4]:[titan] 2025-10-14 23:10:44,306 - root - INFO - step:  1  loss:  8.0385  grad_norm:  1.3444  memory:  1.21GiB(1.27%)  tps: 2,904  tflops: 0.21  mfu: 0.02%
[rank4]:[titan] 2025-10-14 23:10:44,306 - root - INFO - Synchronizing and adjusting timeout for all ProcessGroups to 0:01:40
[rank4]:[titan] 2025-10-14 23:10:44,347 - root - INFO - step:  2  loss:  7.6989  grad_norm:  1.4401  memory:  1.34GiB(1.41%)  tps: 49,366  tflops: 3.53  mfu: 0.36%
[rank4]:[titan] 2025-10-14 23:10:44,388 - root - INFO - step:  3  loss:  7.0687  grad_norm:  1.8302  memory:  1.34GiB(1.41%)  tps: 51,400  tflops: 3.68  mfu: 0.37%
[rank4]:[titan] 2025-10-14 23:10:44,425 - root - INFO - step:  4  loss:  6.2672  grad_norm:  2.2684  memory:  1.34GiB(1.41%)  tps: 55,749  tflops: 3.99  mfu: 0.40%
[rank4]:[titan] 2025-10-14 23:10:44,465 - root - INFO - step:  5  loss:  5.3015  grad_norm:  2.5508  memory:  1.34GiB(1.41%)  tps: 50,835  tflops: 3.64  mfu: 0.37%
[rank4]:[titan] 2025-10-14 23:10:44,522 - root - INFO - step:  6  loss:  4.7779  grad_norm:  2.4103  memory:  1.34GiB(1.41%)  tps: 36,188  tflops: 2.59  mfu: 0.26%
[rank4]:[titan] 2025-10-14 23:10:44,573 - root - INFO - step:  7  loss:  4.4823  grad_norm:  2.2675  memory:  1.34GiB(1.41%)  tps: 41,167  tflops: 2.95  mfu: 0.30%
[rank4]:[titan] 2025-10-14 23:10:44,618 - root - INFO - step:  8  loss:  4.3291  grad_norm:  1.9877  memory:  1.34GiB(1.41%)  tps: 45,962  tflops: 3.29  mfu: 0.33%
[rank4]:[titan] 2025-10-14 23:10:44,656 - root - INFO - step:  9  loss:  4.7022  grad_norm:  1.5639  memory:  1.34GiB(1.41%)  tps: 53,689  tflops: 3.84  mfu: 0.39%
[rank4]:[titan] 2025-10-14 23:10:44,695 - root - INFO - step: 10  loss:  4.1905  grad_norm:  1.8200  memory:  1.34GiB(1.41%)  tps: 52,967  tflops: 3.79  mfu: 0.38%
```

w/ this PR
```
[rank4]:[titan] 2025-10-14 23:09:32,084 - root - INFO - step:  1  loss:  8.1003  grad_norm:  1.4468  memory:  0.23GiB(0.24%)  tps: 150  tflops: 0.01  mfu: 0.00%
[rank4]:[titan] 2025-10-14 23:09:32,085 - root - INFO - Synchronizing and adjusting timeout for all ProcessGroups to 0:01:40
[rank4]:[titan] 2025-10-14 23:09:32,151 - root - INFO - step:  2  loss:  7.7710  grad_norm:  1.5711  memory:  0.25GiB(0.26%)  tps: 30,879  tflops: 2.21  mfu: 0.22%
[rank4]:[titan] 2025-10-14 23:09:32,218 - root - INFO - step:  3  loss:  7.0456  grad_norm:  1.9929  memory:  0.25GiB(0.26%)  tps: 30,642  tflops: 2.19  mfu: 0.22%
[rank4]:[titan] 2025-10-14 23:09:32,283 - root - INFO - step:  4  loss:  6.1601  grad_norm:  2.3669  memory:  0.25GiB(0.26%)  tps: 31,723  tflops: 2.27  mfu: 0.23%
[rank4]:[titan] 2025-10-14 23:09:32,349 - root - INFO - step:  5  loss:  5.2561  grad_norm:  2.5374  memory:  0.25GiB(0.26%)  tps: 31,047  tflops: 2.22  mfu: 0.22%
[rank4]:[titan] 2025-10-14 23:09:32,420 - root - INFO - step:  6  loss:  4.8109  grad_norm:  2.8868  memory:  0.25GiB(0.26%)  tps: 29,067  tflops: 2.08  mfu: 0.21%
[rank4]:[titan] 2025-10-14 23:09:32,488 - root - INFO - step:  7  loss:  4.4534  grad_norm:  2.4835  memory:  0.25GiB(0.26%)  tps: 30,383  tflops: 2.17  mfu: 0.22%
[rank4]:[titan] 2025-10-14 23:09:32,554 - root - INFO - step:  8  loss:  4.2613  grad_norm:  2.1554  memory:  0.25GiB(0.26%)  tps: 31,078  tflops: 2.22  mfu: 0.22%
[rank4]:[titan] 2025-10-14 23:09:32,619 - root - INFO - step:  9  loss:  4.6215  grad_norm:  1.7431  memory:  0.25GiB(0.26%)  tps: 31,814  tflops: 2.28  mfu: 0.23%
[rank4]:[titan] 2025-10-14 23:09:32,687 - root - INFO - step: 10  loss:  4.0993  grad_norm:  2.0867  memory:  0.25GiB(0.26%)  tps: 30,272  tflops: 2.17  mfu: 0.22%
```
xrsrke pushed a commit to NousResearch/torchtitan that referenced this pull request Feb 25, 2026
Introduced by pytorch#1776.

Verified with the comment:

```
CONFIG_FILE="./torchtitan/models/llama3/train_configs/debug_model.toml" ./run_train.sh   --training.steps=10 --parallelism.context_parallel_degree=8
```
w/o this PR
```
[rank4]:[titan] 2025-10-14 23:10:44,306 - root - INFO - step:  1  loss:  8.0385  grad_norm:  1.3444  memory:  1.21GiB(1.27%)  tps: 2,904  tflops: 0.21  mfu: 0.02%
[rank4]:[titan] 2025-10-14 23:10:44,306 - root - INFO - Synchronizing and adjusting timeout for all ProcessGroups to 0:01:40
[rank4]:[titan] 2025-10-14 23:10:44,347 - root - INFO - step:  2  loss:  7.6989  grad_norm:  1.4401  memory:  1.34GiB(1.41%)  tps: 49,366  tflops: 3.53  mfu: 0.36%
[rank4]:[titan] 2025-10-14 23:10:44,388 - root - INFO - step:  3  loss:  7.0687  grad_norm:  1.8302  memory:  1.34GiB(1.41%)  tps: 51,400  tflops: 3.68  mfu: 0.37%
[rank4]:[titan] 2025-10-14 23:10:44,425 - root - INFO - step:  4  loss:  6.2672  grad_norm:  2.2684  memory:  1.34GiB(1.41%)  tps: 55,749  tflops: 3.99  mfu: 0.40%
[rank4]:[titan] 2025-10-14 23:10:44,465 - root - INFO - step:  5  loss:  5.3015  grad_norm:  2.5508  memory:  1.34GiB(1.41%)  tps: 50,835  tflops: 3.64  mfu: 0.37%
[rank4]:[titan] 2025-10-14 23:10:44,522 - root - INFO - step:  6  loss:  4.7779  grad_norm:  2.4103  memory:  1.34GiB(1.41%)  tps: 36,188  tflops: 2.59  mfu: 0.26%
[rank4]:[titan] 2025-10-14 23:10:44,573 - root - INFO - step:  7  loss:  4.4823  grad_norm:  2.2675  memory:  1.34GiB(1.41%)  tps: 41,167  tflops: 2.95  mfu: 0.30%
[rank4]:[titan] 2025-10-14 23:10:44,618 - root - INFO - step:  8  loss:  4.3291  grad_norm:  1.9877  memory:  1.34GiB(1.41%)  tps: 45,962  tflops: 3.29  mfu: 0.33%
[rank4]:[titan] 2025-10-14 23:10:44,656 - root - INFO - step:  9  loss:  4.7022  grad_norm:  1.5639  memory:  1.34GiB(1.41%)  tps: 53,689  tflops: 3.84  mfu: 0.39%
[rank4]:[titan] 2025-10-14 23:10:44,695 - root - INFO - step: 10  loss:  4.1905  grad_norm:  1.8200  memory:  1.34GiB(1.41%)  tps: 52,967  tflops: 3.79  mfu: 0.38%
```

w/ this PR
```
[rank4]:[titan] 2025-10-14 23:09:32,084 - root - INFO - step:  1  loss:  8.1003  grad_norm:  1.4468  memory:  0.23GiB(0.24%)  tps: 150  tflops: 0.01  mfu: 0.00%
[rank4]:[titan] 2025-10-14 23:09:32,085 - root - INFO - Synchronizing and adjusting timeout for all ProcessGroups to 0:01:40
[rank4]:[titan] 2025-10-14 23:09:32,151 - root - INFO - step:  2  loss:  7.7710  grad_norm:  1.5711  memory:  0.25GiB(0.26%)  tps: 30,879  tflops: 2.21  mfu: 0.22%
[rank4]:[titan] 2025-10-14 23:09:32,218 - root - INFO - step:  3  loss:  7.0456  grad_norm:  1.9929  memory:  0.25GiB(0.26%)  tps: 30,642  tflops: 2.19  mfu: 0.22%
[rank4]:[titan] 2025-10-14 23:09:32,283 - root - INFO - step:  4  loss:  6.1601  grad_norm:  2.3669  memory:  0.25GiB(0.26%)  tps: 31,723  tflops: 2.27  mfu: 0.23%
[rank4]:[titan] 2025-10-14 23:09:32,349 - root - INFO - step:  5  loss:  5.2561  grad_norm:  2.5374  memory:  0.25GiB(0.26%)  tps: 31,047  tflops: 2.22  mfu: 0.22%
[rank4]:[titan] 2025-10-14 23:09:32,420 - root - INFO - step:  6  loss:  4.8109  grad_norm:  2.8868  memory:  0.25GiB(0.26%)  tps: 29,067  tflops: 2.08  mfu: 0.21%
[rank4]:[titan] 2025-10-14 23:09:32,488 - root - INFO - step:  7  loss:  4.4534  grad_norm:  2.4835  memory:  0.25GiB(0.26%)  tps: 30,383  tflops: 2.17  mfu: 0.22%
[rank4]:[titan] 2025-10-14 23:09:32,554 - root - INFO - step:  8  loss:  4.2613  grad_norm:  2.1554  memory:  0.25GiB(0.26%)  tps: 31,078  tflops: 2.22  mfu: 0.22%
[rank4]:[titan] 2025-10-14 23:09:32,619 - root - INFO - step:  9  loss:  4.6215  grad_norm:  1.7431  memory:  0.25GiB(0.26%)  tps: 31,814  tflops: 2.28  mfu: 0.23%
[rank4]:[titan] 2025-10-14 23:09:32,687 - root - INFO - step: 10  loss:  4.0993  grad_norm:  2.0867  memory:  0.25GiB(0.26%)  tps: 30,272  tflops: 2.17  mfu: 0.22%
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants