Repository navigation
[CI Fix][GraphTrainer] Avoid materializing parameters during FSDP inspection - #5560
Conversation
1372455 to
ffb5a79
Compare
|
The corrected root-cause fix passes the full GraphTrainer B200 workflow: https://github.com/pytorch/torchtitan/actions/runs/39375868492 In particular, |
|
The regular B200 failure on this PR is the independent Kimi K3 golden drift fixed in #5559. Its reported baseline values exactly match #5559's updated golden, and that PR passes the full regular B200 workflow: https://github.com/pytorch/torchtitan/actions/runs/39374678479 The relevant GraphTrainer B200 workflow for this PR passes: https://github.com/pytorch/torchtitan/actions/runs/39375868492 |
|
@claude |
|
Claude finished @tianyu-l's task in 54s —— View job Why
|
|
|
||
| if param_shard_placements is None: | ||
| param_shard_placements = linear_param_shard_placements(model) | ||
| with disable_active_parametrization(): |
There was a problem hiding this comment.
please add comments around
It would help to add a one-line comment above L536, along the lines of "model may contain submodules parametrized by an earlier data_parallel call (e.g. EP experts); read raw params instead of running ReplicateComputation".
Summary
Root cause
The GraphTrainer B200 job fails in
graph_trainer_dist_moe_mxfp8_fsdp_ep_ppwhile applying pipeline-stage parallelism: https://github.com/pytorch/torchtitan/actions/runs/39351458272/job/118396337526data_parallel()computeslinear_param_shard_placements(model)before its module loop skips modules that already have SimpleFSDP. On a reused/shared module that GraphPP has already parametrized, readingchild.weightduring that inspection invokesReplicateComputationand tries to build the MXFP8 compute operands.This happens during model construction, while the model is still on the
metadevice and beforeto_empty(device=...). Dist-MoE checks bothweight.is_cudaandweight.is_contiguous()but reports either failure asValueError: weight must be contiguous CUDA storage. Here the failed condition isweight.is_cuda == False, not contiguity.Regression provenance
#4867 introduced the unconditional
linear_param_shard_placements(model)scan that reads parametrizedchild.weight. #4949 later allowed callers to supply placements explicitly, but retained that scan on the default path.The workflow installs
dist_moe@mainrather than a pinned revision. The last passing run on October 15 installeddist_moe@6f0c3d4216:https://github.com/pytorch/torchtitan/actions/runs/38663506034
The first failing run on October 16 installed
dist_moe@e3d21b8d2a:https://github.com/pytorch/torchtitan/actions/runs/38832949153
Between those revisions, meta-pytorch/dist_moe@fa32967a85 added the valid CUDA/contiguous input contract and exposed the latent GraphTrainer bug. That commit has no associated public GitHub PR.
The Dist-MoE check should not be weakened and the dependency should not be pinned back: parameter-layout inspection should never execute the parameter's compute representation in the first place.
Fix
Use GraphTrainer's existing
disable_active_parametrization()context while inspecting shard placements. Inspection now sees the raw sharded parameter instead of materializing its compute representation; actual forward parametrization is unchanged.An initial attempt to call
.contiguous()at the Dist-MoE boundary failed with the same error, confirming that the meta device, not storage stride, was the violated contract:https://github.com/pytorch/torchtitan/actions/runs/39374680382/job/118470042165
Test plan
pytest -q torchtitan/experiments/graph_trainer/tests/test_simple_fsdp.py -k reapplying_data_parallel -vv(pass)SKIP=pyrefly-check pre-commit run --all-files(pass)The shared local environment has an older PyTorch/Pyrefly API set than current main, so the Pyrefly hook is left to CI.
The regular B200 failure on this PR is the independent Kimi K3 golden drift fixed in #5559. Its reported values exactly match #5559's updated golden, and that PR passes the regular B200 workflow: https://github.com/pytorch/torchtitan/actions/runs/39374678479