Skip to content

[graph_trainer][perf] Extract noAllGather FSDP1 parameter prep in UNSHARD for PP - #5392

Merged
IvanKobzarev merged 1 commit into
pytorch:mainfrom
IvanKobzarev:ivan/graph-trainer-pp-fsdp1-noag-unshard-20261014
Oct 14, 2026
Merged

IvanKobzarev merged 1 commit into
pytorch:mainfrom
IvanKobzarev:ivan/graph-trainer-pp-fsdp1-noag-unshard-20261014

Conversation

@IvanKobzarev

@IvanKobzarev IvanKobzarev commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

In case of no-FSDP parameters include some preparation ops, that must be done only once.
E.g. quantization, casts.

We do not want to repeat them in every microbatch and extract them with FSDP all-gather chains into UNSHARD action.

Previously we did not run this extraction for FSDP1 case which resulted in duplication of quantization in every microbatch action.

This PR enables this extraction for PP and no FSDP.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 14, 2026
@IvanKobzarev IvanKobzarev changed the title [graph_trainer][perf] Extract noAG FSDP1 parameter prep in UNSHARD for PP [graph_trainer][perf] Extract noAllGather FSDP1 parameter prep in UNSHARD for PP Oct 14, 2026
@IvanKobzarev
IvanKobzarev force-pushed the ivan/graph-trainer-pp-fsdp1-noag-unshard-20261014 branch from 20ef203 to 000a081 Compare October 14, 2026 14:40
@IvanKobzarev
IvanKobzarev force-pushed the ivan/graph-trainer-pp-fsdp1-noag-unshard-20261014 branch from 000a081 to 72e30f7 Compare October 14, 2026 14:43
@IvanKobzarev
IvanKobzarev marked this pull request as ready for review October 14, 2026 14:47
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Oct 14, 2026
output = _unshard_output_from_all_gather(last_all_gather)
if user.meta.get("autograd_backward", False) or not fsdp_param_fqns(user):
continue
# FSDP1 will not have all-gather, but we want to extract cast and quantization

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at first glance, I thought fsdp1 mention the old implementation of FSDP, in contrast of FSDP2 impl.

but you mean the case for FSDP=1, or noFSDP

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, sorry, I meant no fsdp, fsdp=1. Completely forgot about old FSDP1 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/fake-pg Run 1-GPU Fake PG integration tests CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants