Repository navigation
[graph_trainer][aot_fx_trace][graph_pp] Add FSDP collective splitting - #3088
Conversation
08f80d7 to
8649738
Compare
8649738 to
8a31c87
Compare
8a31c87 to
d011a2b
Compare
d011a2b to
1ffecd4
Compare
1ffecd4 to
e6c5096
Compare
8f71d5a to
b775af6
Compare
e6c5096 to
8a9c40a
Compare
stack-info: PR: #3088, branch: sanketpurandare/stack/7
8a9c40a to
5a27679
Compare
Add GraphPP extraction for explicit FSDP UNSHARD and REDUCE_GRAD graphs. The splitters identify validated collective chains, keep the no-FSDP forward/backward graphs on the GraphPP flat ABI, and leave fused edge graphs out of the runtime contract. Add FSDP split tests for collective extraction, no-op paths, input-source metadata, and reduce-grad input naming. stack-info: PR: pytorch/torchtitan#3088, branch: sanketpurandare/stack/7
14923e5 to
35d8e14
Compare
| return result | ||
|
|
||
|
|
||
| def find_fsdp_unshard_output(param_placeholder: fx.Node) -> fx.Node | None: |
There was a problem hiding this comment.
i kinda wonder, the 'find' pattern makes sense if you're trying to generalize across frontends, but if that's the case i'd ask whether we are general enough here, or if this pass would need to handle additional allgather bindings (e.g. torchcomms) or consider cases like a dtype conversion, transpose, or other op between the allgather and wait.
if we're ok specializing on simple-fsdp, i wonder if we should just tag the nodes with some metadata and here we just look for the tags. we could even advertise our own tags from this pass as a contract that various fsdp implementations can apply to their nodes e.g. just these tags (unshard_start, unshard_wait) would probably be enough to generalize?
There was a problem hiding this comment.
The chain is general, it passes through cast, views and all_gather, waits and split-cat logic. I think the graph's trainer's fsdp particularly does relay on c10 all_gather-wait_tensor including bucketing. When we add support for other backends we can revisit.
35d8e14 to
e77a8ef
Compare
cd8d8c4 to
7115eb9
Compare
7115eb9 to
f4628cf
Compare
e77a8ef to
a6b658b
Compare
f4628cf to
2d9fe15
Compare
a6b658b to
5e43112
Compare
Add GraphPP extraction for explicit FSDP UNSHARD and REDUCE_GRAD graphs. The splitters use shared FSDP trace-pattern helpers to identify validated all-gather/wait reconstruction chains and reduce-scatter epilogues, keep the no-FSDP forward/backward graphs on the GraphPP flat calling convention, and leave fused edge graphs out of the runtime contract. Teach the default SAC policy to force-save the same helper-selected unshard output when FSDP runs with reshard_after_forward=False, matching the AutoParallel force-save behavior instead of saving every all-gather target. Add FSDP split tests for collective extraction, view and split-cat reconstruction, malformed unshard chains, no-op paths, input-source metadata, reduce-grad input naming, and pre-reduce cast placement. stack-info: PR: pytorch/torchtitan#3088, branch: sanketpurandare/stack/7
2d9fe15 to
2cb2d67
Compare
5e43112 to
cfef45c
Compare
Stacked PRs:
[graph_trainer][aot_fx_trace][graph_pp] Add FSDP collective splitting
Add GraphPP extraction for explicit FSDP UNSHARD and REDUCE_GRAD graphs. The splitters use shared FSDP trace-pattern helpers to identify validated all-gather/wait reconstruction chains and reduce-scatter epilogues, keep the no-FSDP forward/backward graphs on the GraphPP flat calling convention, and leave fused edge graphs out of the runtime contract.
Teach the default SAC policy to force-save the same helper-selected unshard output when FSDP runs with reshard_after_forward=False, matching the AutoParallel force-save behavior instead of saving every all-gather target.
Add FSDP split tests for collective extraction, view and split-cat reconstruction, malformed unshard chains, no-op paths, input-source metadata, reduce-grad input naming, and pre-reduce cast placement.