Repository navigation
[cudagraph] Capture single-stage pipeline forward-backward steps - #4493
Merged
Merged
Conversation
xmfan
marked this pull request as ready for review
September 5, 2026 10:29
xmfan
requested review from
fegin,
tianyu-l,
wconstab and
wwwjn
as code owners
September 5, 2026 10:29
Contributor
Author
|
@tianyu-l I don't have permissions to merge the stack 😂 |
tianyu-l
approved these changes
Sep 5, 2026
tianyu-l
left a comment
Contributor
There was a problem hiding this comment.
I couldn't merge previous stack either because they used ghstack. Maybe could you submit a consolidated one to ease the merge.
Comment on lines
+361
to
+363
| gradient_accumulation_steps: int = 1, | ||
| sdc_num_steps: int = 0, | ||
| sdc_num_replays: int = 0, |
Contributor
There was a problem hiding this comment.
these shouldn't have default
Manually consolidate pytorch#4432, pytorch#4433, and pytorch#4435 with their review follow-ups on main, which already includes the pipeline loss-lifetime fix from pytorch#4430. Support structured CUDA graph inputs, account for gradient accumulation and SDC during warmup, and capture single-stage pipeline schedules while keeping preprocessing outside capture. Require explicit accumulation and SDC schedule arguments as requested in review.
xmfan
force-pushed
the
cudagraph-review-followups
branch
from
September 5, 2026 23:03
66e8996 to
b0f549c
Compare
Contributor
Author
|
Put everything in this PR |
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.
Enable CUDA graph capture and replay for pipeline schedules with one stage per rank, including GPipe and 1F1B. Capture the forward-backward schedule while keeping input preprocessing and token accounting outside the captured region.
This is a manually squashed consolidation of the previous stack and its review follow-ups:
The original PRs were submitted using stack-pr. After losing upstream write access, updating and landing that stack became difficult; this PR replaces those three unmerged PRs with one commit targeting
mainfromxmfan:cudagraph-review-followups. It builds on the already merged #4430: Release consumed pipeline loss graphs.The wrapper handles structured positional and keyword inputs, checks stable input structure and tensor metadata, and copies new tensor values into capture-owned buffers. Warmup invocation counting lives in
wrap_with_cuda_graphand accounts for gradient accumulation and finite or continuous SDC replay schedules. As requested in review,gradient_accumulation_steps,sdc_num_steps, andsdc_num_replaysare required keyword arguments. Two optimizer steps remain a conservative warmup default, allowing an eager step after lazy optimizer state initialization.Pipeline capture reuses a device-resident loss sentinel on non-last stages. Configuration rejects looped schedules and pipeline validation, which reinitializes the shared schedule. The existing real-process-group 1F1B and PP+FSDP integration recipes now enable CUDA graphs and run 10 training steps.
Validation: CI
TorchFT changes and the separate CPU override-registry fix remain outside this PR's scope.