Repository navigation
feat(compile): prepare storage and reuse FSDP precision policies - #13
Open
yu-chen-code wants to merge 2 commits into
Open
yu-chen-code wants to merge 2 commits into
yu-chen-code wants to merge 2 commits into
Conversation
yu-chen-code
force-pushed
the
feat-graph-storage-policy
branch
from
November 9, 2026 11:24
0bf26e6 to
c19a0f0
Compare
yu-chen-code
force-pushed
the
feat-graph-storage-policy
branch
from
November 10, 2026 14:46
c19a0f0 to
7665551
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind feature
What does this PR do / why do we need it:
Refreshed on 2026-11-09 against fork/upstream master
a6be99d3. PR1421 is now merged upstream, so its duplicate prerequisite has been removed. Current head:c19a0f0bc37bbdb85db09aa6474f555d28370d14; retained feature/dependency commits:c7d02fea,c19a0f0b. Git range-diff confirms unchanged feature patches. Focused CPU regression on this exact head: 118 JUnit records, 0 failures, 0 errors. The isolated refresh environments now include master-required PEFT 0.21.2 and accelerate 1.13.0; pip check passes. All numerical runs and older source hashes below are pre-refresh evidence. NPU precision training and formal upstream CI were not rerun for this rebase.Prepare graph FSDP parameter storage before creating optimizer state, and apply the existing FSDP mixed-precision policy to joint forward/backward graphs.
prepare_model()before optimizer construction. Preparation retains source-local logical shapes and parameter identities, partitions physical storage once, and exposes final layouts before the first batch. Joint capture remains lazy and uses logical FakeTensor views; graph lowering does not partition live parameters a second time. Failed preparation is terminal, while capture/backend failures retain the prepared storage for a safe retry.cast_forward_inputs=True. The graph casts parameter shards before all-gather, casts gradients before reduction and accumulates FP32 main gradients when requested. Model-owned explicit FP32 regions remain in the model.Validation on Ascend 910B2 with Torch
2.15.0.dev20261005+cpu/ torch-npu2.15.0:TextTrainer.__init__with device/distributed setup and data stages mocked. Real graph preparation and the standard AdamW/FP32-main optimizer construction confirmed that the optimizer receives a BF163 x 3local shard and creates a matching FP32 main parameter, while the compiler retains the logical5 x 3shape and capture remains lazy.0.701689600944519versus0.7016897201538086); they were not skipped or relaxed, and the complete-suite run therefore exited with failure. The alias-forwarding fixture and other interface tests passed.Saved pre-clip norms were
0.43545–0.48454, so all 40 rank-steps exceeded0.1; saved eager pre-gradients and actual first moments confirm scaling, with zero graph/eager gradient/norm/moment error (post-clip gradients were not separately dumped).The numerical runs, constructor contract and public-CI preflight above were pinned to
949c5496. The pre-refresh head0bf26e68differs only by one mock in an existing alias-forwarding unit-test fixture; all 1,512 production blobs are identical. Numerical validation was not rerun under the final commit hash.The distributed acceptance uses GraphCompiler directly and the native eager FSDP path. The separate TextTrainer contract covers its storage/optimizer construction behavior with external stages mocked; end-to-end TextTrainer data loading/training is not established by that test. This PR does not claim DSV4.1 whole-model, CP/TP, checkpoint-resume or backend compilation acceptance.
Which issue(s) this PR fixes:
None
Code review checklist [illustration]: