Add tp_mode="auto" for per-weight GTP mode selection in Muon - #3
Open
Arcana-2236 wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.