Fix assertion logic in combined_1f1b_schedule_for_interleaved_pipelining - #4276
Merged
asolergi-nv merged 4 commits intoApr 28, 2026
Merged
Conversation
joapolarbear
marked this pull request as ready for review
April 13, 2026 13:34
…ning The assert checked forward microbatch's `input_tensor` against backward microbatch's `input_tensor_grad`. In interleaved PP with VP>1, backward has chunk reversal (`model_chunk_id = num_chunks - id - 1`), so forward and backward are always on different VP stages in steady-state. This causes false assertion failures when forward is on a non-first stage (input_tensor != None) but backward is on a first stage (input_tensor_grad == None). Fix: check `b_input_tensor is not None` instead, which directly corresponds to whether the backward microbatch received activation from upstream and thus should produce input_tensor_grad. Reproduction: PP=2 VP=2 EP=4 TP=1 with --overlap-moe-expert-parallel-comm
joapolarbear
force-pushed
the
fix/interleaved-pp-overlap-moe-assert
branch
from
April 13, 2026 13:36
a65f38a to
8c8df83
Compare
Phlip79
approved these changes
Apr 15, 2026
Member
|
/ok to test 4c8eb93 |
Member
|
/claude review |
yashaswikarnati
approved these changes
Apr 17, 2026
Contributor
Author
|
Hi @chtruong814 , I noticed the waiting-on-customer label was added — could you let me know what specifically is expected from my side? All review comments look resolved and the PR has 4 approvals, so I want to make sure I'm not missing any required signoff, DCO, or additional validation. Happy to address anything needed to move this toward merge. Thanks! |
deepakn94
approved these changes
Apr 27, 2026
Contributor
|
/claude review |
Contributor
There was a problem hiding this comment.
LGTM. Both fixes are correct:
b_model_chunk_id is not Noneinstead of truthiness check — prevents skipping backward post-processing when chunk ID is 0.b_input_tensor is not Nonecorrectly guards theinput_tensor_gradassertion against the backward path's input tensor rather than the forward path's.
asolergi-nv
enabled auto-merge
April 27, 2026 17:15
Contributor
|
/ok to test 3554b4c |
ericharper
approved these changes
Apr 27, 2026
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/25037413795 |
yangbofun
pushed a commit
to xlm-research/Megatron-LM
that referenced
this pull request
May 22, 2026
…ing (NVIDIA#4276) Co-authored-by: Hanpeng Hu <haaanpeng@outlook.com> Co-authored-by: Deepak Narayanan <deepakn94@gmail.com> Co-authored-by: Antoni-Joan Solergibert <asolergibert@nvidia.com>
yhgalaxy
pushed a commit
to yhgalaxy/Megatron-LM
that referenced
this pull request
Jun 17, 2026
…ing (NVIDIA#4276) Co-authored-by: Hanpeng Hu <haaanpeng@outlook.com> Co-authored-by: Deepak Narayanan <deepakn94@gmail.com> Co-authored-by: Antoni-Joan Solergibert <asolergibert@nvidia.com> Signed-off-by: yhgalaxy <yhgalaxy@outlook.com>
jon-barker
pushed a commit
to jon-barker/Megatron-LM
that referenced
this pull request
Jul 10, 2026
…ing (NVIDIA#4276) Co-authored-by: Hanpeng Hu <haaanpeng@outlook.com> Co-authored-by: Deepak Narayanan <deepakn94@gmail.com> Co-authored-by: Antoni-Joan Solergibert <asolergibert@nvidia.com> Signed-off-by: Jon Barker <jbarker@aws-cmh-slurm-1-vscode-02.cm.cluster>
terminator123
pushed a commit
to 021ai/Megatron-LM
that referenced
this pull request
Aug 3, 2026
…ing (NVIDIA#4276) Co-authored-by: Hanpeng Hu <haaanpeng@outlook.com> Co-authored-by: Deepak Narayanan <deepakn94@gmail.com> Co-authored-by: Antoni-Joan Solergibert <asolergibert@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.
Description
Fix incorrect assertion in
combined_1f1b_schedule_for_interleaved_pipeliningfunction at line 237.Issue
The assertion at line 237-238 checks:
However, this is logically incorrect. The
input_tensor_gradis the backward pass output that corresponds tob_input_tensor(backward input tensor), notinput_tensor(forward input tensor).Root Cause Analysis
input_tensoris set whenf_model is not None(forward model exists) at lines 186-192b_input_tensoris set whenb_model is not None(backward model exists) at lines 198-202input_tensor_gradis computed based onb_input_tensorat lines 436-447Fix
Change line 237 from:
to:
This ensures the assertion correctly validates that
input_tensor_gradis not None when the backward input tensor exists, matching the actual data flow.Type of change
Testing
The fix corrects the logical condition to match the data flow in the combined forward-backward step computation.