Repository navigation
Conversation
Signed-off-by: hongbinl <hongbinl@nvidia.com>
…ation Signed-off-by: hongbinl <hongbinl@nvidia.com>
Signed-off-by: hongbinl <hongbinl@nvidia.com>
Signed-off-by: hongbinl <hongbinl@nvidia.com>
Signed-off-by: hongbinl <hongbinl@nvidia.com>
Signed-off-by: hongbinl <hongbinl@nvidia.com>
Signed-off-by: hongbinl <hongbinl@nvidia.com>
Signed-off-by: hongbinl <hongbinl@nvidia.com>
Signed-off-by: hongbinl <hongbinl@nvidia.com>
Signed-off-by: hongbinl <hongbinl@nvidia.com>
lhb8125
marked this pull request as ready for review
November 27, 2026 14:49
Contributor
[Medium impact] The changes affect PyTorch grouped quantization and activation offload paths. The PR appears safe to merge, with one non-blocking correction needed in a test assertion. Findings
SummarySeparates grouped FP8 and NVFP4 data from scales and optional amax values, so metadata can stay on GPU after data is offloaded.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
Q[Grouped quantization] --> D[Shared data storage per direction]
Q --> M[Separate scales and optional amax storage]
D --> O[Copy expert data to CPU]
O --> R[Release all GPU data references]
R --> F[Data storage can be freed]
M --> G[Metadata can stay on GPU]
Reviews (1) · Last reviewed commit: "Exercise bulk offload lifetime and group..." · 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.
Change
GroupedLinear packed each expert’s quantized data and scales into the same bulk storage. A small scale kept on CUDA could therefore keep the entire data block alive after offload.
record_streamtracks the shared allocation during asynchronous copies.Validation
Ran Megatron
pretrain_gpt.py(c5f510b76, EP2, four MoE layers, three Adam steps). TEe970e08badds tests to the production code ind97d8a49. At every step, loss, gradient norm, gradients and updated parameters matched the offload-disabled control on both ranks. Companion Megatron PRe970e08b/ 6677061e970e08b/ 2349987d97d8a49/ 2346453Why 20 releases from 24 bulk calls? The FP8 traces show that after warmup, MCore keeps layer 4’s FC1 input on the GPU because backward uses it first. On steps 2 and 3, ranks 0 and 1 each skipped that layer’s device-to-host copy. All 20 groups selected for offload released their data storage.
Targeted tests passed on H100 (91) and GB300 (131), including coverage for storage release, byte-exact reload and quantization dispatch. In a GB300 NVFP4 split with 16 local experts and offload enabled, fusion reduced kernel launches from 48 to 3 and summed GPU kernel time from 253 to 23 µs. With offload disabled, the same split kept 3 launches and host call time rose from 253 to 264 µs.