Skip to content

[DistMuon] Balance Owned and sharded compute placement - #5468

Merged
tianyu-l merged 10 commits into
pytorch:mainfrom
JavaZeroo:feat/distmuon-balanced-placement-v2
Oct 29, 2026
Merged

tianyu-l merged 10 commits into
pytorch:mainfrom
JavaZeroo:feat/distmuon-balanced-placement-v2

Conversation

@JavaZeroo

@JavaZeroo JavaZeroo commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Part 2 of #5278.

Owned-only balancing ignored other work in the same bucket. This PR accounts for fixed local work and jointly assigns unchanged Owned/Shard/BlockShard chunks using explicit (rank, region) mappings. Multiple chunks can share a rank; a common region planner packs them while preserving their original NS views. Matrix boundaries, NS kernels, and parameter/momentum storage remain unchanged.

K3 real-training validation

K3 debugmodel, CC12M test data, 8xH100, EP8/FSDP8, sequence length 512; full forward/backward/optimizer. Comparing main 8a3f5bc with this PR c8ea2ea: two completed pairs of 40 steps, excluding 10 warmup steps. The planned third pair was incomplete and is excluded.

Metric main (ms) PR (ms) Reduction
DistMuon 84.98 66.75 21.5%
Optimizer phase, including AdamW 100.60 82.30 18.2%
Full training iteration 563.36 537.20 4.6%

Medians across the two trials: optimizer metrics use per-step max-rank CUDA-event medians; iterations use max-rank synchronized wall time over 30 steps, divided by 30. Results are specific to this debug configuration.

Correctness

Seed 42 with deterministic mode: per-step loss and grad_norm match bitwise, as do checked Muon parameter/momentum states. All 8 FlexShard CPU tests pass, including the extended placement and plan-reuse regression.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 17, 2026
Schedule original compute chunks without a unit-count gate or per-parameter rank exclusivity. Pack explicit regions through one shared route builder while preserving each original Newton-Schulz batch.

Validated with CPU regressions and CPU/single-device bitwise probes. Previously reported multi-GPU benchmarks apply to earlier code; this revision still needs fresh distributed training, performance, and peak-memory validation.
@JavaZeroo
JavaZeroo marked this pull request as ready for review October 19, 2026 02:06
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Oct 19, 2026
@pytorch-bot

pytorch-bot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Workflows were awaiting approval. CI has now been triggered for the ciflow labels on this PR.

@JavaZeroo

Copy link
Copy Markdown
Contributor Author

@weifengpy could you take a look when you have time? This is part 2 of #5278: one LPT over Owned matrices and Shard/BlockShard chunks, counting the work that stays local. Checked against main on 8x H20 with the K3 debugmodel: loss, grad_norm and Muon states are bitwise equal over 40 steps; DistMuon 85.9 -> 68.2 ms, optimizer step 103.5 -> 85.8 ms.

JavaZeroo added a commit to JavaZeroo/torchtitan that referenced this pull request Oct 26, 2026
@weifengpy

Copy link
Copy Markdown
Contributor

thanks for improving this! I will do some detail check on the coding details

for @shuhuayu, this is should close the memory balancing gap

@weifengpy weifengpy 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.

thanks for the change

@tianyu-l
tianyu-l merged commit 8e24d84 into pytorch:main Oct 29, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in TorchTitan Development Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/fake-pg Run 1-GPU Fake PG integration tests CLA Signed This label is managed by the Meta Open Source bot.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants