Skip to content

[spmd_types] switch full_dtensor to LP autograd fn - #3671

Merged
pianpwk merged 10 commits into
mainfrom
gh/pianpwk/40/head
Jun 16, 2026
Merged

pianpwk merged 10 commits into
mainfrom
gh/pianpwk/40/head

Conversation

@pianpwk

@pianpwk pianpwk commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

pianpwk added 2 commits June 15, 2026 00:01
[ghstack-poisoned]
[ghstack-poisoned]
Tests loss-parallel cross-entropy loss bitwise parity, with torch.distributed.tensor.parallel.loss_parallel().
Tests even/uneven vocab sharding, TP, DP+TP, and IGNORE_INDEX labels.

Runs _LossParallelCrossEntropy under typing checking: logits S(1)@TP, labels I@TP -> I@TP.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

original test was using 2d logits, switch to [B, L, D] as loss.py is hardcoded for 3d logits

@pianpwk
pianpwk marked this pull request as ready for review June 15, 2026 16:27
pianpwk added 2 commits June 15, 2026 10:18
[ghstack-poisoned]
[ghstack-poisoned]

@tianyu-l tianyu-l left a comment

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.

Is this bitwise E2E with dtensor loss_parallel?

pianpwk added 3 commits June 15, 2026 22:51
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@pianpwk

pianpwk commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Is this bitwise E2E with dtensor loss_parallel?

I was dumb, that only did it for non-chunked loss path. Now does it for chunked loss too, verified w/ llama3 & qwen3 x (TP, FSDP+TP, CP+TP), SP on/off, loss & grad norm 20 step

[ghstack-poisoned]
@pianpwk
pianpwk changed the base branch from gh/pianpwk/40/base to main June 16, 2026 17:15
@pianpwk
pianpwk changed the base branch from main to gh/pianpwk/40/base June 16, 2026 17:46
[ghstack-poisoned]
[ghstack-poisoned]
@pianpwk
pianpwk changed the base branch from gh/pianpwk/40/base to main June 16, 2026 17:48
submartingales pushed a commit to botcanlearn/torchtitan-upstream that referenced this pull request Jun 16, 2026
@pianpwk
pianpwk merged commit 05d3c36 into main Jun 16, 2026
8 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/8gpu 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.

2 participants