Skip to content

perf(fsdp): accumulate final fused reduce-scatter gradients before root cleanup - #372

Closed
zhangming700 wants to merge 2 commits into
hf1s:masterfrom
zhangming700:codex/fsdp-early-grad-master
Closed

zhangming700 wants to merge 2 commits into
hf1s:masterfrom
zhangming700:codex/fsdp-early-grad-master

Conversation

@zhangming700

@zhangming700 zhangming700 commented Nov 26, 2026 •

Copy link
Copy Markdown

Apply final fused reduce-scatter views directly to existing device shard gradients during backward. Keep delayed finalization for first gradients, offload, FP32 main gradients and source-layout reductions. Includes a regression test for exactly-once accumulation and view lifetime.

Supersedes #370 on the master base. Prior full Qwen3-30B-A3B eight-device measurements on experiment base c9e7fca showed peak allocated memory dropping from 26.33 to 19.68 GiB for accumulation 2 and 4, with bitwise-matching loss and grad norm.

Master validation (39bd984): use the resolved per-parameter apply_grad_on_fp32_main_grad field. All 240 fully_shard unit tests passed (6 warnings). On the two changed files, the repository Pylint hook reports the same six diagnostics as master; Lizard reports the same existing copy_out CCN 17 warning. The eight-device performance numbers above are from the earlier experiment base.

Copy link
Copy Markdown
Author

/check-pr

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant