Repository navigation
[kimi] Fix FSDP finalization in Kimi K3 pipeline stage - #5142
Merged
Merged
Conversation
Mirror PipelineStage's FSDP setup in the AttnRes forward override so runtime schedules can explicitly finalize accumulated gradients. This fixes the Kimi K3 PP test regression exposed after deferred FSDP gradient reduction was adopted.
shuhuayu
marked this pull request as ready for review
October 8, 2026 06:31
shuhuayu
requested review from
fegin,
tianyu-l,
wconstab and
wwwjn
as code owners
October 8, 2026 06:31
tianyu-l
approved these changes
Oct 8, 2026
Contributor
Author
|
the targeted test passed but there are some other test failures, will fix them in later prs. |
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
Why
AttnResPipelineStage overrides forward_one_chunk. The override omitted the FSDP manual-finalization setup now performed by the PyTorch base implementation. Runtime pipeline schedules later call finalize_backward and fail with:
The resulting test regression was reproduced by the kimi_k3_fsdp2_tp2_ep2_pp2_vpp4 B200 lane in https://github.com/pytorch/torchtitan/actions/runs/37123140508/job/111203042475.
Test plan