Commit 2f1ca1d
authored
[graph_trainer] Match Eager FSDP bucket order (pytorch#3590)
## Summary
Align GraphTrainer FSDP bucket packing order with Eager FSDP2.
Eager FSDP2 packs bucket payloads in managed parameter registration
order, while GraphTrainer was packing FSDP collective buckets in FX
graph execution order. For reduce-scatter, this changes byte offsets
inside NCCL buckets. On multinode
FSDP groups, NCCL may use different channel ring orders per offset, so
the same parameter elements can be reduced through a different bf16
accumulation order and lose bitwise parity.
This change derives the FSDP2 module order from traced state FQNs and
sorts each FSDP bucket group by that order before delegating to the
upstream manual overlap bucketer. The Torchtitan-specific logic is
limited to choosing bucket payload
order; upstream still owns merging, insertion, wait remapping, and
bucketed-node tagging.
Verified on 64,128,256 TP=1,8 llama3 8b1 parent 7c5ea51 commit 2f1ca1d
2 files changed
Lines changed: 54 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
193 | 194 | | |
194 | 195 | | |
195 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
196 | 231 | | |
197 | 232 | | |
198 | 233 | | |
| |||
228 | 263 | | |
229 | 264 | | |
230 | 265 | | |
| 266 | + | |
231 | 267 | | |
232 | 268 | | |
233 | 269 | | |
| |||
237 | 273 | | |
238 | 274 | | |
239 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
240 | 284 | | |
241 | 285 | | |
242 | 286 | | |
| |||
402 | 446 | | |
403 | 447 | | |
404 | 448 | | |
| 449 | + | |
405 | 450 | | |
406 | 451 | | |
407 | 452 | | |
| |||
423 | 468 | | |
424 | 469 | | |
425 | 470 | | |
| 471 | + | |
| 472 | + | |
426 | 473 | | |
427 | 474 | | |
428 | 475 | | |
| |||
438 | 485 | | |
439 | 486 | | |
440 | 487 | | |
| 488 | + | |
441 | 489 | | |
442 | 490 | | |
443 | 491 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
148 | 149 | | |
149 | 150 | | |
150 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
151 | 157 | | |
152 | 158 | | |
153 | 159 | | |
| |||
0 commit comments