Add an opt-in ZeRO-1/2 gradient norm fast path - #8331
Draft
yh0903 wants to merge 1 commit into
Draft
Conversation
Preserve overflow detection while allowing ZeRO-1/2 GPU optimizers to skip an unused global norm, and avoid identity gradient scaling when clipping is disabled. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: yh0903 <helloyu0903@gmail.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.
Summary
zero_optimization.compute_grad_norm, defaulting totrueNonefromget_global_grad_norm()when norm computation is explicitly disabledSafety contract
Finite/overflow checking is unchanged. This does not remove the required non-finite scan; it only removes work with no mathematical consumer. The default path is unchanged.
Performance
Qwen3-30B-A3B, 48 layers, EP16 on 2x8 H100, sequence length 1024, BF16, ZeRO-1, activation checkpointing enabled:
The paired block used a benchmark-only control that restores the pre-change multiply-by-one path. Peak allocated and reserved memory were unchanged. Two additional rotated blocks isolating the opt-in norm change were both positive (+3.3% and +0.6% E2E); their optimizer-phase saving was stable at about 20 ms, while full-step variance remained larger.
Testing Done
get_global_grad_norm(), clipping/offload/ZenFlow guards, checkpoint clipping, and identity/non-identity scalingast.Strwas removedfdf729ed8adac4ebea4b,feb0641f09c1d42fcb7b,ff508156ab98444ddb2f