Repository navigation
Refresh fused AllGather layout after shard resets - #373
Open
zhangming700 wants to merge 1 commit into
Open
zhangming700 wants to merge 1 commit into
zhangming700 wants to merge 1 commit into
Conversation
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.
/kind bug
Change
After the first BF16 forward, converting the sharded weights to FP32 could leave the fused AllGather buckets and their unpack buffers configured for BF16. A subsequent forward read updated weights but rounded away their FP32 low bits. Both settings of
comm_fusion_zero_copywere affected.Refresh the cached gather layout when the effective parameter dtype or shard layout changes. Recreate incompatible unpack buffers with their unsharded parameter views. Validate flat-buffer views by storage, offset, size, dtype and contiguity before reusing a bucket. Retain each parameter’s resolved mixed-precision policy on reset.
Verification
The original change on
c9e7fcawas validated on eight Ascend 910B3 devices with the full Qwen3-30B-A3B checkpoint. After a warm BF16-to-FP32 reset, all 49 gathers per rank used FP32. Rank-specific sentinels retained their low bits on all eight devices. With zero-copy enabled, the next forward issued 49 direct gathers and zero copy-ins or rebinds. With zero-copy disabled it issued 49 copy-ins.Cold and warm resets produced identical per-rank losses and gradient norms with zero-copy enabled and disabled at gradient accumulation 1, 2 and 4. Meta initialization, an explicit BF16 communication policy and same-dtype storage replacement also passed. CPU offload with unpinned file-backed CPU weights passed forward and backward. A separate check on ordinary CPU shards observed both consecutive weight updates on every rank.
In one profiled FP32 training step per mode, median per-rank cumulative AllGather time over 98 calls was 1962 ms with zero-copy disabled and 1761 ms with it enabled. Step-time gains varied by accumulation setting.
This port targets
masterat79f1597. Syntax and diff checks passed on the master port. The eight-device measurements were collected on the original test base. Supersedes #368.