Repository navigation
Conversation
… master weights Signed-off-by: Ritesh Patel <ripatel@nvidia.com>
Contributor
[Medium impact] The PR appears safe to merge. SummaryThis PR changes MXFP8 master-weight updates to reduce one-byte E8M0 scales instead of two-byte BF16 maxima.
No actionable issues were found. GPU tests were not run. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Local master-weight shard] --> B[Local block maxima]
B --> C[Packed E8M0 scales]
C --> D[MAX all-reduce across ranks]
D --> E[Copy scales into model weights]
E --> F[Cast each local shard to FP8]
Reviews (1) · Last reviewed commit: "[PyTorch] All-reduce MXFP8 E8M0 scales i..." · Reviewed by Greptile |
This branch has not been deployed
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.
Description
cast_master_weights_to_fp8/quantize_master_weightswith MXFP8 all-reduced every block's bf16 partial amax (2 bytes) and then turned the result into an E8M0 scale. It now computes each rank's E8M0 scales from its partial amaxes and all-reduces those (1 byte) with MAX. The scales are bit-identical and the all-reduce payload halves.Fixes # (issue)
Type of change
Changes
Please list the changes introduced in this PR:
In
transformer_engine/pytorch/tensor/utils.py,_cast_master_weights_to_fp8_mxfp8_scaling:uint8bufferpacked_scale_invssits besidepacked_amaxes, with per-weight rowwise and columnwise views at the same offsets.multi_tensor_compute_scale_inv_e8m0on the local amaxes into the packed scale views, then all-reducespacked_scale_invswith MAX. It is still one all-reduce for all weights._rowwise_scale_inv/_columnwise_scale_invwith onetorch._foreach_copy_.Checklist: