Repository navigation
fix(fsdp): preserve FA3 autograd and deterministic dispatch - #259
Open
Odysseusailoon wants to merge 10 commits into
Open
Odysseusailoon wants to merge 10 commits into
Odysseusailoon wants to merge 10 commits into
Conversation
Odysseusailoon
marked this pull request as ready for review
September 28, 2026 03:45
Odysseusailoon
requested review from
Rockdu,
guapisolo and
zhihengy
as code owners
September 28, 2026 03:45
This branch has not been deployed
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.
Summary
With
--fsdp-attention-backend _flash_3, the pinned Diffusers implementation wraps FA3 in a custom op without a registered backward. It also passes an explicitdeterministic=False, which can override Miles' existingpartial(..., deterministic=True).This change registers a dense FA3 adapter that calls FA3's public autograd function directly, preserving backward support and forwarding the effective deterministic request to the kernel.
Validation
train_diffusion.py --helppassed.Model-level SP=2 validation
The tiny Wan FSDP2 regression passed on two H100s through the normal pytest entry point: 1 passed, 0 skipped/errors/failures. It compares DP=2/SP=1 with DP=1/SP=2 at fixed global batch 2 for two SGD updates, with gradient checkpointing disabled and enabled. The model is randomly initialized and uses synthetic inputs; it reuses Miles' existing Wan sequence-parallel plan.
Each rank passed 2,304 numerical comparisons, including 1,152 bitwise-equal repeat checks, covering all 69 trainable parameter tensors. All 96 traced real FA3 calls per rank returned successfully, including 32 checkpoint recomputations. Across SP=1/2, full-gradient and full-parameter-delta relative L2 errors were at most 0.001843 and 0.001701; every per-parameter check also passed the fixed, predeclared limits. Checkpoint on/off results were bitwise equal in this run. The native two-rank CPU control also passed.
Scope
This establishes the tested tiny Wan architecture's FSDP2 + FA3 + Ulysses training integration. It does not establish pretrained Wan quality, Krea2 SP=2, model-level SP=4, frozen rollout/train numerical parity, or whole-run repeatability. It does not add Ring, FA3 varlen, or compile support. Deterministic behavior remains dependent on the underlying kernel, hardware, and input configuration; recorded GPU validation is scoped to H100.
See the validation guide for reproduction commands and test scope.