Skip to content

Add tp_mode="auto" for per-weight GTP mode selection in Muon - #3

Open
Arcana-2236 wants to merge 1 commit into
deepakn94:dnarayanan/gtp_plus_muonfrom
Arcana-2236:zhengywang/muon_auto_tp_mode
Open

Add tp_mode="auto" for per-weight GTP mode selection in Muon#3
Arcana-2236 wants to merge 1 commit into
deepakn94:dnarayanan/gtp_plus_muonfrom
Arcana-2236:zhengywang/muon_auto_tp_mode

Conversation

@Arcana-2236

Copy link
Copy Markdown

No single tp_mode wins on every weight. "duplicated" all-gathers and runs Newton-Schulz on min(M,N); "distributed" keeps the [M/G, N] shard, which forces a transpose onto N and pays one all-reduce per NS step. Which is cheaper depends on the shape, the GTP group size, and whether the group's collectives cross an NVLink domain.

For now we use cost model to choose between different TP mode, by estimating runtime, but to make it simple, we can also naively choosing cross domain as dup, N >> M as dup, others are dist.

_select_tp_mode chooses per weight from FLOP counts plus, when the GPU is in the HardwareProfile registry, datasheet bandwidths; without a profile it degrades to a FLOPs-only comparison. Resolved once per distinct shape and logged on rank 0. Existing modes are untouched: "auto" is opt-in and the mode= argument is ignored unless it is selected.

Measured on 128x GB200 (32 nodes, segment=16): 2863.9 -> 2242.6 ms/iteration (1.28x), with the optimizer step going ~1736 -> ~1115 ms. Loss tracks the duplicated baseline to 7e-6 relative at iteration 50.

crosses_domain is hardcoded to is_expert, correct only for an allocation where GTP stays inside one NVLink domain and EGTP crosses racks.

No single tp_mode wins on every weight. "duplicated" all-gathers and runs
Newton-Schulz on min(M,N); "distributed" keeps the [M/G, N] shard, which forces a
transpose onto N and pays one all-reduce per NS step. Which is cheaper depends on
the shape, the GTP group size, and whether the group's collectives cross an
NVLink domain.

_select_tp_mode chooses per weight from FLOP counts plus, when the GPU is in the
HardwareProfile registry, datasheet bandwidths; without a profile it degrades to
a FLOPs-only comparison. Resolved once per distinct shape and logged on rank 0.
Existing modes are untouched: "auto" is opt-in and the mode= argument is ignored
unless it is selected.

Measured on 128x GB200 (32 nodes, segment=16): 2863.9 -> 2242.6 ms/iteration
(1.28x), with the optimizer step going ~1736 -> ~1115 ms. Loss tracks the
duplicated baseline to 7e-6 relative at iteration 50.

crosses_domain is hardcoded to is_expert, correct only for an allocation where
GTP stays inside one NVLink domain and EGTP crosses racks. Deriving it from the
NVML fabric clusterUuid is the durable fix.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Zhengyang Wang <zhengywang@login-lyris01.lyris.clusters.nvidia.com>
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.

1 participant