Skip to content

[DistributedMuon] Batch compatible local matrix updates - #4105

Closed
weifengpy wants to merge 22 commits into
gh/weifengpy/52/basefrom
gh/weifengpy/52/head
Closed

weifengpy wants to merge 22 commits into
gh/weifengpy/52/basefrom
gh/weifengpy/52/head

Conversation

@weifengpy

@weifengpy weifengpy commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Batch compatible rank-3 local compute layouts into one Newton-Schulz call while retaining per-layout momentum preparation and parameter updates. Preplan and eagerly reserve bounded reusable scratch during DistributedMuon construction, with singleton fallback for oversized batches or divergent group settings.

[ghstack-poisoned]
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 11, 2026
[ghstack-poisoned]
weifengpy added a commit that referenced this pull request Aug 11, 2026
Batch compatible rank-3 local compute layouts into one Newton-Schulz call while retaining per-layout momentum preparation and parameter updates. Preplan and eagerly reserve bounded reusable scratch through flex_optimizer_reshard, with singleton fallback for oversized batches or divergent group settings.

ghstack-source-id: 5911305
Pull-Request: #4105
[ghstack-poisoned]
weifengpy added a commit that referenced this pull request Aug 11, 2026
Batch compatible rank-3 local compute layouts into one Newton-Schulz call while retaining per-layout momentum preparation and parameter updates. Preplan and eagerly reserve bounded reusable scratch through flex_optimizer_reshard, with singleton fallback for oversized batches or divergent group settings.

ghstack-source-id: 30747cf
Pull-Request: #4105
[ghstack-poisoned]
weifengpy added a commit that referenced this pull request Aug 11, 2026
Batch compatible rank-3 local compute layouts into one Newton-Schulz call while retaining per-layout momentum preparation and parameter updates. Preplan and eagerly reserve bounded reusable scratch through flex_optimizer_reshard, with singleton fallback for oversized batches or divergent group settings.

ghstack-source-id: 28520d9
Pull-Request: #4105
[ghstack-poisoned]
weifengpy added a commit that referenced this pull request Aug 11, 2026
Batch compatible rank-3 local compute layouts into one Newton-Schulz call while retaining per-layout momentum preparation and parameter updates. Preplan and eagerly reserve bounded reusable scratch through flex_optimizer_reshard, with singleton fallback for oversized batches or divergent group settings.

ghstack-source-id: 846edb4
Pull-Request: #4105
[ghstack-poisoned]
weifengpy added a commit that referenced this pull request Aug 12, 2026
Batch compatible rank-3 local compute layouts into one Newton-Schulz call while retaining per-layout momentum preparation and parameter updates. Preplan and eagerly reserve bounded reusable scratch through flex_optimizer_reshard, with singleton fallback for oversized batches or divergent group settings.

ghstack-source-id: ebfb2e0
Pull-Request: #4105
[ghstack-poisoned]
weifengpy added a commit that referenced this pull request Aug 12, 2026
Batch compatible rank-3 local compute layouts into one Newton-Schulz call while retaining per-layout momentum preparation and parameter updates. Preplan and eagerly reserve bounded reusable scratch through flex_optimizer_reshard, with singleton fallback for oversized batches or divergent group settings.

ghstack-source-id: a171598
Pull-Request: #4105
[ghstack-poisoned]
weifengpy added a commit that referenced this pull request Aug 12, 2026
Batch compatible rank-3 local compute layouts into one Newton-Schulz call while retaining per-layout momentum preparation and parameter updates. Preplan and eagerly reserve bounded reusable scratch through flex_optimizer_reshard, with singleton fallback for oversized batches or divergent group settings.

ghstack-source-id: 402004c
Pull-Request: #4105
[ghstack-poisoned]
weifengpy added a commit that referenced this pull request Aug 12, 2026
Batch compatible rank-3 local compute layouts into one Newton-Schulz call while retaining per-layout momentum preparation and parameter updates. Preplan and eagerly reserve bounded reusable scratch through flex_optimizer_reshard, with singleton fallback for oversized batches or divergent group settings.

ghstack-source-id: 402004c
Pull-Request: #4105
[ghstack-poisoned]
weifengpy added a commit that referenced this pull request Aug 12, 2026
Batch compatible rank-3 local compute layouts into one Newton-Schulz call while retaining per-layout momentum preparation and parameter updates. Preplan and eagerly reserve bounded reusable scratch through flex_optimizer_reshard, with singleton fallback for oversized batches or divergent group settings.

ghstack-source-id: 503784d
Pull-Request: #4105
[ghstack-poisoned]
weifengpy added a commit that referenced this pull request Aug 12, 2026
Batch compatible rank-3 local compute layouts into one Newton-Schulz call while retaining per-layout momentum preparation and parameter updates. Preplan and eagerly reserve bounded reusable scratch through flex_optimizer_reshard, with singleton fallback for oversized batches or divergent group settings.

ghstack-source-id: ee3a39b
Pull-Request: #4105
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
weifengpy added a commit that referenced this pull request Aug 15, 2026
Batch compatible rank-3 local compute layouts into one Newton-Schulz call while retaining per-layout momentum preparation and parameter updates. Preplan and eagerly reserve bounded reusable scratch during DistributedMuon construction, with singleton fallback for oversized batches or divergent group settings.

ghstack-source-id: 0014eb2
Pull-Request: #4105
weifengpy added a commit that referenced this pull request Aug 15, 2026
Batch compatible rank-3 local compute layouts into one Newton-Schulz call while retaining per-layout momentum preparation and parameter updates. Preplan and eagerly reserve bounded reusable scratch during DistributedMuon construction, with singleton fallback for oversized batches or divergent group settings.

ghstack-source-id: 0014eb2
Pull-Request: #4105
[ghstack-poisoned]
[ghstack-poisoned]
@weifengpy

Copy link
Copy Markdown
Contributor Author

note to myself, from claude

Scratch pool should be shared across DistMuon instances on a rank, not sized per instance.
  ▎
  ▎ OptimizersContainer builds one optimizer per (model_part, optimizer_name) (optimizer.py:306), so under an 
  ▎ interleaved pipeline schedule a rank holds one DistMuon per virtual stage — two or four of them, typically. Scratch
  ▎ that's "eagerly reserved during DistributedMuon construction" is therefore reserved once per virtual stage.
  ▎
  ▎ That over-reserves, because OptimizersContainer.step() runs the instances strictly sequentially (optimizer.py:414) 
  ▎ — only one is ever using its scratch. The rank's real peak demand is one pool; a per-instance allocation reserves 
  ▎ N.
  ▎
  ▎ This is newly reachable: #4102 lifts the pipeline_parallel_degree > 1 rejection in Kimi's registry, and Kimi is the
  ▎ only config that builds DistMuon. Worth sizing the pool per rank, or sharing one across instances, before this 
  ▎ lands — it's cheaper now than as a retrofit.
  ▎
  ▎ Note the bucket plan is not affected: it's partitioned across instances rather than duplicated, so it doesn't grow 
  ▎ with virtual stages.

@tianyu-l tianyu-l closed this Oct 7, 2026
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