Repository navigation
[1/2] [graph_trainer] Save forward dependencies hidden by mutations - #4842
Merged
IvanKobzarev merged 1 commit intoOct 2, 2026
Merged
Conversation
IvanKobzarev
force-pushed
the
graph-trainer-save-forward-mutation-dependencies
branch
2 times, most recently
from
September 23, 2026 16:02
d1a8764 to
54d82f1
Compare
IvanKobzarev
force-pushed
the
graph-trainer-save-forward-mutation-dependencies
branch
from
September 23, 2026 16:16
54d82f1 to
2a3c645
Compare
IvanKobzarev
force-pushed
the
graph-trainer-save-forward-mutation-dependencies
branch
from
September 23, 2026 16:22
2a3c645 to
ced3eb7
Compare
Base automatically changed from
graph-trainer-effectful-op-partitioning
to
main
September 24, 2026 11:44
IvanKobzarev
force-pushed
the
graph-trainer-save-forward-mutation-dependencies
branch
from
September 24, 2026 11:44
ced3eb7 to
6c2bc41
Compare
IvanKobzarev
marked this pull request as ready for review
September 24, 2026 18:12
IvanKobzarev
requested review from
SherlockNoMad,
aditvenk,
sanketpurandare and
tianyu-l
as code owners
September 24, 2026 18:12
aditvenk
reviewed
Sep 25, 2026
IvanKobzarev
force-pushed
the
graph-trainer-save-forward-mutation-dependencies
branch
2 times, most recently
from
September 25, 2026 12:24
d3d4aaa to
8d6f8a2
Compare
IvanKobzarev
force-pushed
the
graph-trainer-save-forward-mutation-dependencies
branch
from
September 29, 2026 16:48
8d6f8a2 to
cae764e
Compare
Discover existing forward mutation outputs before selecting values saved for backward, and include those mutations in forward dependency analysis. This prevents pure forward values used by backward from being recomputed from storage mutated later in forward. Keep the existing GraphMeta, runtime output, and FSDP split contracts unchanged. Cover the behavior with a CPU regression and an exact SM100 MXFP8 WGrad reproducer.
IvanKobzarev
force-pushed
the
graph-trainer-save-forward-mutation-dependencies
branch
from
October 1, 2026 12:26
2ac386c to
cae764e
Compare
IvanKobzarev
force-pushed
the
graph-trainer-save-forward-mutation-dependencies
branch
from
October 1, 2026 16:02
cae764e to
7c49bcd
Compare
aditvenk
approved these changes
Oct 1, 2026
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.
Current partitioner:
FWD:
BWD:
Backward therefore uses
sin(sin(original_x))- WRONGThe Fix:
Add sources of mutations into lookup of values to be saved , to cut the recomputation chains at them.
Then the old logic will check, that it is used by forward and by backward and save it.
In this case sin(x) will not be replayed.
So the main semantic that we add:
We save forward mutation sources if they are used by backward too.
This makes the recompute cat to be after this points, without rereplaying ops on them.
Implementation:
Extracted all mutation related utilities to torchtitan/experiments/graph_trainer/mutation_utils.py
Removed all positional assumptions to use schema based mutation analysis.